Home > Database > Mysql Tutorial > body text

MySQL数据库密码的恢复与重设_MySQL

WBOY
Release: 2016-06-01 14:00:56
Original
931 people have browsed it

MySQL密码的恢复方法

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

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

  killall -TERM mysqld

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

  safe_mysqld --skip-grant-tables &

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

  mysql -u root

  4. 修改root用户的密码;

  mysql> update mysql.user set password=PASSWORD('新密码') where User='root';

  mysql> flush privileges;

  mysql> quit

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

  MySQL密码的重设方法

  mysqladmin -u root -p password mypasswd

  输入这个命令后,需要输入root的原密码,然后root的密码将改为mypasswd。

  把命令里的root改为你的用户名,你就可以改你自己的密码了

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!