MySQL forgot password what to do?

Source: Internet
Author: User

Digitialocean purchased the host for a period of time, the feeling is OK. Recently in the billiard room to help friends to do the development, using the Uctoo This development framework, in the installation, found that the MySQL link on the host is a problem, the use of Navicat connection is not connected, so with Xshell to operate, MySQL account is still a problem, It may be that the installation environment at the time to forget the MySQL user name and password set, after searching the internet, found a good way:

2. To modify the login settings for MySQL: # vi/etc/my.cnf in [MYSQLD] paragraph: skip-grant-tables For example: [Mysqld] Datadir=/var/lib/mysql socket=/var/lib/ Mysql/mysql.sock skip-name-resolve skip-grant-tables Save and Exit VI.

3. Restart Mysqld #/etc/init.d/mysqld restart stopping mysql: [OK] starting MySQL: [OK]

4. Log in and modify the root password of MySQL #/usr/bin/mysql Welcome to the MySQL monitor. Commands End With; or \g. Your MySQL Connection ID is 3-to-server version:3.23.56 Type ' help, ' or ' \h ' for help. Type ' \c ' to clear the buffer. mysql> use MySQL; Reading table information for completion of table and column names you can turn off this feature to get a quicker startup With-a

Atabase changed mysql> UPDATE user SET Password = Password (' New-password ') WHERE user = ' root '; Query OK, 0 rows Affected (0.00 sec) rows Matched:2 changed:0 warnings:0 mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) mysql> quit Bye

5. Change the login settings for MySQL back to # vi/etc/my.cnf add the skip-grant-tables that you just added in the [mysqld] section to save and Exit VI.

6. Restart Mysqld #/etc/init.d/mysqld restart stopping mysql: [OK] starting MySQL: [OK]

Data source "Http://wenku.baidu.com/link?url=8qX5znAwZNrTFXCHcp9qhOo-Gn5SmjDVdV_ Wmc6nyll0-0ewud6ayot9nioc-a2p8euoucl8lc-ptknbhhqr905livi6osppyqrjm5ejbac "

MySQL forgot password what to do?

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.