创建用户并授权
grant all privileges on test.* to "test"@"localhost" identified by "123"; #创建test库,并授权允许test用户可以访问
Mysql库导出
mysqldump -u 用户名 -p 目标数据库 > 数据库名.sql
MySQL库导入
mysql -u 用户名 -p 目标数据库 < 数据库名.sql
grant all privileges on test.* to "test"@"localhost" identified by "123"; #创建test库,并授权允许test用户可以访问
mysqldump -u 用户名 -p 目标数据库 > 数据库名.sql
mysql -u 用户名 -p 目标数据库 < 数据库名.sql
原文:https://www.cnblogs.com/luchuangao/p/8393854.html