CentOS7 install MySQL5.7 using yum
-
Download and install the official Yum Repository for MySQL
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm yum localinstall mysql57-community-release-el7-8.noarch.rpm -y yum install mysql-community-server mysql -y Copy the code
-
Initialize and configure MySql
-
Start: systemctl start mysqld
-
Check the status: systemctl status mysqld
-
To view the initial password:
grep "password" /var/log/mysqld.log
-
Mysql -uroot -p mysql -uroot -p
-
After these two Settings, the password is very simple and will not report errors
set global validate_password_policy=0; set global validate_password_length=1; Copy the code
-
ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘123456’;
-
Grant all PRIVILEGES on *.* to ‘root’@’%’ identified by ‘123456’ with grant option;
-
Refresh privileges: Flush PRIVILEGES;
-
Change the default character set to vi /etc/my.cnf
[mysqld] default-storage-engine=INNODB character-set-server = utf8mb4 collation-server = utf8mb4_general_ci [client] default-character-set=utf8mb4 [mysql] default-character-set=utf8mb4 Copy the code
-
Run the systemctl restart mysqld command to restart mysql
-
Start system: systemctl enable mysqld
-
Mysql57-community-release-el7-8.noarch: yum -y remove mysql57-community-release-el7-8.noarch: yum -y remove mysql57-community-release-el7-8.noarch
-