Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install mysql versions 5.1 and 5.7 on a linux system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article is about how to install mysql version 5.1 and version 5.7 in the linux system, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Yum installs mysql 5.1.73

Uninstall the mysql that comes with the system

Execute the following command to see if you have your own mysql:

Rpm-qa | grep mysql

If any output is found, delete it in turn by executing the following command:

Rpm-e * *-nodeps

Start installing mysql

First install the mysql client:

Yum install mysql

Then install the mysql server:

Yum install mysql-server yum install mysql-devel

So far, mysql related components have been installed successfully!

Modify character set

The configuration file path for mysql is:

/ etc/my.cnf

Add the following configuration to the configuration file to modify the character set:

Default-character-set=utf8

Start and stop

Execute the following command to start:

Service mysqld start

The command to stop is:

Service mysqld stop

If the startup result is as follows, the startup is successful:

Add mysql to boot boot

After booting, you don't have to start the mysql service manually the next time you restart the machine:

Chkconfig-level 345 mysqld on

After execution, view the results and execute the command:

Chkconfig-- list | grep mysql

If the result is as follows, it proves that the boot boot is successful:

Configure the initial password

Execute the following command to set the initial password for root:

Mysqladmin-u root password yourPassword

Log in to mysql

Log in using root and the password set in the previous step, and execute:

Mysql-u root-p

If you log in as follows:

Allow remote login

Perform sql:

GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' IDENTIFIED BY' yourpasswd' WITH GRANT OPTION;FLUSH RIVILEGES

After execution, test whether you can log in at localhost and any remote host respectively!

Mysql 5.7.19 installation

This version of mysql needs glibc14 support, but centos6.7 can only support glic12, so the downloaded version is the official compiled glibc version, which can be decompressed during installation. The operating system is centos6.7, and [download address of installation package]

Http://dev.mysql.com/downloads/mysql/)

Uninstall the mysql that comes with the system

Execute the following command to see if you have your own mysql:

Rpm-qa | grep mysql

If any output is found, delete it in turn by executing the following command:

Rpm-e * *-nodeps

Decompress mysql

Copy the downloaded mysql installation package to / opt, extract the installation package and rename it:

Tar zxvf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz# rename mv mysql-5.7.19-linux-glibc2.12-x86_64 mysql

Initialize mysql

Enter / opt/mysql and initialize the database:

. / bin/mysqld-user=root-basedir=/opt/mysql-datadir=/opt/mysql/data-initialize

After execution, the output is on the console:

[Note] A temporary password is generated for root@localhost: * * mjT,#x_5sW "* * mjT,#x_5sW" is the automatically generated initial password!

Establish a configuration file

Enter to / opt/mysql/support-files

Execute the following command to generate a configuration file:

Cp my-default.cnf / etc/my.cnf

Set mysql as a service and boot it up

Modify the / opt/mysql/support-files/mysql.server file and find:

Basedir=/home/mysqldatadir=/home/mysql/data

Modified to:

Basedir=/opt/mysqldatadir=/opt / mysql/data

Then copy the command file to the system service directory:

Cp / opt/mysql/support-files/mysql.server / etc/init.d/mysqldchkconfig-- add mysqld

Start and stop

The start / stop commands for mysql are:

Service mysqld start/stop above is how to install mysql version 5.1 and version 5.7 in the linux system. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report