centos mysql 忘记密码怎么办
时间:2021-12-14 来源:互联网
今天PHP爱好者为您带来centos mysql忘记密码的解决办法:1、在[mysqld]的段中加上一句“skip-grant-tables”;2、重启mysql服务;3、输入“mysql -u root -p”;4、通过update修改密码即可。希望对大家有所帮助。
本文操作环境:centOS6.8系统、mysql5.5、Dell G3。
centos mysql 怎么忘记密码?
centos系统mysql忘记密码
安装 mysql 之后,注意添加软连接
mysql 忘记密码操作,
vim /etc/my.cnf
在 [mysqld] 的段中加上一句:
skip-grant-tables
重启 mysql 服务, service mysql restart
在输入 mysql -u root -p 输入回车即可进入 mysql 数据库
use mysql;
低版本修改:
update user set Password = password('LDtianzhe.') where user = 'root';
高版本修改:
update user set authentication_string=password('new password') where user = 'root';
再次vim /etc/my.cnf 注释掉 上面添加的重启服务即可再次进入数据库
如果出现此错误:
ERROR 1175 (HY000): You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
需要关闭保护模式
再次使用更新密码即可
退出,注释掉 skip-grant-tables
重启服务即可
以上就是centos mysql 忘记密码怎么办的详细内容,更多请关注php爱好者其它相关文章!
-
燕云每周开心法箱子-怎么开金色心法 2025-04-23
-
这就是江湖棍法三逆转版本太极阁-探索太极阁棍法技巧与策略 2025-04-23
-
deb文件怎么安装 deb包损坏的解决方法 2025-04-23
-
想不想修真分神丹材料有哪些-修真分神丹所需材料清单 2025-04-23
-
绝区零莱特用什么驱动盘好-莱特驱动盘套装推荐 2025-04-23
-
shell脚本语法详解 2025-04-23