ERROR 1049 (42000): Unknown database, localized Wordpress database

mysql, mysql-workbench, wordpress

Solution

Apparently the export was done without specifying a database (schema), so you have to create it manually first before you can import the dump. MySQL Workbench allows to import a dump to a different (including a new) schema. You can specify this on the import page:

Problem

I'm moving my wordpress website to local for testing purpose. I encountered the error below when I'm trying to import the .sql that I export from CPanel PHPMyadmin into local MYSQL Workbench. FYI, I'm using MYSQL Workbench 6.0 and MYSQL Administrator 1.2.17 ``` 15:08:07 Restoring C:\Users\abc\Desktop\db.sql Running: mysql.exe --defaults-extra-file="c:\users\abc\appdata\local\temp\3\tmpdemide.cnf" --host=localhost --user=root --port=3307 --default-character-set=utf8 --comments --database=db < "C:\\Users\\abc\\Desktop\\db.sql" ERROR 1049 (42000): Unknown database 'db' Operation failed with exitcode 1 15:08:08 Import of C:\Users\abc\Desktop\db.sql has finished with 1 errors ```

Original source