If you forget your MySQL root password, you can recover it through the following procedure.
1. Send Kill command to MYSQLD server to turn off MYSQLD server (not kill-9), and the file that holds the process ID is usually in the directory where the MySQL database resides.
Kill ' Cat/mysql-data-directory/hostname.pid '
You must be a UNIX root user or an equivalent user on the server you are running to perform this operation.
2. Use the '--skip-grant-tables ' parameter to start the mysqld.
3. Use the ' mysql-h hostname mysql ' command to log on to the MYSQLD server and change the password with the grant command. You can also do this: ' mysqladmin-h hostname-u user password ' new password '.
(In fact, you can use MySQL; Update user Set Password =password (' Yourpass ') where user= ' root ' to do it. )
4. Load permission table: ' mysqladmin-h hostname flush-privileges ', or use SQL command ' flush privileges '. (Of course, here, you can also restart mysqld.) )
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.