Move MySQL database to a new server

前端 未结 3 1288
孤独总比滥情好
孤独总比滥情好 2021-01-04 06:43

What\'s the easiest way to move mysql schemas (tables, data, everything) from one server to another?

Is there an easy method move all this from one server running my

3条回答
  •  孤街浪徒
    2021-01-04 07:22

    If you are using SSH keys:

    $ mysqldump --all-databases -u[user] -p[pwd] | ssh [host/IP] mysql -u[user] -p[pwd]
    

    If you are NOT using SSH keys:

    $ mysqldump --all-databases -u[user] -p[pwd] | ssh user@[host/IP] mysql -u[user] -p[pwd]
    

    WARNING: You'll want to clear your history after this to avoid anyone finding your passwords.

    $ history -c
    

提交回复
热议问题