mysql中不能创建数据库,为什么呢?
第一种情况是:
root:/#mysql -u -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15 to server version: 5.0.91-enterprise-gpl
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
2 rows in set (1.05 sec)
mysql>
mysql>
mysql>
mysql> create database company
-> ;
ERROR 1044: Access denied for user ''@'localhost' to database 'company'
mysql>
第二种情况是:
root:/#mysql -u root -p
Enter password: (我输入了密码)
ERROR 1045: Access denied for user 'root'@'localhost' (using password: YES)
root:/#
追问:经尝试,我输入mysql -uroot 就好了,您知道是为什么吗?
答案:试这两个
mysql -h 127.0.0.1 -u root -p
mysql -h servername -u root -p
其他:我记得mysql -uroot 和mysql -u root是不一样的
mysql的格式要求-u后面直接跟上用户名 不要加空格 数据库是不是在服务器上,你通过网络访问?如果是网络访问数据库服务器,mysql不支持root访问,因为root只支持本地访问。
如果是自己本地电脑上的数据库,直接用mysql提供的入口就可以进去,不需要使用命令行来访问。
上一个:ubuntu下配置好了PHP的环境 也安装了一个DZX2的论坛 我想进入数据库看看 怎么进入mysql 客户端啊
下一个:MYSQL数据库 导入 !呜呜,老是们快来!!!!!!!!!!!