Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to reset the root password for mysql

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to reset the root password of mysql. It is very detailed and has a certain reference value. Friends who are interested must read it!

My mysql version MYSQL V5.7.9, please use the old version:

UPDATE mysql.user SET Password=PASSWORD ('new password') WHERE User='root'

Mac OS X-reset the MySQL Root password

There are too many passwords to remember. Have you forgotten the root password of Mac OS's MySQL? You can reset the new password in the following 4 steps:

1. Stop mysql server.

Usually in 'system preferences' > MySQL > 'Stop MySQL Server'

two。 Open the terminal and enter:

Sudo / usr/local/mysql/bin/mysqld_safe-- skip-grant-tables

3. Open another new terminal and enter:

Sudo / usr/local/mysql/bin/mysql-u root UPDATE mysql.user SET authentication_string=PASSWORD ('your new password') WHERE User='root'; FLUSH PRIVILEGES; exit

4. Restart MySQL.

All right, that's it.

Knowledge point supplement

Windows:

1. Log in to the system as a system administrator.

two。 Open cmd-net start to see if mysql is started. Stop net stop mysql if you start it.

3. My mysql is installed under d:\ usr\ local\ mysql4\ bin.

4. Skip permission check to start mysql.

D:\ usr\ local\ mysql\ bin\ mysqld-nt-- skip-grant-tables

5. Reopen cmd. Go to d:\ usr\ local\ mysql4\ bin:

D:\ usr\ local\ mysql\ bin\ mysqladmin-u root flush-privileges password "newpassword"

D:\ usr\ local\ mysql\ bin\ mysqladmin-u root-p shutdown prompts you to re-enter your password.

6. In cmd, net start mysql.

7. It's done.

Linux:

One of the recovery methods of MySQL root password

If you forget your MySQL root password, you can reset it in the following ways:

1.KILL drops the MySQL process in the system

Killall-TERM MySQLd

two。 Start MySQL without checking permissions with the following command

Safe_MySQLd-- skip-grant-tables &

3. Then log in to MySQL with an empty password using the root user

MySQL-u root

4. Change the password of a root user

MySQL > update MySQL.user set password=PASSWORD ('new password') where User='root'; MySQL > flush privileges; MySQL > quit

Restart MySQL and you can log in with your new password.

The above is all the contents of the article "how to reset the root password of mysql". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report