1. 下载rpm包
[root@VM_0_5_centos home]# wget http://repo.MysqL.com//MysqL57-community-release-el7-9.noarch.rpm
2. 下载安装软件源
[root@VM_0_5_centos home]# yum localinstall MysqL57-community-release-el7-9.noarch.rpm
3. 查看系统是否添加该源
[root@VM_0_5_centos home]# yum repolist all | grep MysqL
4. 安装MysqL
[root@VM_0_5_centos home]# yum install MysqL-community-server.x86_64
5. 启动MysqL Server
#启动MysqL [root@VM_0_5_centos home]# systemctl start MysqLd #查看启动状态 [root@VM_0_5_centos home]# systemctl status MysqLd
[root@VM_0_5_centos home]# grep 'temporary password' /var/log/MysqLd.log
[root@VM_0_5_centos home]# MysqL_secure_installation
密码要求:
特殊字符
大小写字母
数字
长度8位
实例密码:Fangchy1120.!
[root@VM_0_5_centos home]# MysqL -uroot -p
原来MysqL5.6.6版本之后增加了密码强度验证插件validate_password,相关参数设置的较为严格。 使用了该插件会检查设置的密码是否符合当前设置的强度规则,若不满足则拒绝设置。影响的语句和函数有:create user,grant,set password,password(),old password。
-
查看MysqL全局参数
MysqL> SHOW VARIABLES LIKE 'validate_password%'; +--------------------------------------+--------+ | Variable_name | Value | +--------------------------------------+--------+ | validate_password_check_user_name | OFF | | 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 | +--------------------------------------+--------+ 7 rows in set (0.00 sec)
-
参数解释
-
validate_password_dictionary_file
-
validate_password_length
密码最小长度,参数默认为8,它有最小值的限制,最小值为:validate_password_number_count + validate_password_special_char_count + (2 * validate_password_mixed_case_count)
-
validate_password_mixed_case_count
密码至少要包含的小写字母个数和大写字母个数。
-
validate_password_number_count
密码至少要包含的数字个数。
-
validate_password_policy
密码强度检查等级,0/LOW、1/MEDIUM、2/STRONG。有以下取值:
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 默认是1,即MEDIUM,所以刚开始设置的密码必须符合长度,且必须含有数字,小写或大写字母,特殊字符。
-
validate_password_special_char_count
密码至少要包含的特殊字符数。
-
-
修改上面的各项参数,全部执行成功
MysqL> set global validate_password_policy=0; Query OK, 0 rows affected (0.00 sec) MysqL> set global validate_password_mixed_case_count=0; Query OK, 0 rows affected (0.00 sec) MysqL> set global validate_password_number_count=3; Query OK, 0 rows affected (0.00 sec) MysqL> set global validate_password_special_char_count=0; Query OK, 0 rows affected (0.00 sec) MysqL> set global validate_password_length=3; Query OK, 0 rows affected (0.00 sec)
-
查看修改后的参数
MysqL> show variables like 'validate_password%'; +--------------------------------------+-------+ | Variable_name | Value | +--------------------------------------+-------+ | validate_password_check_user_name | OFF | | validate_password_dictionary_file | | | validate_password_length | 3 | | validate_password_mixed_case_count | 0 | | validate_password_number_count | 3 | | validate_password_policy | LOW | | validate_password_special_char_count | 0 | +--------------------------------------+-------+ 7 rows in set (0.00 sec)
-
修改成简单密码
MysqL> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123'); Query OK, 0 rows affected, 1 warning (0.00 sec)
-
使用新密码登录
[root@VM_0_5_centos ~]# MysqL -uroot -p Enter password: Welcome to the MysqL monitor. Commands end with ; or \g. Your MysqL connection id is 16 Server version: 5.7.24 MysqL Community Server (GPL) copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered Trademark of Oracle Corporation and/or its affiliates. Other names may be Trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
-
配置远程连接(腾讯云不需要配置端口)
#查看MysqL端口 [root@VM_0_5_centos ~]# netstat -ntlp|grep 3306 tcp6 0 0 :::3306 :::* LISTEN 13929/MysqLd
#配置远程连接,赋予任何主机上以root身份访问数据的权限 MysqL> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; Query OK, 0 rows affected, 1 warning (0.00 sec) MysqL> flush privileges; Query OK, 0 rows affected (0.00 sec)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。