Home  >  Article  >  Database  >  修改mysql的root密码的几种方法

修改mysql的root密码的几种方法

WBOY
WBOYOriginal
2016-06-07 16:17:551305browse

第一种方法 [root@localhost ~]# /usr/local/mysql/bin/mysqladmin -u root password new_password 一般安装时用此方法设置。 第二种方法 mysqlUPDATE user SET password=PASSWORD(new_password) WHERE user=root; mysqlFLUSH PRIVILEGES; 第三种方法 mysqlS

   第一种方法

  [root@localhost ~]# /usr/local/mysql/bin/mysqladmin -u root password ‘new_password’

  一般安装时用此方法设置。

  第二种方法

  mysql>UPDATE user SET password=PASSWORD(‘new_password’) WHERE user=’root’;

  mysql>FLUSH PRIVILEGES;

  第三种方法

  mysql>SET PASSWORD FOR root=PASSWORD(‘new_password’);

  如果不知道root密码情况下修改root密码

  mysqld启动的时候加上–skip-grant-tables,然后马上修改密码,,修改后去掉–skip-grant-tables,然后就OK了。

Statement:
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