導出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'@'%';