mysql重置密码
2016-11-30 20:06
120 查看
mysql重置密码
wulilideMacBook-Pro:bin wulili$ mysql startERROR 1045 (28000): Access denied for user 'wulili'@'localhost' (using password: NO)wulilideMacBook-Pro:bin wulili$ su - root1、吧mysql服务关闭
2、
启动mysqld_safe ,跳过启动授权表。启动时加上skip-grant-tables参数目的是在启动mysql时不启动grant-tables,授权表。这样就可以修改root的密码了。# mysqld_safe --skip-grant-tables &
wulilideMacBook-Pro:support-files root# find / -name mysqld_safefind: /dev/fd/3: Not a directoryfind: /dev/fd/4: Not a directory/usr/local/mysql-5.7.16-osx10.11-x86_64/bin/mysqld_safewulilideMacBook-Pro:support-files root# /usr/local/mysql-5.7.16-osx10.11-x86_64/bin/mysqld_safe --skip-grant-tables &[1] 1397wulilideMacBook-Pro:support-files root# 2016-11-30T11:47:40.6NZ mysqld_safe Logging to '/usr/local/mysql/data/wulilideMacBook-Pro.local.err'.2016-11-30T11:47:40.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/datamysql -uroot -pEnter password: 按下回车键Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.7.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> update user set password=PASSWORD('12345678') where user="root"; ERROR 1046 (3D000): No database selectedmysql> use mysql;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -A
Database changedmysql> update user set password=PASSWORD('12345678') where user="root"; ERROR 1054 (42S22): Unknown column 'password' in 'field list'mysql> update user set passwd=PASSWORD('12345678') where user="root"; ERROR 1054 (42S22): Unknown column 'passwd' in 'field list'mysql> update user set password=password('12345678') where User='root';ERROR 1054 (42S22): Unknown column 'password' in 'field list'mysql> update user set authentication_string=password('12345678') where user="root";Query OK, 1 row affected, 1 warning (0.01 sec)Rows matched: 1 Changed: 1 Warnings: 1
mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)
mysql> quitBye3、重启数据库
wulilideMacBook-Pro:support-files root# /usr/local/mysql/support-files/mysql.server restartShutting down MySQL..2016-11-30T11:58:22.6NZ mysqld_safe mysqld from pid file /usr/local/mysql/data/wulilideMacBook-Pro.local.pid ended SUCCESS! Starting MySQL. SUCCESS! [1]+ Done /usr/local/mysql-5.7.16-osx10.11-x86_64/bin/mysqld_safe --skip-grant-tableswulilideMacBook-Pro:support-files root# mysql -u root -p 这里密码就是12345678了Enter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 4Server version: 5.7.16
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> quitByewulilideMacBook-Pro:support-files root#
mysql> use mysql;ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.mysql> alter user 'root'@'localhost' identified by '12345678';Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)
mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema || sys |+--------------------+4 rows in set (0.00 sec)
django.db.utils.OperationalError: (1862, 'Your password has expired. To log in you must change it using a client that supports expired passwords.')mysql> SET PASSWORD=PASSWORD('123456');Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)
mysql> quitByewulilideMacBook-Pro:automaticdjango wulili$ /usr/local/mysql/support-files/mysql.server restart
必须要用下面方式python才能够识别到
mysql> SET PASSWORD=PASSWORD('123456');Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)
mysql> quitByewulilideMacBook-Pro:automaticdjango wulili$ /usr/local/mysql/support-files/mysql.server restart
wulilideMacBook-Pro:bin wulili$ mysql startERROR 1045 (28000): Access denied for user 'wulili'@'localhost' (using password: NO)wulilideMacBook-Pro:bin wulili$ su - root1、吧mysql服务关闭
2、
启动mysqld_safe ,跳过启动授权表。启动时加上skip-grant-tables参数目的是在启动mysql时不启动grant-tables,授权表。这样就可以修改root的密码了。# mysqld_safe --skip-grant-tables &
wulilideMacBook-Pro:support-files root# find / -name mysqld_safefind: /dev/fd/3: Not a directoryfind: /dev/fd/4: Not a directory/usr/local/mysql-5.7.16-osx10.11-x86_64/bin/mysqld_safewulilideMacBook-Pro:support-files root# /usr/local/mysql-5.7.16-osx10.11-x86_64/bin/mysqld_safe --skip-grant-tables &[1] 1397wulilideMacBook-Pro:support-files root# 2016-11-30T11:47:40.6NZ mysqld_safe Logging to '/usr/local/mysql/data/wulilideMacBook-Pro.local.err'.2016-11-30T11:47:40.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/datamysql -uroot -pEnter password: 按下回车键Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.7.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> update user set password=PASSWORD('12345678') where user="root"; ERROR 1046 (3D000): No database selectedmysql> use mysql;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -A
Database changedmysql> update user set password=PASSWORD('12345678') where user="root"; ERROR 1054 (42S22): Unknown column 'password' in 'field list'mysql> update user set passwd=PASSWORD('12345678') where user="root"; ERROR 1054 (42S22): Unknown column 'passwd' in 'field list'mysql> update user set password=password('12345678') where User='root';ERROR 1054 (42S22): Unknown column 'password' in 'field list'mysql> update user set authentication_string=password('12345678') where user="root";Query OK, 1 row affected, 1 warning (0.01 sec)Rows matched: 1 Changed: 1 Warnings: 1
mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)
mysql> quitBye3、重启数据库
wulilideMacBook-Pro:support-files root# /usr/local/mysql/support-files/mysql.server restartShutting down MySQL..2016-11-30T11:58:22.6NZ mysqld_safe mysqld from pid file /usr/local/mysql/data/wulilideMacBook-Pro.local.pid ended SUCCESS! Starting MySQL. SUCCESS! [1]+ Done /usr/local/mysql-5.7.16-osx10.11-x86_64/bin/mysqld_safe --skip-grant-tableswulilideMacBook-Pro:support-files root# mysql -u root -p 这里密码就是12345678了Enter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 4Server version: 5.7.16
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> quitByewulilideMacBook-Pro:support-files root#
mysql> use mysql;ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.mysql> alter user 'root'@'localhost' identified by '12345678';Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)
mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema || sys |+--------------------+4 rows in set (0.00 sec)
django.db.utils.OperationalError: (1862, 'Your password has expired. To log in you must change it using a client that supports expired passwords.')mysql> SET PASSWORD=PASSWORD('123456');Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)
mysql> quitByewulilideMacBook-Pro:automaticdjango wulili$ /usr/local/mysql/support-files/mysql.server restart
必须要用下面方式python才能够识别到
mysql> SET PASSWORD=PASSWORD('123456');Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)
mysql> quitByewulilideMacBook-Pro:automaticdjango wulili$ /usr/local/mysql/support-files/mysql.server restart
相关文章推荐
- Centos 6.5 Mysql 5.7.11 密码重置
- mysql重置密码
- 批处理脚本一键重置mysql的root密码
- 设置mysql密码策略,忘记管理员密码重置密码
- 重置mysql密码
- MySQL(root用户)密码忘记重置(Windows/Linux)
- Linux下MySQL5.6.15-忘记root密码-重置
- mysql密码重置
- MySQL密码重置
- centos中mysql重置密码
- MySQL 5.6 数据库服务器重置用户密码总结
- windows平台重置mysql的root账户密码
- mysql 重置root密码
- mysql忘记密码重置(mac)
- mysql 的root密码忘了的重置方法
- Mysql 忘记密码,重置密码
- Windows/Linux MySQL忘记密码重置密码教程
- MySQL 5.7忘记密码如何重置
- mysql重置密码出现的一系列问题
- mysql忘记密码,如何重置密码