We help IT Professionals succeed at work.

Restore Of MySQL/MariaDB using MySQLDump does not work

G F
G F asked
on
Hi,

I'm running MariaDB with HeidiSQL management software, and I want to move my databases to another system, using the same version of MariaDB and Heidi.

I'm using mysqldump to copy the database, and using this command:


C:\Program Files\MariaDB 10.4\bin>mysqldump -u root -p bbb > d:\database\bds2.sql





However when I want to restore, it seems to work okay, the command runs, but when I check Heidi, the tables are not there.  I use this command to restore:


C:\Program Files\MariaDB 10.4\bin>mysqldump -u root -p bbb < d:\database\bds2.sql


The database on the target system has a database named bbb, though a different pw than the original host.
I've restarted the mariadb service and the Heidi software, just in case there was a glitch but there is nothing.

My development system was Windows 10 and the target system is Windows 7.

The size of the backup file is about 27Kb, and in Heidi the empty tables are about 450Kb.

The Mysqldump restore does have an output when run, like a Header with information like the Host and DB server and Maria version number, then it has a couple dozen lines about 'SET'.  It doesn't say anything other than that.

Am I missing something on the backup and restore?  Should I use something different?

Thank you in advance!
Comment
Watch Question

Software Engineer
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
mysqldump creates an SQL script that needs to be run through mysql to restore...


mysql  -u root -p bbb   d:\database\dbs2.sql

should work...
G FGeneral Manager

Author

Commented:
Thank you noci!

That worked great!
The tables are all there. :)
nociSoftware Engineer
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
The set options are all comments for regular SQL, they ARE interpreted by mysql command depending on versions of mysql.. where they can make a difference and mysqldump still delivers a valid .SQL script.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.