MySQL forgot root password retrieve method

Source: Internet
Author: User
Tags flush mysql in mysql tutorial php tutorial phpmyadmin

MySQL Tutorial Forget root password Retrieve method

PHP Tutorial myadmin that can go into MySQL, with access to phpMyAdmin username and password entered on it,

If phpMyAdmin can get in, just look in config.php or config.default.php.


Remember the MySQL root password, you can use the following methods to reset:

1. Kill off the MySQL process in the system;

2. At the command prompt (cmd), enter into the MySQL bin directory, to start MySQL under the command to do not check the permissions of the way to start;
Mysqld-nt--skip-grant-tables

3. Then restart a command Prompt window (cmd) use the root user to log in to MySQL with a blank password;

Mysql-u Root

4. Change the password of root user;
mysql> Update Mysql.user Set Password=password (' New password ') where user= ' root ';
mysql> flush Privileges;
Mysql> quit

5. Restart the computer to log on with the new password.


Forget MySQL root password workaround two


MySQL forgot root password solution:

Under Windows:

Open a command line window to stop the MySQL service: net stop MySQL

Start MySQL, general to the installation path of MySQL, find Mysqld-nt.exe

Come to this directory:

C:Program Filesmysqlmysql Server 5.0bin>

Executive: Mysqld-nt--skip-grant-tables

In addition, open a command line window to execute MySQL

>use MySQL #选择数据库教程

>update User Set Passwordpassword=password ("New_pass") where user= "root";  >flush privileges; >exit use Ctrl+alt+del, find the mysqld-nt process kill it, restart the Mysql-nt service, you can log in with the new password

MySQL Forget root password solution: under Linux:

If MySQL is running, first kill: Killall-term mysqld.

Start Mysql:bin/safe_mysqld--skip-grant-tables &

You can enter MySQL without the need for a password.

Then it's

>use MySQL >update user set Passwordpassword=password ("New_pass") where user= "root"; >flush privileges; Re-kill MySQL, the normal way to start MySQL.

If MySQL is running, first kill: Killall-term mysqld.

Start Mysql:bin/safe_mysqld--skip-grant-tables & (sometimes Mysqld_safe)

You can enter MySQL without the need for a password.

And then there's/usr/local/mysql/bin/mysql.

>use MySQL >update user set Passwordpassword=password ("New_pass") where user= "root"; >flush privileges;


Forgot MySQL root password processing method three


Windows:
1. Login system with system administrator.
2. Stop the MySQL service.
3. Enter the command window, and then enter the MySQL installation directory, such as my installation directory is c:mysql, into the C:mysqlbin
4. Skip permission Check to start MySQL,
C:mysqlbin>mysqld-nt--skip-grant-tables
5. Reopen a window, enter the C:mysqlbin directory, set the new password for root
C:mysqlbin>mysqladmin-u root flush-privileges password "NewPassword"
C:mysqlbin>mysqladmin-u root-p shutdown
Replace the newpassword with the root password you want to use, and the second command prompts you to enter a new password and repeat the password entered in the first command.
6. Stop MySQL server, start MySQL in normal mode
7. You can link to MySQL with a new password.

Unix&linux:
1. Log in to the system with root or run mysqld;
2. Use the KILL command to end the process of mysqld;
3. Use the--skip-grant-tables parameter to start the MySQL server
#mysqld_safe--skip-grant-tables
4. Set a new password for root@localhost
# Mysqladmin-u root flush-privileges password "NewPassword"
5. Restart the MySQL server

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.