导出Mysql
# 导出数据和表结构
/usr/local/mysql/bin/mysqldump -h127.0.0.1 -uroot -p yphp_tutiantian > /data/yphp_tutiantian.sql
# 导出表结构
/usr/local/mysql/bin/mysqldump -h127.0.0.1 -uroot -p -d yphp_tutiantian > /data/yphp_tutiantian.sql
导入Mysql
# 登录Mysql
/usr/local/mysql/bin/mysql -h127.0.0.1 -uroot -p
# 选择需要导入的数据库
mysql> use yphp_tutiantian;
# 导入SQL文件到数据库
mysql> source yphp_tutiantian.sql;
创建新用户并赋权限
# 添加账户 ggt_zs
CREATE USER 'ggt_zs'@'%' IDENTIFIED BY 'e416653a78de78d9bb6a30df1a87f6c0';
# 给账户赋权限( ganggangtong 表的所有权限 )
GRANT ALL ON `ganggangtong`.* TO 'ggt_zs'@'%';