Mysql5.7如何修改root密码
作者:hebedich 时间:2024-01-26 21:22:28
版本更新,原来user里的password字段已经变更为authentication_string
版本更新 缘故,好多网上的教程都不适用了,甚至连官网的文档也不是能够顺利操作的。
如果 MySQL 正在运行,首先杀之:
killall -TERM mysqld。
运行
mysqld_safe --skip-grant-tables &
如果此时不想被远程连接:
mysqld_safe --skip-grant-tables --skip-networking &
使用mysql连接server
更改密码:
update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';
*特别提醒注意的一点是,新版的mysql数据库下的user表中已经没有Password字段了
而是将加密后的用户密码存储于authentication_string字段
mysql> flush privileges;
mysql> quit;
修改完毕。重启
killall -TERM mysqld。
mysqld_safe &
然后mysql就可以连接了
但是此时操作似乎功能不完全,还要alter user...
alter user 'root'@'localhost' identified by '123';
网文说酱紫也可以:
set password for 'root'@'localhost'=password('123');
cp mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig --add mysql
标签:Mysql5.7,修改root密码
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
2020版Python学习路线图(附学习资料)
2021-01-11 09:33:52
![](https://img.aspxhome.com/file/2023/1/130681_0s.png)
JS版图片放大镜效果
2024-04-30 08:50:57
![](https://img.aspxhome.com/file/2023/1/132661_0s.jpg)
MySQL语句优化的原则
2009-10-27 12:09:00
Python生成随机验证码的两种方法
2022-06-27 02:39:56
PHP数据库表操作的封装类及用法实例详解
2023-11-12 07:41:23
vue.js刷新当前页面的实例讲解
2023-04-03 07:39:27
基于Python实现2种反转链表方法代码实例
2021-11-27 21:19:02
![](https://img.aspxhome.com/file/2023/3/80783_0s.jpg)
Python操作数据库之数据库编程接口
2024-01-25 01:55:41
![](https://img.aspxhome.com/file/2023/3/117963_0s.png)
mysql查询表是否被锁的方法
2024-01-19 13:16:41
Pytorch自定义Dataset和DataLoader去除不存在和空数据的操作
2022-05-06 14:26:39
sqlserver中去除字符串中连续的分隔符的sql语句
2012-06-06 20:07:39
MySQL基础之MySQL 5.7 新增配置
2024-01-15 08:19:02
python使用ctypes库调用DLL动态链接库
2023-12-08 14:14:05
![](https://img.aspxhome.com/file/2023/7/95677_0s.png)
javascript函数作用域学习示例(js作用域)
2024-04-17 10:10:29
Windows系统配置python脚本开机启动的3种方法分享
2022-02-27 22:09:24
![](https://img.aspxhome.com/file/2023/5/103775_0s.png)
带你深入了解Access数据库的4种安全方式
2008-11-28 14:34:00
跨浏览器让javascript文件携带图片数据
2011-03-31 17:12:00
mysql 8.0.22压缩包完整安装与配置教程图解(亲测安装有效)
2024-01-25 05:26:14
![](https://img.aspxhome.com/file/2023/7/112897_0s.png)
python tkinter基本属性详解
2021-11-22 06:18:35
![](https://img.aspxhome.com/file/2023/2/93702_0s.png)
下载 Firefox 3 中文版/英文版
2008-06-19 13:27:00
![](https://img.aspxhome.com/file/UploadPic/20086/19/2008619133121666s.jpg)