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'.

mysql 修改 root 密码的更多相关文章

  1. mysql修改root密码和对连接授权

    mysql修改root密码 首先 mysql -uroot -p 进入mysql界面后执行 set password for root@localhost = password('111111');  ...

  2. mysql修改root密码百分百解决你的问题

    原文:mysql修改root密码百分百解决你的问题 1.MySQL版本8.0.4之后修改密码 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_n ...

  3. mysql修改root密码和设置权限

    整理了以下四种在MySQL中修改root密码的方法,可能对大家有所帮助! 方法1: 用SET PASSWORD命令 mysql -u root mysql> SET PASSWORD FOR ' ...

  4. MySQL 修改 root 密码命令

    安装好 MySQL 并成功启动 MySQL 服务后,可以通过以下方法修改root密码: ①用 mysqladmin.exe 操作.指令如下: cd C:\Program Files\MySQL Ser ...

  5. MySql修改root密码以及允许外网访问

    1.修改root密码 用SET PASSWORD命令 mysql -u root mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('n ...

  6. MySQL修改root密码的各种方法整理(转)

    整理了以下四种在MySQL中修改root密码的方法,可能对大家有所帮助! 方法1: 用SET PASSWORD命令 mysql -u root mysql> SET PASSWORD FOR ' ...

  7. 各版本mysql修改root密码

    今天在安装mysql5.7.8的时候遇到一些问题,首当其冲便的是初始root密码的变更,特分享解决方法如下: 1.mysql5.7会生成一个初始化密码,而在之前的版本首次登陆不需要登录. shell& ...

  8. mysql修改root密码和设置权限 转摘:http://www.cnblogs.com/wangs/p/3346767.html

    整理了以下四种在MySQL中修改root密码的方法,可能对大家有所帮助! 方法1: 用SET PASSWORD命令 mysql -u root mysql> SET PASSWORD FOR ' ...

  9. windows 8.0 mysql 修改root 密码

    Mysql 忘记root密码和修改root密码的解决方法(小结) 一.以下是Windows操作系统的操作步骤: 1. 关闭正在运行的MySQL服务-->net stop mysql 2. 打开D ...

  10. Mysql修改root密码

    一.启动命令行,输入: taskkill /f /im mysqld.exe //关闭mysql 二.转入mysql的bin目录下 三.输入:mysqld --skip-grant-tables // ...

随机推荐

  1. Android Client and PHP Server

    1 FEApplication https://github.com/eltld/FEApplication https://github.com/eltld/FE-web https://githu ...

  2. java重载中的基本类型的自动类型转换

    当传递到函数的参数的数据类型表示的范围小于函数形参的参数类型遵循如下原则 : char类型比较特殊, 直接转换为int:  char ->int ->long->float-> ...

  3. sharpdevelop 调整代码字体显示大小

    SharpDevelop中使用ctrl+鼠标滚轮可以调整代码的字体显示大小

  4. SSH无密码验证可能出现的问题

    雪影工作室版权所有,转载请注明[http://blog.csdn.net/lina791211] 一.安装和启动SSH协议 假设没有安装ssh和rsync,可以通过下面命令进行安装. sudo apt ...

  5. C项目实践--图书管理系统(2)

    前面在<<C项目实践-图书管理系统(1)>>中把系统中的三大功能模块中可能涉及到的常量,结构体及相关函数进行了声明定义,下来就来实现它们. 执行系统首先从登录到系统开始,所以首 ...

  6. 网络编程-获取ip-解析ip

    import java.net.InetAddress; import java.net.UnknownHostException; /** * 查询ip地址 * * @author chengluc ...

  7. 一.C语言:关键字、标识符和注释

      一.关键字 C语言提供的有特殊含义的符号,共32个. 在Xcode中关键字全部高亮显示,关键字全部都为小写.如return.int等. 二.标识符 定义:标识符是程序员在程序中自定义的一些符号和名 ...

  8. Tomcat 在Mac OS X中的安装和配置

    简单介绍: 1.Tomcat是目前比较流行的Web应用服务器,它是一个轻量级的应用服务器,在中小型系统和并发访问用户不是很多的场合下被普遍使用,是开发和调试JSP程序的首选. 2.Tomcat运行时所 ...

  9. JSP+MySQL实例

    转自:https://www.yiibai.com/jsp/jsp_mysql.html 在本章中,我们将讨论如何使用JSP访问数据库(这里以MySQL数据库为例).并假设您对JDBC应用程序的工作方 ...

  10. Pascal学生管理

    program Project2; {$APPTYPE CONSOLE} uses SysUtils; ;M=; type date=record day:..; month:..; year:..; ...