Linux/Windows下修改Mysql的用户(root)的密码
来源:互联网 发布:大脑是如何思考的知乎 编辑:程序博客网 时间:2024/05/20 23:04
一、说明
1、查看mysql版本
方法一(终端状态,未登录mysql)
#mysql -V
方法二(登录mysql状态)
mysql>select version();
2、mysql5.7版本后mysql.user表的password字段更改为authentication_string字段,即update语句中authentication_string=password("test123"),但"="号后面password不变。
例如:#update user set password=password("test123") where user='root'; 改成#update user set authentication_string=password("test123") where user='root';
3、忘记密码时Linux和Windows下修改方法不太一样
4、修改密码后记得flush privileges刷新权限。
二、实现
1、知道密码
方法一:终端状态
#mysqladmin -uroot -p password root
Enter password:
mysql>update mysql.user set password = password('root') where user = 'root';
mysql>flush privileges;2、忘记密码
Windows
#net stop mysql
#cd C:\Program Files\MySQL\MySQL Server 5.5\bin
#mysqld -nt --skip-grant-tables提示
171222 17:35:42 [Warning] option 'new': boolean value 't' wasn't recognized. Set to OFF.
171222 17:35:42 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
171222 17:35:42 [Note] mysqld (mysqld 5.5.54) starting as process 75604 ...
则,关闭当前cmd窗口,Ctrl+R重新打开cmd
直接
#mysql
mysql>update user set password=password("test123") WHERE user='root';
mysql>flush privileges;
#net start mysqlLinux
#service mysql stop
#mysqld_safe --skip-grant-tables &
#mysql
mysql>
mysql> use mysql;
mysql> update mysql.user set password=password("test123") where user='root';
mysql> flush privileges;
mysql> exit;三、问题(可忽略)
Enter password:
提示Warning: single quotes were not trimmed line client, as you might have expected.
则参考博文:http://blog.csdn.net/justinqin/article/details/78875977
2、Windows/Linux跳过安全检查#mysqld_safe --skip-grant-tables &
提示mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists
参考博文:http://blog.csdn.net/z_yttt/article/details/73650495
1、查看mysql版本
方法一(终端状态,未登录mysql)
#mysql -V
方法二(登录mysql状态)
mysql>select version();
2、mysql5.7版本后mysql.user表的password字段更改为authentication_string字段,即update语句中authentication_string=password("test123"),但"="号后面password不变。
例如:#update user set password=password("test123") where user='root'; 改成#update user set authentication_string=password("test123") where user='root';
3、忘记密码时Linux和Windows下修改方法不太一样
4、修改密码后记得flush privileges刷新权限。
二、实现
1、知道密码
方法一:终端状态
#mysqladmin -uroot -p password root
Enter password:
方法二:登录状态mysql>
mysql>use mysql;mysql>update mysql.user set password = password('root') where user = 'root';
mysql>flush privileges;2、忘记密码
Windows
#net stop mysql
#cd C:\Program Files\MySQL\MySQL Server 5.5\bin
#mysqld -nt --skip-grant-tables提示
171222 17:35:42 [Warning] option 'new': boolean value 't' wasn't recognized. Set to OFF.
171222 17:35:42 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
171222 17:35:42 [Note] mysqld (mysqld 5.5.54) starting as process 75604 ...
则,关闭当前cmd窗口,Ctrl+R重新打开cmd
直接
#mysql
mysql>update user set password=password("test123") WHERE user='root';
mysql>flush privileges;
#net start mysqlLinux
#service mysql stop
#mysqld_safe --skip-grant-tables &
#mysql
mysql>
mysql> use mysql;
mysql> update mysql.user set password=password("test123") where user='root';
mysql> flush privileges;
mysql> exit;三、问题(可忽略)
1、若Windows下执行命令
#mysqladmin -uroot -p password 'root'Enter password:
提示Warning: single quotes were not trimmed line client, as you might have expected.
则参考博文:http://blog.csdn.net/justinqin/article/details/78875977
2、Windows/Linux跳过安全检查#mysqld_safe --skip-grant-tables &
提示mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists
参考博文:http://blog.csdn.net/z_yttt/article/details/73650495
阅读全文
1 0
- Linux/Windows下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Linux下修改Mysql的用户(root)的密码
- Android填坑之旅(第二十二篇)使用友盟社会化分享的碰到的坑
- ABB多机器人坐标系之间的关系
- 17年 12月22日学习计划
- 编译与链接(一)——编译
- 如果ABBYY FineReader 14识别某些字符失败
- Linux/Windows下修改Mysql的用户(root)的密码
- suspendlayout,resumelayout,layout,performlayout【转】
- 线程
- mysql 正则
- HashMap原理讲解(一)
- mark 使用commons-pool实现自定义资源池
- unity求两点间的 单位向量 及 距离
- 自动发邮件脚本
- Android粒子破碎效果(2)——实现多种破碎效果之ParticleSmasher