In the previous share of this article: CentOS 7.0 under the use of Yum installation of MySQL method, small set feel not detailed, today to everyone through this article to make a supplement, interested friends can refer to.
1. Download the MySQL repo source
$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2. Install MYSQL-COMMUNITY-RELEASE-EL7-5.NOARCH.RPM Package
$ sudo rpm-ivh mysql-community-release-el7-5.noarch.rpm
After installing this package, you will get two MySQL yum repo Source:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo.
3. Install MySQL
$ sudo yum install Mysql-server
Follow the steps to install it, but after the installation is complete, no password, you need to reset the password.
4. Reset Password
To first log in before resetting your password
It is possible to report this error when logging in: Error 2002 (HY000): Can ' t connect to the local MySQL server through socket '/var/lib/mysql/mysql.sock ' (2), because/var /lib/mysql access rights issue. The following command changes the owner of the/var/lib/mysql to the current user:
$ sudo chown-r openscanner:openscanner/var/lib/mysql
Then, restart the service:
5. Firewall settings, open 3306 ports
Firewall-cmd--permanent--zone=public--add-port=3306/tcp firewall-cmd--permanent--zone=public--add-port=
3306/UDP
Firewall-cmd--reload
6. mysql Security settings
Mysql_secure_installation;
MySQL prompts you to reset the root password, remove other user accounts, disable root telnet, remove test database, Reload privilege form, and so on.
7. Create a remote access user
--implementation of the Environment users
CREATE user ' dbuser ' @ '% ' identified by ' 123456 ';
GRANT select,insert,update,delete on *.* to ' dbuser ' @ '% ';
--Admin users
CREATE user ' admin ' @ '% ' identified by ' 123456 ';
CREATE USER ' admin ' @ '% ' identified by ' 123456 ';
GRANT all on *.* to ' admin ' @ '% ';
Flush privileges;
8. Change data storage Directory
Mkdir/home/data
--Close the MySQL service process
systemctl status mysqld
mv/var/lib/mysql/home/data
modifying/etc/my.cnf files
Datadir=/home/data/mysql
socket=/home/data/mysql/mysql.sock
socket=/home/data/mysql/mysql.sock
The above is a small set to introduce the CENTOS7 under the use of Yum installation MySQL database detailed tutorials, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!