文章详情

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

相关阅读 更多 +
排行榜 更多 +
Binance交易app安装错误排查

Binance交易app安装错误排查

金融理财 下载
币安app安装卡住解决方案

币安app安装卡住解决方案

金融理财 下载
Binance安装包校验失败怎么办

Binance安装包校验失败怎么办

金融理财 下载