5.76中加了一些passwd的策略
MySQL's validate_password plugin is installed by default. This will require that passwords contain at least one upper case letter, one lower case letter, one digit, and one special character, and that the total password length is at least 8 characters.
 
修改passwd
 
获取临时password
[root@own ~]# grep 'temporary password' /var/log/mysqld.log
2017-09-19T10:41:04.391873Z 1 [Note] A temporary password is generated for root@localhost: gyqfjhKrB7,o
 
修改passwd policy
 
[root@own ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.19
 
Copyright (c) 2000, 2017, 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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Test@123';
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            | 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.03 sec)
 
mysql> SET GLOBAL  validate_password_policy='LOW';
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            | 8    |
| validate_password_mixed_case_count  | 1    |
| validate_password_number_count      | 1    |
| validate_password_policy            | LOW  |
| validate_password_special_char_count | 1    |
+--------------------------------------+-------+
7 rows in set (0.00 sec)
 
mysql> set GLOBAL validate_password_length=6;
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            | 6    |
| validate_password_mixed_case_count  | 1    |
| validate_password_number_count      | 1    |
| validate_password_policy            | LOW  |
| validate_password_special_char_count | 1    |
+--------------------------------------+-------+
7 rows in set (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=0;
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=0;
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            | 0    |
| validate_password_mixed_case_count  | 0    |
| validate_password_number_count      | 0    |
| validate_password_policy            | LOW  |
| validate_password_special_char_count | 0    |
+--------------------------------------+-------+
7 rows in set (0.00 sec)
 
修改passwd为空
 
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '';
Query OK, 0 rows affected (0.00 sec)
 
mysql>
mysql> quit
Bye
 
验证
[root@own ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.7.19 MySQL Community Server (GPL)
 
Copyright (c) 2000, 2017, 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> quit
Bye
 
[root@own ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.7.19 MySQL Community Server (GPL)
 
Copyright (c) 2000, 2017, 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> quit
Bye
 
on mac 
 

shell> cd /usr/local/mysql

shell> sudo ./bin/mysqld_safe

(ENTER YOUR PASSWORD, IF NECESSARY)

(PRESS CONTROL-Z)

shell> bg

(PRESS CONTROL-D OR ENTER "EXIT" TO EXIT THE SHELL)

You should be able to connect to the MySQL server, for example, by

running `/usr/local/mysql/bin/mysql -uroot'.

最新文章

  1. 分页插件--根据Bootstrap Paginator改写的js插件
  2. Devexress XPO xpPageSelector 使用
  3. php : 基础(6)
  4. <转>iOS9 Day-by-Day:iOS开发者必须了解的iOS 9新技术与API
  5. NYOJ题目96 n-1位数
  6. java 利用spring JavaMailSenderImpl发送邮件,支持普通文本、附件、html、velocity模板
  7. AX 与Citrix打印机问题
  8. 什么是NSTimer
  9. Mac 安装maven3.3.9
  10. linux c socket 案源
  11. 入门者必看!SharePoint之CAML总结(实战)
  12. 13.Django1.11.6文档
  13. CAN总线学习记录之四:位定时与同步
  14. 【转存】阿里云服务器下 LAMP 环境配置 —— 基于 CentOS 6.3
  15. MFC控件编程之鼠标跟键盘消息
  16. elementUI vue upload完整示例
  17. liunx学习笔记(一:常用命令)
  18. ql常见面试题 受用了
  19. WPF DataTomplate中Command无效
  20. Java第一次实验 20145104张家明

热门文章

  1. Memory Analysis环境安装
  2. 织梦万能调用LOOP标签!
  3. eclipse中jsp页面乱码问题
  4. c#自动登录
  5. 解决axios IE11 Promise对象未定义
  6. Codeforces Round #325D (Div. 2) (DP)
  7. bzoj 3830: [Poi2014]Freight【dp】
  8. Android Studio编写运行测试纯java代码可带main()函数
  9. 第四篇(那些JAVA程序BUG中的常见单词)
  10. VS2019 字符串对指针char*赋值编译器报错原因及解决方法