mysql给对方的机器授权,使之能够访问自己的数据库,可以执行以下命令:

grant all privileges on *.* to 'root'@'目标ip' identified by 'password';

执行完成后,使用flush命令刷一下。
flush privileges;

 

导出:
mysqldump -h localhost -uroot -ppassword dbname> E:\20171121.sql

导入:
1. mysql -uroot -ppassword --max_allowed_packet=128M db_name < backup.sql(cmd目录下)
2. source backup.sql(在mysql 路径下)
3. \. backup.sql路径

mysql授权:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.22.28'IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;