国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

linux環境mysql重置密碼

gaara / 3217人閱讀

mysql重置密碼

Linux環境下,忘記mysql密碼怎么辦?這里提供兩種解決方案。

第一種方案:

在my.cnf配置文件中添加“跳過登陸密碼驗證”配置項

sed -i "/[mysqld]/ askip-grant-tables" /etc/my.cnf

重啟mysqld守護進程,重新加載配置

service mysqld restart

直接無賬戶無密碼登陸mysql

[root@pingkou-developer2 etc]# mysql
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 3
Server version: 5.5.51-log MySQL Community Server (GPL) by Remi

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.

重新設置root賬戶密碼后,退出登錄

mysql> update `mysql`.`user` set `password`=password("admin") where `user`="root";
Query OK, 0 rows affected (0.00 sec)
Rows matched: 3  Changed: 0  Warnings: 0

mysql> exit;
Bye

在my.cnf配置文件中,將skip-grant-tables配置項注釋掉,加#注釋

sed -i "s/skip-grant-tables/#&/" /etc/my.cnf

重啟mysqld守護進程,重新加載配置

[root@pingkou-developer2 pingkou]# service mysqld restart
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]

使用新密碼重新登陸mysql,結束

[root@pingkou-developer2 pingkou]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 4
Server version: 5.5.51-log MySQL Community Server (GPL) by Remi

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> 

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/23286.html

相關文章

發表評論

0條評論

gaara

|高級講師

TA的文章

閱讀更多
最新活動
閱讀需要支付1元查看
<