简体   繁体   中英

MYSQL database transfer using knex

const exec_string = 'mysqldump --user=abc--password=abc--host=localhost test | mysql --user=xyz--password=xyz --host=localhost new_test';
knex.raw(exec_string)
.then((res) => {
    console.log("res >>",res);
})
.catch((err)=>{
    console.log("err >>",err);
})

Here i have test database. i want transfer that database in new_test database using knex npm. If any other solution please suggest me.

Knex is not the right tool for this. Using exec or shelljs sounds like a good way to do this.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM