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

The method of resetting root password in Mysql 5.5

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

Share

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

This article mainly explains the "Mysql 5.5 reset root password method", the article explains the content is simple and clear, easy to learn and understand, now please follow the editor's train of thought slowly in depth, together to study and learn "Mysql 5.5 reset root password method" bar!

If you forget your root password, you can reset it through the following process:

Note: database needs to be restarted

Because you don't know the password of root, you can't shut down the database in the usual way.

Force the database to shut down by killing the process

[root@localhost ~] # ps-ef | grep mysql

Root 26764 55613 0 Apr04 pts/2 00:00:00 / bin/sh. / mysqld_safe-- defaults-file=/etc/my.cnf

Mysql 27174 26764 0 Apr04 pts/2 00:01:04 / data/bin/mysqld-defaults-file=/etc/my.cnf-basedir=/data-datadir=/var/lib/mysql-plugin-dir=/data/lib/plugin-user=mysql-log-error=/log/err.log-open-files-limit=10240 pid-file=/var/run/mysqld/mysqld.pid socket=/var/lib/mysql/mysql.sock port=3306

Root 27192 55613 0 Apr04 pts/2 00:00:00. / mysql-usystem-px xxxxxxxxx mysql

Root 34544 18985 0 12:11 pts/3 00:00:00 / data/bin/mysql-ufire-px xxxxxxxxx

Root 37683 13290 0 19:32 pts/0 00:00:00 grep mysql

[root@localhost ~] # kill `cat / var/run/mysqld/ mysqld.pid`

Start the database in the following way, ignoring authorization verification and forbidding network client connections

[root@localhost bin] # / mysqld_safe-- defaults-file=/etc/my.cnf-- skip-grant-tables-- skip-networking&

[1] 38252

Change the administrator user password

[root@localhost bin] #. / mysql

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

Your MySQL connection id is 2

Server version: 5.5.48-log production environment

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

Affiliates. Other names may be trademarks of their respective

Owners.

Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.

Mysql > select user ()

+-+

| | user () |

+-+

| | root@ |

+-+

1 row in set (0.00 sec)

Mysql > update mysql.user set password=password ('System#2013') where user='system'

Query OK, 0 rows affected (0.15 sec)

Rows matched: 1 Changed: 0 Warnings: 0

Mysql > commit

Query OK, 0 rows affected (0.00 sec)

Mysql > flush privileges

Query OK, 0 rows affected (0.19 sec)

Shut down the database and restart the database

[root@localhost bin] #. / mysqladmin-usystem shutdown-p

Enter password:

160405 19:48:22 mysqld_safe mysqld from pid file / var/run/mysqld/mysqld.pid ended

[1] + Done. / mysqld_safe-defaults-file=/etc/my.cnf-skip-grant-tables-skip-networking

[root@localhost bin] # / mysqld_safe-- defaults-file=/etc/my.cnf &

[1] 38903

[root@localhost bin] # 160405 20:07:43 mysqld_safe Logging to'/ log/err.log'.

160405 20:07:43 mysqld_safe Starting mysqld daemon with databases from / var/lib/mysql

Thank you for reading, the above is the content of "Mysql 5.5 reset root password". After the study of this article, I believe you have a deeper understanding of the method of resetting root password in Mysql 5.5. the specific use also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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