Since MySQL was acquired by Oracle, the database built into the CentOS default Yum library changed from MySQL to MARIADB.
In order to install MySQL, we need to add the official MySQL repo to the CentOS repo.
Visit->mysql's official repo list
Find link Address: http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
On the CentOS command line, run
sudo rpm-ivh http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
Add it to the Yum library.
Run
sudo yum install Mysql-server
Install MySQL
Run
sudo systemctl start mysqld
Start MySQL. Replace the start of the above command with Stop,restart,status, which corresponds to the original MySQL service command.
-------------------------
[[email protected] mysql]# mysql-u root MySQL
mysql> use MySQL;
mysql> desc User;
Mysql> GRANT All privileges on * * to [email protected]'% ' identified by ' root '; The ability to add remote connections for root
mysql> Update user Set Password = Password (' 123123 ') where user= ' root '; Set the root user password
Mysql> Select Host,user,password from User where user= ' root ';
mysql> flush Privileges;
Mysql> exit
Re-Login
[Email protected] mysql]# mysql-u root-p
Enter password:123123
If you are not able to connect remotely, turn off the firewall
[[Email protected]]# systemctl Stop Firewalld.service
CentOS 7 Installation MySQL