用mysqldump导出数据,用scp导入数据
1、用mysqldump导出数据
mysqldump -h110.42.229.xxx -uroot -p --databases uniteuser > uniteuser.sql
2、用scp来导出到另一台服务器
scp -p 32022 client.tar 114.116.xxx.xxx:/home/
3、进入mysql
mysql -h110.42.229.xxx -uroot -p
4、source /home/examuser/apps/swcp.sql
修改mysql的root登陆权限
1、去 vi /etc/my.cnf 增加 skip-grant-tables(这一步在root用户登陆不上时执行)
2、重启mysql (后面的根据实际情况)
systemctl restart mariadb
3、user的登陆权限
select Host,user,authentication_string from mysql.`user`;
里面有% localhost 可以本机登录
4、修改root的登陆权限
update user set host='localhost' where user='root' and host='::1';
5、exit
6、把vi /etc/my.cnf 中的 skip-grant-tables 去掉
7、重启mysql (后面的根据实际情况)
systemctl restart mariadb