I'm moving a locally developed wordpress site to a client's server so I'm trying to export the local database and import it to the server. I exported the .sql file according to the instructions here http://codex.wordpress.org/Backing_Up_Your_Database but I keep getting this error when importing:
DROP TABLE IF EXISTS `wp_commentmeta` ;
MySQL said: Documentation
#1046 - No database selected
Any help very much appreciated. Thanks!
Like the two other answers say: I wasn't importing the backup file to a particular database. I had to create a new database and upload the file to that, and it worked fine.
Try sticking a use statement in front of it:
USE MyWordpressDBName;
DROP TABLE IF EXISTS `wp_commentmeta` ;
You posted a link describing how to backup your database. But the problem you have is not with the backup but with the restore , so you should look at the instructions on how to restore your database.
Luckily that site also has instructions on how to restore a database from a backup (any guide which only tells you how to backup but not how to restore is IMHO a waste of time). Try following the instructions on this page:
http://codex.wordpress.org/Restoring_Your_Database_From_Backup
In particular notice this command near the end of the tutorial:
mysql -h mysqlhostserver -u mysqlusername -p databasename < blog.bak.sql
The database name must be specified.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.