1. Newly opened cloud server, need to detect whether the system comes with the installation of MySQL
# yum list installed | grep mysql
2. If you find a system that comes with MySQL, do it decisively
# yum -y remove mysql-libs.x86_64
3. Wherever you store files in the directory to execute, here to explain, because this MySQL source servers in the server abroad, so download speed will be relatively slow, fortunately mysql5.6 only 79M big, and mysql5.7 182M, so this is I do not want to install mysql5.7 reason
# wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
4. Then execute this sentence and explain that this rpm is not a MySQL installation file, just two yum source files, executed after the/etc/yum.repos.d/ This directory has more Mysql-community-source.repo and Mysql-community.repo
rpm -ivh mysql-community-release-el6-5.noarch.rpm
5. At this time, you can use the Yum repolist mysql command to see if you already have MySQL installable files
all | grep mysql
6. Install the MySQL server command (yes):
# yum install mysql-community-server
7. After successful installation
# service mysqld start
8. Since MySQL has just been installed, the root password of MySQL is empty by default, so we need to log in in time with the root user of MySQL (first enter, no password), and change the password
update user set password=PASSWORD("这里输入root用户密码") where User=‘root‘;# flush privileges;
9. Check if MySQL is self-booting and set the self-start command
# chkconfig --list | grep mysqld
# chkconfig mysqld on
10.mysql security settings (the system will ask you a few questions, can not understand the translation after the copy, basically all the way Yes):
# mysql_secure_installation
11. Troubleshoot remote connection issues:
Mysql-u Root-ppassword//Enter the MySQL console
Mysql>use MySQL;
Mysql>update User Set host = '% ' where user = ' root '; This command can be skipped when executing an error
Mysql>flush privileges;
Mysql>select host, user from user; Check that '% ' is inserted into the database
Mysql>quit
This article turns from https://www.cnblogs.com/renjidong/p/7047396.html
Linux Yum installation MySQL5.6