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

溫馨提示×

溫馨提示×

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

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

Mysql 5.5 源碼安裝后創建用戶報錯"ERROR 1045 (28000): Access denied for user"

發布時間:2020-08-08 08:23:20 來源:ITPUB博客 閱讀:152 作者:feelpurple 欄目:MySQL數據庫
安裝MySQL后,root用戶可設置密碼登錄,其他新建的用戶不能通過密碼登錄,只能不輸入密碼登錄,而且對新建用戶的授權均無效。


--創建一個庫和用戶
mysql> create database fire;
Query OK, 1 row affected (0.00 sec)

mysql> create user neo identified by 'Mysql#2015';
Query OK, 0 rows affected (0.00 sec)

mysql> grant select,create,update,delete on fire.* to neo;
Query OK, 0 rows affected (0.00 sec)

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

--使用新用戶登錄報錯

[root@localhost data]# ./bin/mysql -u neo -p"Mysql#2015"
ERROR 1045 (28000): Access denied for user 'neo'@'localhost' (using password: YES)

--但是不輸入密碼卻可以登錄

[root@localhost software]# ./bin/mysql -uneo
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
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> show grants;
+--------------------------------------+
| Grants for @localhost                |
+--------------------------------------+
| GRANT USAGE ON *.* TO ''@'localhost' |
+--------------------------------------+
1 row in set (0.00 sec)

報錯原因Mysql使用源碼安裝后,數據庫中存在匿名用戶,可以通過任意用戶名不輸入密碼即可登錄數據庫。

mysql> select host,user,password  from mysql.user where (user) not in ('root');
+-----------------------+------+-------------------------------------------+
| host                  | user | password                                  |
+-----------------------+------+-------------------------------------------+
| localhost             |      |                                           |
| localhost.localdomain |      |                                           |
| %                     | neo  | *CC4C777F1511C297751B78287D6E05345D227819 |
| %                     | test | *443EF031E558E317B19BAD70BDF4E25FA73A89A7 |
+-----------------------+------+-------------------------------------------+
4 rows in set (0.00 sec)

mysql> select host,user,password  from mysql.user where (user) not in ('root','neo','test');
+-----------------------+------+----------+
| host                  | user | password |
+-----------------------+------+----------+
| localhost             |      |          |
| localhost.localdomain |      |          |
+-----------------------+------+----------+
2 rows in set (0.00 sec)

解決方法刪除匿名用戶

mysql> delete  from mysql.user where (user) not in ('root','neo','test');
Query OK, 2 rows affected (0.00 sec)

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

之后新創建的用戶即可正常登錄到數據庫

[root@localhost software]# ./bin/mysql -uneo -p'Mysql#2015'
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
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> show grants;
+-----------------------------------------------------------------+
| Grants for neo@%                                                |
+-----------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'neo'@'%' IDENTIFIED BY PASSWORD <secret> |
| GRANT SELECT, INSERT, DELETE, CREATE ON `fire`.* TO 'neo'@'%'   |
+-----------------------------------------------------------------+
2 rows in set (0.00 sec)

向AI問一下細節

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

AI

依安县| 古田县| 宝山区| 明溪县| 临泉县| 甘南县| 苍溪县| 沁水县| 岑巩县| 社会| 三明市| 水富县| 苍南县| 绥江县| 柘荣县| 越西县| 桑日县| 华宁县| 伊宁市| 四子王旗| 梨树县| 松江区| 涟水县| 桃江县| 雷波县| 惠来县| 亳州市| 建昌县| 轮台县| 尼玛县| 梧州市| 松阳县| 岗巴县| 义乌市| 防城港市| 博兴县| 武乡县| 岑溪市| 彰化县| 凤阳县| 松溪县|