I'm running MySQL in Linux Red Hat 7. I've got an existing database, error.db
, which I copied over to my MySQL directory, and now I want to import it into MySQL. I found this guide which recommended using mysqldump
to export the database to an .sql file, which I can then source in the MySQL client.
So I tried the following:
$ mysqldump --socket=socket -u root -p error.db > error_db.sql
After entering the password, I received this error:
mysqldump: Got error: 1049: Unknown database 'error.db' when selecting the database
I'm definitely in the correct directory, error.db
definitely exists, and I've definitely typed the password in correctly. I've tried adding the -d flag and the --databases flag, and that hasn't worked. I've also tried using error
instead of error.db
, and that hasn't worked.
I've checked other questions and haven't found a working solution. This one, the problem was caused by a typo (which I know is not the case:) mysql export table but no database.
And this one was solved because the OP was putting the password in the command line, and apparently using the -p flag solved their problem (although as you can see, I'm using the -p flag and it's still not working:) MYSQL DBDump Error message
I'm using a Load Sharing Facility at work to run MySQL, but that hasn't stopped me from using another .sql file to load a database into MySQL, so I'm not sure whether that would make a difference.
EDIT: Per this question, I've tried using mysql
instead of mysqldump
, but still no luck:
mysql --socket=socket -u root -p error.db > error_db.sql
Enter password:
ERROR 1049 (42000): Unknown database 'error.db'
Any ideas what might be going wrong here?
EDIT 2: The error.db
database is in SQLite3. I had assumed that the database types would be cross-compatible, but probably this was an incorrect assumption. So I guess my question is how to convert an SQLite3 database to MySQL.