Detailed explanation of the command for installing mysql5.7 database under centos7.2
- 2021-12-11 09:24:39
- OfStack
The mysql on the server has a version 8.0. 12 installed, the local version is a version 5.7. Today, the reinstalled version 5.7 has been deleted. Here are all the names. Follow the command and it will be installed.
Configuration source
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
yum localinstall mysql57-community-release-el7-8.noarch.rpm
# yum repolist enabled | grep "mysql.*-community.*"
Installation:
yum install mysql-community-server
Start mysql
systemctl start mysqld
Startup and self-startup
systemctl enable mysqld
systemctl daemon-reload
Get the initial password
grep 'temporary password' /var/log/mysqld.log
UjmO#ZA9nt,Y
Modify root password (login to mysql is required)
mysql -u root -p
set global validate_password_policy=0;
set global validate_password_length=1;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'admin';
Authorize other accounts to log in remotely
CREATE USER 'admin'@'%' IDENTIFIED BY 'admin';
GRANT ALL ON *.* TO 'admin'@'%';
flush privileges
Summarize