import remote database into localhost

2019-06-14 18:30发布

问题:

I was figuring out how to import and export mysql databases without using an intermediary file .

回答1:

Came ascross this:

mysqldump -hremote_server.com -uuser -psome_pawd database_name | mysql -hlocalhost -uuser - psome_pawd database_name

here, the remote database dump is an input to the localhost which can be remote server too. So, server to server import and export happen here without using an intermediary file.

Note: If you wanna backup, u need to have an intermediary file