错误1049(42000):未知数据库 [英] ERROR 1049 (42000): Unknown database

查看:91
本文介绍了错误1049(42000):未知数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎无法登录到我的教程数据库开发环境:

I can't seem to login to my tutorial database development environment:

Ayman$ mysql -u blog -p blog_development
Enter password: 
ERROR 1049 (42000): Unknown database 'blog_development'

我可以在没有blog_development部分的情况下很好地登录数据库:

I can login to the database fine without the blog_development portion:

Ayman$ mysql -u blog -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1858

不确定授予我所有访问权限后会给出什么:

Not sure what gives as I granted all access:

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 blog@localhost                                                                                        |
 +----------------------------------------------------------------------------------------- --------------------+
| 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用户是否很奇怪?:

Anybody have a clue what to try? Thanks! Also, side note- is it weird I have multiple root users?:

mysql> select User from mysql.user;
+------+
| User |
+------+
| root |
| root |
|      |
| root |
|      |
| blog |
| root |
+------+
7 rows in set (0.00 sec)

针对那些询问者-我在MySql中使用CREATE DATABASE命令创建了数据库博客.这是我的活动数据库:

for those asking- I created the database blog with the CREATE DATABASE command in MySql. Here are my active databases:

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+  
| information_schema |
| blog               |
| mysql              |
| performance_schema |
| test               |
+--------------------+ 
5 rows in set (0.00 sec)

推荐答案

博客开发不存在

您可以通过0 rows affected消息在sql中看到它

You can see this in sql by the 0 rows affected message

在mysql中使用

mysql> create database blog_development

然而,当您使用滑轨时,您应该习惯使用

However as you are using rails you should get used to using

$ rake db:create

执行相同的任务.它将使用您的database.yml文件设置,其中应包含以下内容:

to do the same task. It will use your database.yml file settings, which should include something like:

development:
  adapter: mysql2
  database: blog_development
  pool: 5

也要熟悉:

$ rake db:migrate  # Run the database migration
$ rake db:seed     # Run thew seeds file create statements
$ rake db:drop     # Drop the database

这篇关于错误1049(42000):未知数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆