Reputation: 787
It's quite simple really, I just can't figure out the syntax.
I want to replicate my server setup on another server.
I can dump all my databases with
mysqldump -uroot -p --alldatabases > all.sql
But how do I import ALL of those into a brand new mysql setup on another server?
Upvotes: 1
Views: 2334
Reputation: 4077
if the database servers are both near enough the same version, you could simply rsync the /var/lib/mysql directory over.
rsync /var/lib/mysql [email protected]:/var/lib/ -a
Edit: Please note that there are some issues with this approach which require some additional steps: http://verens.com/2016/05/11/quick-method-to-clone-a-mysql-database/
Upvotes: -1
Reputation: 9
execute the dump file from shell (dump file should contain the CREATE DATABASE syntax)
mysql -uroot < /path/to/file.sql
or execute from mysql
source /path/to/file.sql
Upvotes: 0
Reputation: 2852
From command line:
mysql -uroot < all.sql
ps. If you want to see what statement is executed right now you should -v
.
Upvotes: 2
Reputation: 18572
mysql -u root -p
that command will open the mysql interactive console, where you'd do this:
source all.sql
Upvotes: 0