mysql多实例修改忘记的root密码
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了mysql多实例修改忘记的root密码,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2702字,纯文字阅读大概需要4分钟。
内容图文
![mysql多实例修改忘记的root密码](/upload/InfoBanner/zyjiaocheng/472/58051ae6dd5b428bbf8b9d4d47bd0269.jpg)
一、操作思路:
1)停止mysql服务
2)启动时添加“--skip-grant-tables”参数
3)修改密码
4)重启mysql服务
二、执行过程
# netstat -tunlp | grep 330* tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 13157/mysqld tcp 0 0 0.0.0.0:3307 0.0.0.0:* LISTEN 13874/mysqld tcp 0 0 0.0.0.0:3308 0.0.0.0:* LISTEN 12388/mysqld # 这里假设忘记的是3308实例的root密码 # 先安全关闭另外两个实例 # /data/3306/mysql stop # /data/3307/mysql stop # killall mysqld # mysqld_safe --defaults-file=/data/3308/my.cnf --skip-grant-tables & [2] 10883 # 161011 22:05:47 mysqld_safe Logging to ‘/data/3308/mysql_oldboy3308.err‘. 161011 22:05:48 mysqld_safe Starting mysqld daemon with databases from /data/3308/data # mysql -uroot -p -S /data/3308/mysql.sock Enter password: (这里直接回车就进去了) Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.5.32-log Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. mysql> update mysql.user set password=password("redhat123456") where user=‘root‘; Query OK, 4 rows affected (0.00 sec) Rows matched: 4 Changed: 4 Warnings: 0 # 更新root账号的密码 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) # 刷新权限 # netstat -tunlp | grep mysql tcp 0 0 0.0.0.0:3308 0.0.0.0:* LISTEN 11620/mysqld [1]+ Done mysqld_safe --default-file=/data/3308/my.cnf --skip-grant-tables --user=mysql # pkill mysql # netstat -tunlp | grep mysql # /data/3308/mysql start Starting MySQL... # echo $? 0
三、验证
# mysql -uroot -predhat123456 -S /data/3308/mysql.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.5.32-log Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. mysql>
本文出自 “冰冻vs西瓜” 博客,请务必保留此出处http://molewan.blog.51cto.com/287340/1861096
mysql多实例修改忘记的root密码
标签:mysql多实例 忘记密码
本文系统来源:http://molewan.blog.51cto.com/287340/1861096
内容总结
以上是互联网集市为您收集整理的mysql多实例修改忘记的root密码全部内容,希望文章能够帮你解决mysql多实例修改忘记的root密码所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。