Mark, MySQL mistakenly delete root user resolution

Source: Internet
Author: User
Tags flush

Today to learn MySQL user management, accidentally the root user in the Mysql.user table is deleted, and then can not log in MySQL, the web found the solution of Linux, I made a simple modification, changed to my Windows edition , The recovery method is as follows:

1. Turn off MySQL servicenet stop MySQL or Wamp tool off 2. Start the privilege usage mode without verifying the userSwitch to the bin directory of MySQL and execute mysqld--console--skip-grant-tables 3. Login with the root user (no password), re-authorizeGrant all privileges on * * to [e-mail protected] ' localhost ' identified by ' password ' with grant Option;flush privileges;exit Note: if Grant Authorization Error: Error 1290 (HY000): The MySQL server is running with the--skip-grant-tables option so it cannot execute this s Tatement, please perform a flush privileges first, then grant authorization. 4. Exit the privileged mode (CTRL + C) 5, normal start MySQL, you can resume use See the Linux recovery method on the Internet1. Turn off Mysql/etc/init.d/mysql stop2, start the Privilege usage mode without verifying users/usr/local/mysql/bin/mysqld_safe--user=mysql--skip-grant-tables --skip-networking &3, use root user login (no password), re-authorize mysql-urootgrant all privileges on * * to [email protected] ' localhost ' Identified by ' Password ' with Grant Option;flush PRIVILEGES;EXIT4, restart MySQL service and resume using/etc/init.d/mysql restart

Mark, MySQL mistakenly delete root user resolution

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.