是否需要將MySQL用戶添加到MySQL「系統」中?是否需要將MySQL用戶添加到MySQL「系統」?
我在學習MySQL基礎知識,但這個問題剛剛出現。這是爲什麼:
:~$ mysql -u johndoe
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 50
Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu)
Copyright (c) 2000, 2011, 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() |
+-------------------+
| [email protected] |
+-------------------+
1 row in set (0.00 sec)
mysql> quit
Bye
當然,我沒有設置一個名爲johndoe的用戶,但似乎我可以用任何用戶名輸入mysql。我並不是說我會看到任何數據庫,因爲它可能沒有設置任何數據庫,例如johndoe可以做些事情。
所以我的問題最後是:這是真的還是我看到它是錯誤的?
如果你可以用隨機用戶登錄mysql,這意味着你正在用'--skip-grant-tables'運行你的服務器。 – golja 2012-07-06 00:39:29
不是。你可以看到@SelloLekgothoane答案,或者按照以下鏈接:[function_current-user](http://dev.mysql.com/doc/refman/5.1/en/information-functions.html#function_current-user),[function_user] (http://dev.mysql.com/doc/refman/5.1/en/information-functions.html#function_user)和[account-activity-auditing](http://dev.mysql.com/doc/refman/ 5.1/EN /帳戶 - 活性 - auditing.html)。 – Miguel 2012-07-06 04:06:33
您也可以關注[此鏈接](http://dev.mysql.com/doc/refman/5.1/en/default-privileges.html),非常明確。確實是 – Miguel 2012-07-06 14:34:36