ERROR 1049 (42000): Unknown database

后端 未结 3 1436
逝去的感伤
逝去的感伤 2021-02-07 00:42

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 da         


        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-07 01:09

    blog_development doesn't exist

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

    create it in mysql with

    mysql> create database blog_development
    

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

    $ rake db:create
    

    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
    

    Also become familiar with:

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

提交回复
热议问题