centos mysql忘记密码怎么办 重启mysql服务

发布时间:2021-11-30 15:11:21
编辑:
来源:php中文网
字体:

本文操作环境:centOS6.8系统、mysql5.5、Dell G3。

centos mysql 怎么忘记密码?

centos系统mysql忘记密码

安装 mysql 之后,注意添加软连接

mysql 忘记密码操作,

1

vim /etc/my.cnf

在 [mysqld] 的段中加上一句:

1

skip-grant-tables

重启 mysql 服务, service mysql restart

在输入 mysql -u root -p 输入回车即可进入 mysql 数据库

1

use mysql;

低版本修改:

1

update user set Password = password('LDtianzhe.') where user = 'root';

高版本修改:

1

update user set authentication_string=password('new password') where user = 'root';

再次vim /etc/my.cnf 注释掉 上面添加的重启服务即可再次进入数据库

如果出现此错误:

1

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忘记密码怎么办 重启mysql服务

>更多相关文章
    无相关信息
www.xcctv.cn 中国项目城网 - 关于我们 - 联系方式 - 版权声明 - 招聘信息 - 友链交换 - 网站统计
Copyright© 2014-2017 中国项目城网(www.xcctv.cn) All rights reserved.
沪ICP备2020036824号-1 未经过本站允许,请勿将本站内容传播或复制.
联系我们:562 66 29@qq.com