CentOS7使用yum安装MySQL8
- wget http://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm
- sudo yum localinstall mysql80-community-release-el7-2.noarch.rpm
- yum安装MySQL:sudo yum install mysql-community-server
- 启动MySQL服务:systemctl start mysqld
- 检查MySQL服务状态:systemctl status mysqld
- 修改无密码登录:vim /etc/my.cnf 加入skip-grant-tables
- 重启MySQL服务
- 查看当前安全变量值:SHOW VARIABLES LIKE ‘validate_password%’;
- 本地MySQL客户端登录:mysql
- flush privileges
- 修改密码: ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘123456’;
- 其它:
±-------------------------------------±-------+
| Variable_name | Value |
±-------------------------------------±-------+
| validate_password.check_user_name | ON |
| validate_password.dictionary_file | |
| validate_password.length | 6 |
| validate_password.mixed_case_count | 1 |
| validate_password.number_count | 1 |
| validate_password.policy | LOW |
| validate_password.special_char_count | 1 |
| validate_password_check_user_name | ON |
| validate_password_dictionary_file | |
| validate_password_length | 8 |
| validate_password_mixed_case_count | 1 |
| validate_password_number_count | 1 |
| validate_password_policy | MEDIUM |
| validate_password_special_char_count | 1 |
±-------------------------------------±-------+
可在/etc/my.cnf中添加上面的配置,如下图:
Policy | Tests Performed |
---|---|
0 or LOW | Length |
1 or MEDIUM | Length; numeric, lowercase/uppercase, and special characters |
2 or STRONG | Length; numeric, lowercase/uppercase, and special characters; dictionary file |
远程连接问题: authentication plugin caching_sha2_password
修改密码:ALTER USER ‘root’@’%’ IDENTIFIED WITH mysql_native_password BY ‘123456’;