重设MySQL root密码

如果忘记了MySQL的root密码,可以用以下方法重新设置:

1. KILL掉系统里的MySQL进程;

killall -TERM mysqld

2. 用以下命令启动MySQL,以不检查权限的方式启动;

mysqld_safe -skip-grant-tables &

3. 然后用空密码方式使用root用户登录 MySQL;

mysql -u root

4. 修改root用户的密码;

mysql> update mysql.user set password=PASSWORD('new-password') where User='root';

mysql> flush privileges;

mysql> quit

重新启动MySQL,就可以使用新密码登录了.

 

或者也可以用mysqladmin命令来修改密码:

mysqladmin -u root -p password mypasswd

输入这个命令后,需要输入root的原密码,然后root的密码将改为mypasswd。 把命令里的root改为你的用户名,你就可以改你自己的密码了。

 

这个回答有用吗?

 打印这篇文章

继续阅读

Adding a range/block of ips

As an example to add a /24 253 ips to a linux server follow these setups. We'll use...

Add Multiple IP's to a Server

...

How to open ports within IPtables in Redhat 3/4/5 & Above | CentOS | Fedora Linux

How to open ports within IPtables in Redhat 3/4/5 & Above | CentOS | Fedora LinuxIPtables...

How to update CPanel license?

If you get Invalid License File when you login to cpanel, you need to update your cpanel license...

SFTP to a linux server using winscp

SFTP to a linux server from windows OSDownload winscp at...

Powered by WHMCompleteSolution