分享

MySQL root密码忘记怎么办?

 python学习 2018-06-22

MySQL单实例

1. 跳过授权表登录

mysqld_safe --skip-grant-table --user=mysql &

2. 更改密码

mysql> update mysql.user set password=password('123456') where user='root' and host='localhost';

MySQL多实例

1. 跳过授权表登录 登录指定多实例的socket的文件

mysqld_safe --defaults-file=/data/3306/my.cnf --skip-grant-table --user=mysql &

mysql -S /data/3306/mysql.sock 登录数据库

2. 更改密码

mysql> update mysql.user set password=password('123456') where user='root' and host='localhost';

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多