How to restore the mysql root password _ MySQL

Source: Internet
Author: User
If you forget your MYSQL root password, you can recover it through the following process. 1. send the kill command to mysqldserver to disable mysqldserver (not kill-9). the files that store the process ID are usually located in the directory of the MYSQL database. Kill 'catmysql-data-directoryhostname.pid 'you must be a UNIX root user or if you forget your MYSQL root password, you can recover through the following process.
1. send the kill command to the mysqld server to disable the mysqld server (not kill-9). the files that store the process ID are usually located in the directory of the MYSQL database.
Kill 'cat/mysql-data-directory/hostname. Pi'
You must be a UNIX root user or an equivalent user on the SERVER you run to perform this operation.
2. use the '-- skip-grant-tables' parameter to start mysqld.
3. use the 'MySQL-h hostname mysql' command to log on to the mysqld server and use the grant command to change the password. You can also do this: 'mysqladmin-h hostname-u user password' new password '.
(You can also use mysql; update user set password = password ('yourpass') where user = 'root .)
4. load the permission table: 'mysqladmin-h hostname flush-privileges ', or use the SQL command 'flush privileges '. (Of course, you can restart mysqld here .)

SonyMusic (sonymusic@163.net) translation

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.