随着MySQL 5.6 的GA, MySQL在一些细节上越来越美。 今天来体验下两个安全验证方面的细节提升。 1. mysql_config_edit 工具。 可以用来加密用户的密码,增强数据库安全。
使用方法:- t@ytt-centos6-3 ~]$ mysql_config_editor set --login-path=itsmine --host=localhost --user=ytt --password
- Enter password:
- [ytt@ytt-centos6-3 ~]$ mysql --login-path=itsmine -S /tmp/mysql3307.sock
- Welcome to the MySQL monitor. Commands end with ; or \g.
- ...
- mysql> select user();
- +---------------+
- | user() |
- +---------------+
- | ytt@localhost |
- +---------------+
- 1 row in set (0.00 sec)
-
- mysql> exit
- Bye
复制代码 mysql_config_edit 加密后的数据保存在用户主目录下:- [ytt@ytt-centos6-3 ~]$ file .mylogin.cnf
- .mylogin.cnf: data
复制代码 2. 密码强度验证插件
查看是否安装有此插件- mysql> show plugins;
- +----------------------------+----------+--------------------+----------------------+-------------+
- | Name | Status | Type | Library | License |
- +----------------------------+----------+--------------------+----------------------+-------------+
- | binlog | ACTIVE | STORAGE ENGINE | NULL | PROPRIETARY |
- ...
- | validate_password | ACTIVE | VALIDATE PASSWORD | validate_password.so | PROPRIETARY |
- +----------------------------+----------+--------------------+----------------------+-------------+
- 45 rows in set (0.00 sec)
-
- mysql>
复制代码 现在来设置新的密码:- mysql> set password for ytt_new@'localhost'= password('2lOp23dll&D');
- Query OK, 0 rows affected (0.00 sec)
-
- mysql> flush privileges;
- Query OK, 0 rows affected (0.00 sec)
-
- mysql>
复制代码 |