文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
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]

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载