国产成人精品18p,天天干成人网,无码专区狠狠躁天天躁,美女脱精光隐私扒开免费观看

MySQL5.7忘記root密碼的處理方式

發(fā)布時(shí)間:2021-09-27 17:43 來(lái)源:億速云 閱讀:0 作者:chen 欄目: Mysql 歡迎投稿:712375056

本篇內容主要講解“5.7忘記root密碼的處理方式”,感興趣的朋友不妨來(lái)看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強。下面就讓小編來(lái)帶大家學(xué)習“MySQL5.7忘記root密碼的處理方式”吧!

MySQL忘記root密碼,而且不能使用操作系統認證直接進(jìn)入數據修改密碼時(shí),需要重置root密碼。
1、在配置文件/etc/my.cnf添加skip-grant-tables一行,跳過(guò)密碼驗證。
2、重啟mysql數據庫主進(jìn)程# /etc/init.d/mysqld restart(也可以直接先停掉MySQL進(jìn)程后使用skip-grant-tables參數重啟MySQL)
3、登錄數據庫修改密碼。
mysql> update user set authentication_string=password('') where user='root' and host='localhost';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql> exit
這里需要修改的字段是authentication_string,這點(diǎn)和之前的版本不同。
4、這個(gè)時(shí)候,如果你設置的密碼太簡(jiǎn)單,則在數據庫執行任何命令都會(huì )報類(lèi)似如下錯誤:
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> show database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1
mysql> update user set authentication_string=password('mysql') where user='root' and host='localhost';
ERROR 1046 (3D000): No database selected
mysql> use mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
5、注意:如果只想設置簡(jiǎn)單密碼需要修改兩個(gè)全局參數:
mysql> set global validate_password_policy=0;
mysql> set global validate_password_length=1;
mysql> set global validate_password_policy=0;
       Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password_length=1;
       Query OK, 0 rows affected (0.00 sec)
mysql> set password=password("mysql");
Query OK, 0 rows affected, 1 warning (0.00 sec)

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
-------------------------End--------------------------------------------------------------------------

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng )、來(lái)自本網(wǎng)站內容采集于網(wǎng)絡(luò )互聯(lián)網(wǎng)轉載等其它媒體和分享為主,內容觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如侵犯了原作者的版權,請告知一經(jīng)查實(shí),將立刻刪除涉嫌侵權內容,聯(lián)系我們QQ:712375056,同時(shí)歡迎投稿傳遞力量。

WWW夜插内射视频网站| 免费播放一区二区三区| 尤物AV无码色AV无码| 精品视频一区二区三区中文字幕| 九月婷婷人人澡人人添人人爽| mm1313午夜视频在线观看|