Home > Database > Mysql Tutorial > body text

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

WBOY
Release: 2016-06-07 16:17:55
Original
1313 people have browsed it

第一种方法 [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了。

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!