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 change root password in mysql

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Mysql how to change the root password, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

Method 1:

Under / usr/local//bin/:

. / mysqladmin-u root password new_password

It is generally set up in this way during installation.

Method 2:

In the mysql state:

Mysql > UPDATE user SET password=PASSWORD (new_password) WHERE user=root

Mysql > FLUSH PRIVILEGES

Method 3:

Mysql > SET PASSWORD FOR root=PASSWORD (new_password)

Some people may ask whether it is possible to change the password if you do not know the password of mysql root. Answer: yes, if you want to know how, please read on:

Only when mysqld starts, add-- skip-grant-tables to ok.

Example:

[root@server] # / usr/local/mysql/bin/mysqld_safe-- skip-grant-tables &

[root@server] # / usr/local/mysql/bin/mysql-uroot-p

Enter password:

Welcome to the MySQL monitor. Commands end with; or g.

Your MySQL connection id is 7

Server version: 5.0.45-log Source distribution

Type help; or h for help. Type c to clear the buffer.

Mysql > use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

Mysql > update user set password=password (*) where user=root

Query OK, 4 rows affected (0.00 sec)

Rows matched: 4 Changed: 4 Warnings: 0

Mysql > flush privileges

Query OK, 0 rows affected (0.01 sec)

After reading the above, have you mastered how to change the root password in mysql? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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