1. Uninstall the default installation of mariadb:
yum search mysql
yum remove mariadb.x86_64
2. Go to the official website to find the download version of mysql
https://dev.mysql.com/downloads/repo/yum/
Find the following Linux7, CentOS7 (CentOS is owned by Red Hat)
Right-click on the link below to copy the link directly (or you can download it locally and then use ftp to upload it to the server)
3. installation
Installation: wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
Note: It is recommended to proceed in the /tmp directory
4. Install yum source locally
yum localinstall mysql
5. Check if it has been installed
yum search mysql
Find the corresponding software package, copy the name
6. Install with yum
yum install mysql-community-server.x86_64
7. Check if the installation is successful
ps -ef | grep mysql
8. Start mysql
service mysqld start
service mysqld restart
service mysqld stop
9. Find the default login password
cat /var/log/mysqld.log | grep password
10. log in
mysql -uroot -p password
Note: It is recommended to use mysql -uroot-p and press Enter before entering the password. Because using the history command will see your password in plain text
11. change Password
SET PASSWORD =PASSWORD(' xxxx ');
12. Open remote connection permission
use mysql;
show tables;
select *from user \G
select host, user from user \G
Note: \G will format the display
update user set host="%" where Host='localhost' and user ="root";
Update permissions
flush privileges;
Or restart the service directly: service mysqld restart
Recommended Posts