Linux on turn off MySQL remote

Source: Internet
Author: User

Many times there will be forgotten or lost the MySQL root password situation, I would like to clean up the solution, I hope to the friends of the newly-learned Linux help.

I. Modification of MY.CNF
Add Skip-grant-tables



Second, find the MySQL bin file/usr/bin

./mysqladmin-uroot Password ' admin888 '

Third, set up remote connection

Mysql-u root-p
Grant all on * * to ' root ' @ '% ' identified by ' admin888 ';

(in order to test, in fact, can not open)

Using the client (client software such as Phpadmin) to view the remote connection database, the migrated database is not recovered.

Iv. Login and Change password with new password



Mysql-uroot-p

Select User,password,host from Mysql.user;
Update user set Password=password ("password") where user= ' root ';

Flush privileges;

V. Close remote connections

Believe that this step, we have already set.

Modify MY.CNF Delete Skip-grant-tables

Log in to MySQL, set the remote user off

Update user Set host = '% ' where user = ' root ';

Select Host, user from user;

New password native Connection Try it, the password is changed.

Linux on turn off MySQL remote

Related Article

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.