What should I do if I forgot my password?

Source: Internet
Author: User

How do I set a password for my administrator?

    1. External command Set Password

      Mysqladmin-uroot password= ' own password to set '

    2. SQL statement Set password

      Mysql>update Mysql.user set Password=password ("Password you want to set") where user= ' root ' and host= ' localhost '


How do I forget a single-instance password?


    1. Turn off MySQL

      /etc/init.d/mysqld stop

    2. Start with parameters

      Mysqld_safe--skipgrant-tables--user=mysql &

    3. Blank Password Login

      Mysql-uroot

    4. Change Password

      Mysql>update Mysql.user set Password=password ("password") where user= ' root ' and host= ' localhost '

    5. Refresh Permissions

      mysql> flush Privileges;

    6. Turn off MySQL, restart

      Mysqladmin-uroot-ppassword shutdown

      /etc/init.d/mysqld start



How does a multi-instance forgotten password work?


    1. Turn off MySQL

Killall MySQL #只能killall myqld, because when the password is closed, your password has been forgotten

2. Add parameters at startup

Mysqld_safe--defaults-file=/data/3306/my.cnf--skip-grant-tables &

3. Login Time-space password

Mysql-uroot-s/data/3306/data/mysql.sock

4. Change the password

Mysql>update Mysql.user Set Password=password ("NewPassword") where user= ' root ' and host= ' localhost '

5. Don't forget to refresh

mysql> flush Privileges;

6. Then close MySQL, login with the new password is OK.

Mysqladmin-uroot-pnewpassword-s/data/3308/data/mysql.sock shutdown

This article is from the "Linux operation and Maintenance" blog, reproduced please contact the author!

What should I do if I forgot my password?

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.