Objective
1. mysql Installation
CentOS 7 's Yum source does not appear to be properly installed when MySQL mysql-sever file, need to go to the official web download
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# RPM-IVH mysql-community-release-el7-5.noarch.rpm
# yum Install Mysql-community-server
After successful installation, restart the MySQL service # service mysqld restart or systemctl start msyqld
2, the initial installation of MySQL is the root account is no password
5.7 and above randomly generate a temporary password
5.7 or less has just been installed as empty
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/17/af57603a5c342c1b425da6398e2a72b1.png-wh_500x0-wm_3 -wmp_4-s_3821743367.png "title=" 2017-11-17_161529.png "alt=" Af57603a5c342c1b425da6398e2a72b1.png-wh_ "/>
Change Password!!!
1. Set statement
Log in to the root table
Set Password=password ("NewPassword")
2, mysqladmin command modification
1. For example, your root user does not now have a password and you want the password to be changed to 123456, then the command is:
Mysqladmin-u Root Password 123456
2. If your root now has a password (123456), then the command to change the password to ABCdef is:
Mysqladmin-u root-p Password abcdef
Watch out! Command return will ask you the old password, enter the old password 123456 after the command is completed, the password modified successfully.
3. Change the password
mysql> use MySQL;
mysql> Update user set Password=password (' 123 ') where user= ' root ' and host= ' localhost ';
mysql> flush Privileges;
4. Forget root password
1.vi/etc/my.cnf
2. Add Skip-grant-tables in [mysqld]
5.7 +: update user set Authentication_string=password (' 123456 ') where user= ' root ';
5.7 below:update user set Password=passwrod ("123456") where host= "localhost" and
User= "Root";
Flush privileges; Refresh Permissions
5. Setting up a remote connection
1. Set Iptables
2. Set Database account permissions
Main view MySQL user table host column (see Permission control article)
The host column is the specified login IP, such as User=root host=192.168.1.1, which means that the root user can only access through 192.168.1.1 client, and% is a wildcard, if host=192.168.1.%, Then it means that as long as the IP is host=192.168.1. prefix client can be connected, then host=% said that all IP is authorized to connect, which is why when the remote connection is opened, most people directly changed the host to% because of the convenience.
This article from "Li Shilong" blog, declined reprint!
Centos7 Yum install MySQL