亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

MySQL的root密碼忘記或丟失的解決方法一例

發布時間:2020-08-11 03:59:36 來源:ITPUB博客 閱讀:160 作者:wg0411 欄目:MySQL數據庫
-bash-4.2$ service mysql status
 SUCCESS! MySQL running (2670)
-bash-4.2$ mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

以下是密碼忘記的解決方法:

修改MySQL的參數設置: 
# vi /etc/my.cnf 
在[mysqld]的段最后一行加上一句:skip-grant-tables 
例如: 
[mysqld] 
........................
log-bin=mysql-bin
innodb_data_file_path = ibdata1:12M;ibdata2:100M;ibdata3:300M:autoextend
innodb_file_per_table=on
max_connections=500
skip-grant-tables    --新增加行
保存并且退出vi.

重啟MySQL服務:
[root@chenfeng subsys]# service mysql restart
Shutting down MySQL. SUCCESS! 
Starting MySQL. SUCCESS! 

-bash-4.2$ mysql    --不用輸密碼直接登錄
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.15-log Source distribution


Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.


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


MySQL [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| chenfeng           |
| mysql              |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.00 sec)


MySQL [(none)]> 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 [mysql]>  UPDATE user SET Password = password ('12345678') WHERE User ='root';   --修改為新密碼12345678
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4  Changed: 4  Warnings: 0

MySQL [mysql]> 
MySQL [mysql]> flush privileges;   --刷新一下權限表
Query OK, 0 rows affected (0.00 sec)

MySQL [mysql]> quit
Bye

將MySQL的參數設置修改回來:
# vi /etc/my.cnf 
將剛才在[mysqld]的段中最后一行加上的skip-grant-tables刪除,然后保存退出。
 
重啟MySQL服務:
[root@chenfeng subsys]# service mysql restart
Shutting down MySQL. SUCCESS! 
Starting MySQL. SUCCESS! 


重新用新密碼登錄:
-bash-4.2$ mysql -u root -p12345678      --12345678為新密碼
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.6.15-log Source distribution


Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.


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


MySQL [(none)]> 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 [mysql]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| chenfeng           |
| mysql              |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.00 sec)

MySQL [mysql]> 
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

沙河市| 西畴县| 永年县| 凤庆县| 志丹县| 天祝| 怀安县| 拜泉县| 法库县| 河北区| 赫章县| 太湖县| 那曲县| 开鲁县| 陆河县| 鄂尔多斯市| 望谟县| 石林| 龙游县| 南阳市| 昌邑市| 九寨沟县| 周至县| 和硕县| 绥滨县| 台山市| 榆林市| 保定市| 木兰县| 龙胜| 栖霞市| 平果县| 鲁甸县| 龙里县| 罗甸县| 郸城县| 松江区| 灵璧县| 新源县| 宜宾市| 临澧县|