Linux empty MySQL database root password tutorial

Source: Internet
Author: User
Tags mysql client

One, method one

1) into the Var/lib/mysql

2 delete mysql file

3 Restart MySQL, to this password has been cleared

4) set a new password

echo "Grant all" *.* to ' root ' @ ' localhost ' identified by ' newpass '; Mysql-uroot
echo "Grant all" *.* to ' root ' @ '% ' identified by ' newpass '; Mysql-uroot-pnewpass

Two, method two

1) Stop MySQL Service

2 Skip Permission Check boot Mysql/usr/bin/mysqld_safe--skip-grant-tables & (Note: parameter--skip-grant-tables to skip authorization form;--skip-networking is not a supervisor. Listening to TCP/IP connections)

(4) Execute MySQL client:

Mysql

(5) Use MySQL database

Use MySQL;

(6) Update the root password

Update user set password= ' where user= ' root '; here is an empty password to root;

(7) Shut down the MySQL server and try to start with the normal side.

Three, method three

1 #mysql-u root-p into MySQL management
2) mysql> Set password for Root@localhost=password (");
3) mysql>exit;

Actually, it's just a matter of setting the password to be empty.

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.