In Windows, MySQL root users forget the password solution, mysqlroot

Source: Internet
Author: User
Tags mysql update mysql flush privileges

In Windows, MySQL root users forget the password solution, mysqlroot

Open two command line windows at the same time and follow the steps below:

<1>. In the first "command line window", enter:

cd D:\Program Files\MySQL\MySQL Server 5.5\binnet stop mysqlmysqld --skip-grant-tables

<2>. In the second "command line window", enter:

Cd D: \ Program Files \ MySQL Server 5.5 \ binmysql-uroot-pmysql> update mysql. user set password = PASSWORD ("new password") where User = "root"; mysql> flush privileges; mysql> exitnet start mysql


What should I do if the mysql root Password is lost in windows? How to change the root password

If you forget the MySQL root Password, You can reset it using the following methods:
1. KILL the MySQL process in the system;
2. At the command prompt (CMD), go to the mysql bin directory and run the following command to start MySQL without checking the permissions;
Mysqld-nt -- skip-grant-tables
3. Open a command prompt window again (CMD) and use the empty password to log on to MySQL as the root user;
Mysql-u root
4. Modify the password of the 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.
Windows:
1. log on to the system as a system administrator.
2. Stop MySQL services.
3. Go to the Command window and enter the MySQL installation directory. For example, if my installation directory is c: \ mysql, go to C: \ mysql \ bin.
4. Skip the permission check and start MySQL,
C: \ mysql \ binmysqld-nt -- skip-grant-tables
5. open a new window, go to the c: \ mysql \ bin directory, and set the new root password.
C: \ mysql \ binmysqladmin-u root flush-privileges password "newpassword"
C: \ mysql \ binmysqladmin-u root-p shutdown
Replace newpassword with the root password you want to use. The second command will prompt you to enter a new password and repeat the password entered by the first command.
6. Stop MySQL Server and start Mysql in Normal Mode
7. You can use a new password to link to Mysql.
Unix & Linux:
1. log on to the system using root or a user running mysqld;
2. Use the kill command to end the mysqld process;
3. Use the -- skip-grant-tables parameter to start MySQL Server
4. Set the new password shellmysqladmin-u root flush-privileges password "newpassword" for root @ localhost 5. Restart MySQL Server

What should I do if the mysql root Password is lost in windows? How to change the root password

1. KILL the MySQL process in the system; 2. at the command prompt (CMD), enter the BIN directory of MYSQL, start MySQL with the following command, do not check the permission to start; mysqld-nt -- skip-grant-tables3. then open a command prompt window (CMD) and use the empty password to log on to MySQL as the root user; mysql-u root4. modify the password of the root user; mysql> update mysql. user set password = PASSWORD ('new password') where User = 'root'; mysql> flush privileges; mysql> quit5. restart the computer and use the new password to log on. Windows: 1. Use the system administrator to log on to the system. 2. Stop MySQL services. 3. enter the command window and enter the MySQL installation directory. For example, if my installation directory is c: \ mysql, enter C: \ mysql \ bin4. Skip the permission check to start MySQL, c: \ mysql \ bin> mysqld-nt -- skip-grant-tables5. open a new window, go to the c: \ mysql \ bin directory, and set the new root password c: \ mysql \ bin> mysqladmin-u root flush-privileges password "newpassword" c: \ mysql \ bin> mysqladmin-u root-p shutdown replaces newpassword with the root password you want to use. The second command will prompt you to enter a new password and repeat the password entered by the first command. 6. Stop MySQL Server and start mysql7in normal mode. You can use a new password to link to Mysql. Unix & Linux: 1. log on to the system using root or a user running mysqld; 2. use the kill command to end the mysqld process. 3. use the -- skip-grant-tables parameter to start MySQL Servershell> mysqld_safe -- skip-grant-tables & 4. set a new password for root @ localhost

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.