MySQL password Problems

Source: Internet
Author: User

1. mysqladmin-uroot-poldpassword password newpassword
2. mysql> update mysql. user set password = PASSWORD ('new password') where User = 'root ';
Mysql> flush privileges;
Mysql> quit
3. mysql-u root mysql
Mysql> UPDATE user SET password = PASSWORD ("new password") WHERE user = 'name ';
Mysql> flush privileges;
Mysql> QUIT
4. You can modify the MY. ini file in the MYSQL folder.

5. Use the set password statement,
Mysql> set password for myuser @ localhost = PASSWORD ('mypasswd ');

6. Use the GRANT... identified by statement
Mysql> grant usage on *. * TO myuser @ localhost identified by 'mypassword ';

In windows:
Open the command line window and stop mysql service: Net stop mysql
Install MySQL to start mysql. Use mysqld-nt.exe to start MySQL in the bindirectory. Run mysqld-nt -- skip-grant-tables in the command line window.
Then, open a command line window and execute mysql. You do not need to enter a password.
> Use mysql
> Update user set password = password ("new_pass") where user = "root ";
> Flush privileges;
> Exit
Use the task manager to locate the mysqld-nt process and end the process!
After restarting the mysql-nt service, you can log on with a new password.

In linux:
If MySQL is running, killall-TERM mysqld is first killed.
Start MySQL: bin/safe_mysqld -- skip-grant-tables &
You can access MySQL without a password.
Then
> Use mysql
> Update user set password = password ("new_pass") where user = "root ";
> Flush privileges;
Kill MySQL again and start MySQL in a normal way.

1) Stop mysql instances in windows Services

2) use the-skip-grant-tables parameter to start mysql. In this mode, you can log on to mysql without the root password.

Mysqld-max-nt-skip-grant-tables

3) log on to mysql and change the password.

C: \ Documents ents and Settings \ binzhang> mysql
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 1 to server version: 5.0.27-community-max-nt
Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.

Mysql> use mysql;
Database changed
Mysql> update user set password = password ("root") where user = "root ";
Query OK, 1 row affected (0.07 sec)
Rows matched: 1 Changed: 1 Warnings: 0

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.