1. 问题描述:
在MySQL控制台下创建数据库出现以下信息:
mysql> CREATE DATABASE python;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'python'
2. 解决方法:
执行以下命令进入控制台:
mysql --user=root -p
输入root用户的密码即可进入mysql控制台:
创建数据库:
create database python;
显示所有数据库:
show databases;
如下:
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 python;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database? ? ? ? ? |
+--------------------+
| information_schema |
| mysql? ? ? ? ? ? ? |
| performance_schema |
| python? ? ? ? ? ? |
| test? ? ? ? ? ? ? |
+--------------------+
5 rows in set (0.02 sec)
mysql>
3. OK, 以上方法不是最好的, 但却是简单可行的,Enjoy it!!!
更多解决方法及原因继续研究, 继续补充...?