ERROR 1049 (42000): Unknown database

后端 未结 3 1410
逝去的感伤
逝去的感伤 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
    
    0 讨论(0)
  • 2021-02-07 01:20

    Very simple solution. Just rename your database and configure your new database name in your project.

    The problem is the when you import your database, you got any errors and then the database will be corrupted. The log files will have the corrupted database name. You can rename your database easily using phpmyadmin for mysql.

    phpmyadmin -> operations -> Rename database to
    
    0 讨论(0)
  • 2021-02-07 01:24

    Its a common error which happens when we try to access a database which doesn't exist. So create the database using

    CREATE DATABASE blog_development;
    

    The error commonly occours when we have dropped the database using

    DROP DATABASE blog_development;
    

    and then try to access the database.

    0 讨论(0)
提交回复
热议问题