Home  >  Article  >  Database  >  MySQL忘记root密码怎么办_MySQL

MySQL忘记root密码怎么办_MySQL

WBOY
WBOYOriginal
2016-06-01 13:42:35886browse

bitsCN.com
MySQL如果忘记了root密码,可以很方便的找回,方法如下:1.     先杀掉MySQL的所有进程;#killall -TERM mysqld 2.    使用skip-grant-tables这个选项启动MySQL;#/user/bin/safe_mysqld --skip-grant-tables & 3.  这时你就可以不使用密码登陆MySQL了;#mysql -h localhost -u root -pmysql> use mysqlmysql> update user set password=password('newpassword') where user='root'; mysql> flush privileges;mysql> exit;  4.    关闭MySQL; #/user/bin/mysqladmin -u root -p shutdownEnter password:    STOPPING server from pid file /usr/local/mysql/data/ws01.pid071218 11:30:19  mysqld ended [1]+  Done                    /usr/local/mysql/bin/safe_mysqld --skip-grant-tables  (wd: /ceno/product/cacti/include)(wd now: /usr/local/mysql/bin) 5.    正常启动MySQL; #/user/bin/mysqld_safe --user=mysql & [1] 5583Starting mysqld daemon with databases from /usr/local/mysql/data 6.    现在赶快试试你的新密码吧;    作者 wenrunchang123 bitsCN.com

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn