导出数据库:
mysqldump –uuser -ppassword -hhost databasename > target_20150225.sql
打包:
tar zcvf target_20150225.sql.tgz target_20150225.sql
到新的数据库里新建库:
Create databases target_database;
解压数据库文件:
Tar zxvf target_20150225.sql.tgz
导入数据库:
source /date/target_20150225.sql;
为指定用户赋予相应权限:
grant all privileges on target_database.* to 'user'@'%' identified by 'password' with grant option;
测试,用指定帐号登陆并执行show,select等语句
Use target;
Show tables;