下载
https://dev.mysql.com/downloads/
[root@vanhrcloud ~]# cd /home/
[root@vanhrcloud home]# ls
mysql80-community-release-el7-3.noarch.rpm
[root@vanhrcloud home]# rpm -ivh mysql80-community-release-el7-3.noarch.rpm
[root@vanhrcloud home]# yum install -y mysql mysql-server --nogpgcheck
[root@vanhrcloud home]# vi /etc/my.cnf
// 加入最下面
lower_case_table_names=1
[root@vanhrcloud home]# systemctl restart mysqld
// 查看初始密码
[root@vanhrcloud home]# grep password /var/log/mysqld.log
2021-03-15T12:36:57.795728Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: u&<*;aXho4e.
[root@vanhrcloud home]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.23
mysql> set global validate_password.check_user_name=0;
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password.policy=0;
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password.length=1;
Query OK, 0 rows affected (0.00 sec)
mysql> alter user 'root'@'localhost' identified by 'root';
Query OK, 0 rows affected (0.01 sec)
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set host = '%' where user = 'root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)