文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>MySQL恢复root密码

MySQL恢复root密码

时间:2007-09-05  来源:Ksharp

To reset a forgotten mysql root password you have to start MySQL by bypassing all privileges and reset the root password. It is highly suggest you do this in single user mode, since it is still possible for every user to access the mysql.sock, if you haven't changed privileges. What you should do:

/etc/init.d/mysql stop
/usr/bin/mysqld_safe --skip-grant-tables --skip-networking &
mysql -u root
use mysql;
UPDATE user SET Password=PASSWORD("your password here") WHERE User="root";
exit
# kill all the mysql processes
/etc/init.d/mysql stop
# Start MySQL again
/etc/init.d/mysql start

至于停mysql的方法有很多,我是查出进程直接kill:)

ps -ef|grep mysql

kill -9 进程号

还可以

/bin/kill `cat /var/run/mysqld/mysqld.pid`  2>; /dev/null

附一条修复mysql数据库表的命令

/usr/local/bin/mysqlcheck -uroot -p  -r [database name]

排行榜 更多 +
枪魂狙击内购免广告

枪魂狙击内购免广告

飞行射击 下载
露娜开放式厨房游戏手机版

露娜开放式厨房游戏手机版

模拟经营 下载
贝壳阅读网

贝壳阅读网

浏览阅读 下载