1. Download the MySQL repo source
$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2. Install the MYSQL-COMMUNITY-RELEASE-EL7-5.NOARCH.RPM package
$ sudo rpm-ivh mysql-community-release-el7-5.noarch.rpm after installing this package, 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, there is no password and you need to reset the password.
4. Reset Password
Before resetting your password, you must first log in
$ mysql-u Root login may have reported such an error: Error 2002 (HY000): Can ' t connect to local MySQL server through socket '/var/lib/mysql/mysql.so CK ' (2) because of a/var/lib/mysql access problem. 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: $ service mysqld Restart next Login Reset Password: $ mysql-u rootmysql > Use mysql;mysql > Update user set Password=password (' 123456 ') where user= ' ro OT '; MySQL > exit;
5. Open 3306 Ports
$ sudo vim/etc/sysconfig/iptables Add the following:-a input-p tcp-m state--state new-m TCP--dport 3306-j accept save after reboot firewall: $ sudo Service Iptables Restart
This allows the MySQL service to be connected from other clients as well.
Install MySQL on CENTOS7 using the official Yum source