ERROR 1049 (42000): Unknown database 'mydatabasename'

后端 未结 12 1279
故里飘歌
故里飘歌 2020-12-14 07:27

I am trying to restore database from .sql file , i have created the database in phpmyadmin and also using the create if not exist command in the .sql file which i am restori

12条回答
  •  时光说笑
    2020-12-14 07:52

    Whatever the name of your dump file, it's the content which does matter.

    You need to check your mydatabase.sql and find this line :

    USE mydatabasename;
    

    This name does matter, and it's the one you must use in your command :

    mysql -uroot -pmypassword mydatabasename

    Two options for you :

    1. Remove USE mydatabasename; in your dump, and keep using :
      mysql -uroot -pmypassword mydatabase
    2. Change your local database name to fit the one in your SQL dump, and use :
      mysql -uroot -pmypassword mydatabasename

提交回复
热议问题