我似乎無法登錄到我的教程數據庫開發環境:ERROR 1049(42000):未知的數據庫
Ayman$ mysql -u blog -p blog_development
Enter password:
ERROR 1049 (42000): Unknown database 'blog_development'
我可以登錄到數據庫細而不blog_development部分:
Ayman$ mysql -u blog -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1858
不知道,因爲我授予的所有訪問是什麼賦予了:
mysql> GRANT ALL PRIVILEGES ON blog_development.*
-> TO 'blog'@'localhost'
-> IDENTIFIED BY 'newpassword';
Query OK, 0 rows affected (0.01 sec)
mysql> SHOW GRANTS FOR 'blog'@'localhost'
-> ;
+----------------------------------------------------------------------------------------- --------------------+
| Grants for [email protected] |
+----------------------------------------------------------------------------------------- --------------------+
| GRANT USAGE ON *.* TO 'blog'@'localhost' IDENTIFIED BY PASSWORD '*FE4F2D624C07AAEBB979DA5C980D0250C37D8F63' |
| GRANT ALL PRIVILEGES ON `blog`.* TO 'blog'@'localhost' |
| GRANT ALL PRIVILEGES ON `blog_development`.* TO 'blog'@'localhost' |
+----------------------------------------------------------------------------------------- --------------------+
3 rows in set (0.00 sec)
人有什麼線索來試試呢?謝謝!此外,側筆記記錄是很奇怪我有多個root用戶?:
mysql> select User from mysql.user;
+------+
| User |
+------+
| root |
| root |
| |
| root |
| |
| blog |
| root |
+------+
7 rows in set (0.00 sec)
編輯:對於那些asking-我創建的數據庫與博客在MySQL中CREATE DATABASE命令。這裏是我的活動數據庫:
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| blog |
| mysql |
| performance_schema |
| test |
+--------------------+
5 rows in set (0.00 sec)
你真的創建了數據庫嗎? 'mysql -u blog -p'登錄到mysql但不選擇數據庫。 – DGM
yup,那裏是在mySQL - 'blog'中,並且您正在嘗試rails中的'blog_development'(這是更好的名稱以及示例database.yml或開發中提供的名稱)。 –