Reputation: 5
I need to export MySQL database from public server and import it to development one after every content change and I'm trying to automate it with node.js. Is there any out of the box solution to generate .sql file like one created by phpmyadmin but without php or MySQL CLI?
Upvotes: 0
Views: 6112
Reputation: 254
I wouldn't recoment mysqldump because it produces too big a file. My phpMyadmin file was 5MB while mysqldump gave me 15MB. My DB size was small but for big data this could be a problem.
Upvotes: 0
Reputation: 38529
I've used the mysqldump node.js package before
From their documentation:
var mysqlDump = require('mysqldump');
mysqlDump({
host: 'localhost',
user: 'root',
password: '',
database: 'test',
dest:'./data.sql' // destination file
},function(err){
// create data.sql file;
})
This generates the .sql file - it's up to you where to put it / what to do with it however.
Upvotes: 2