【发布时间】:2015-07-18 09:58:45
【问题描述】:
我知道这个问题被问了很多次,我也阅读了很多关于这个问题的问题,但我认为我的不同。
我使用 10.10.3 版的 Mac 和终端来执行我的命令。
我正在尝试创建一个本地数据库(我之前也这样做过),但由于某种原因,访问一直被拒绝。
这是我的终端的样子:
iMac-van:mysql 639$ /usr/local/mysql/bin/mysql -v
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.24 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, 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.
Reading history-file /Users/639/.mysql_history
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> quit;
Writing history-file /Users/639/.mysql_history
Bye
iMac-van:mysql 639$ /usr/local/mysql/bin/mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.24 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, 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> create database wordpress_db;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'wordpress_db'
如您所见,我可以登录 mysql,但我没有创建数据库的权限。
我尝试像这样登录:
$ /usr/local/mysql/bin/mysql -u root
还有:
$ /usr/local/mysql/bin/mysql -u root -p
我没有密码,但是没有密码也可以进入mysql,然后就不能创建数据库了。
选择 current_user();返回:
mysql> select current_user();
+----------------+
| current_user() |
+----------------+
| @localhost |
+----------------+
1 row in set (0,00 sec)
【问题讨论】:
标签: mysql macos command-line terminal