Install mysql 5.6 version under CentOS 6

The MySQL version of Linux was 5.5 before, and now it needs to be upgraded to version 5.6. I did not upgrade directly, but uninstalled the original mysql, and then installed version 5.6.

Reference document: https://dev.mysql.com/doc/refman/5.6/en/linux-installation-yum-repo.html Steps to install mysql 5.6:

1. > yum update

2. Download the RPM installation package from the mysql official website. The version I downloaded is: mysql57-community-release-el6-11.noarch.rpm

Download link: https://dev.mysql.com/downloads/repo/yum/

3. Add yum library

> rpm -Uvh mysql57-community-release-el6-11.noarch.rpm

4. Check if the addition is successful

> yum repolist enabled | grep "mysql.*-community.*"

5. Since the latest version of MySQL is 5.7, you need to manually select the version to be installed before installation. If you do not select it, the system will install version 5.7 by default.

Manually modify the file /etc/yum.repos.d/mysql-community.repo

Make sure that only one of them is mysql5.6 enabled.

# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql



[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

 

6. Make sure that only 5.6 is enabled.

> yum repolist enabled | grep mysql

 

7. Install mysql

> sudo yum install mysql-community-server

   I ran into a problem here, the installation always reported

No package mysql-community-server available.
Error: Nothing to do

googled to find out why. In my configuration file /etc/yum.conf, there is an exclude list, which excludes mysql from yum's package list, so I still can't find the mysql* package. Just remove mysql from it.

 

8. start mysql

sudo service mysqld start

 If the startup fails, you can view the reason for the startup failure in the mysql log, var/log/mysqld.log. Then deal with it accordingly.

 

9. When mysql is started, check the status of mysql

sudo service mysqld status

If it is running, the startup is successful.

10. Set password

mysql_secure_installation

During the installation process, you can see us and set any password. When we reset the password, we need to enter the current password. After google, we know that the initialization password is empty. After entering the password, you can set a new password for root.

 

complete.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326170028&siteId=291194637