What if I forgot my MySQL database password?

Source: Internet
Author: User
Tags mysql login

First, crack MySQL database password step

1. Modify the MySQL configuration file/etc/my.cnf

[Mysqld]port = 3306socket =/tmp/mysql.sockskip-external-lockingkey_buffer_size = 256mmax_allowed_packet = 1Mt Able_open_cache = 256sort_buffer_size = 1mread_buffer_size = 1mread_rnd_buffer_size = 4mmyisam_sort_buffer_size =  64mthread_cache_size = 8query_cache_size= 16m# Try number of CPU ' s*2 for thread_concurrencythread_concurrency = 2datadir = /mydata/dataskip-grant-tables #加入此项


2, restarting mysqld 

#/etc/init.d/mysqld restart 
Stopping MySQL: [OK] 
Starting MySQL: [OK]  

3. 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 database 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 MySQL login settings back
# VI/ETC/MY.CNF
Delete the skip-grant-tables you just added in the paragraph [mysqld]
Save and Exit VI.  

6. Restart Mysqld
#/etc/init.d/mysqld restart 
Stopping MySQL: [OK] 
Starting MySQL: [OK]



Icon:

Modify the following:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/87/D6/wKiom1fidNyiWWkUAAAzRu-YyRg999.png "title=" evbi3p ~yf4z}x_$y9k[]zgy.png "alt=" Wkiom1fidnyiwwkuaaazru-yyrg999.png "/>


To reset your password:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/87/D2/wKioL1fidRbxsoR-AABO4UZgdxQ114.png "title=" pxry{ Zs72ql_d) {d2d%_~7w.png "alt=" Wkiol1fidrbxsor-aabo4uzgdxq114.png "/>






This article is from the "Small Ears" blog, please be sure to keep this source http://purify.blog.51cto.com/10572011/1855250

What if I forgot my MySQL database password?

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.