Delete the root user recovery method in MySQL

Source: Internet
Author: User

1. # Service Mysqld Stop #停止mysql数据库服务

2. # service mysqld start--skip-grant-tables #跳过授权表启动mysql数据库服务

3. # mysql-p #进入mysql数据库添加root用户并授权

mysql> use MySQL;

Mysql> select Host,user from user;

mysql> Update user Set Password=password ("New_password") where user= "root";

mysql> INSERT INTO user set user= ' root ', ssl_cipher= ', x509_issuer= ', x509_subject= '; #插入root用户

Mysql> select Host,user from user; #查询添加root用户是否成功

mysql> Update user set host= ' localhost ', select_priv= ' y ',

Mysql> exit

4. # Service Mysqld Restart #重新启动mysql数据库

5. # mysql_secure_installation #进入mysql数据库设置root用户密码

Set root Password? [y/n] y #此处询问是否修改root用户密码, enter "Y" and return, set the password for the root user previously added

Delete the root user recovery method in MySQL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.