开启远程连接

vim /etc/mysql/mysql.conf.d/mysqld.cnf
用#注释掉bind-address = 127.0.0.1

添加新用户的方法

grant all privileges on *.* to test@"%" identified by "0" with grant option;
test是新用户名, %表示任意主机

连接数据库

mysql -u me -p0 -h192.168.237.130

数据库复制

mysqldump databaseName -u root-pPassword --add-drop-table -h host | mysql newDBName -u root -pPassword -h host;

备份和恢复

mysqldump -uroot -proot --all-databases > my.sql
`mysql -uroot -proot -h host < my.sql```