scp /data/wwwroot/xglnew/xgl/ root@xx.xx.xx.xxx:/home/wwwroot/default/xgl
出现错误提示: scp: /usr/tools: not a regular filehtml
解决方法: scp加上 -r 参数mysql
scp -r /data/wwwroot/xglnew/xgl/ root@xx.xx.xx.xxx:/home/wwwroot/default/xglnginx
把数据库导入到新的服务器,发现用navicat 连接不上(2003),而在服务器上能够经过mysql -uroot -p 链接上,首先想到的修改mysql 和 开放3306端口。sql
从服务器进入mysql数据库
mysql> use mysql Database changed mysql> select host,user from user; +-----------+------+ | host | user | +-----------+------+ | xxxxx | root | | 127.0.0.1 | root | | ::1 | root | +-----------+------+ 4 rows in set (0.00 sec)
修改root 帐号,使root 能够远程访问mysql。centos
执行:安全
GRANT ALL PRIVILEGES ON *.*TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION; # 修改权限 #第一个* 表示数据库 第二个* 表示权限 #% 表示的是全部的ip #只给用户一个cas的数据库 flush privileges; # 刷新mysql权限表
我用的是centos 版本,防火墙是Firewall,没有安装iptables。服务器
1. firewall-cmd --zone=public --add-port=3306/tcp --permanent #开放3306 端口 2 firewall-cmd --reload #从新载入
通过以上两步,就当我满心欢喜的觉得能够了时,结果navicat 仍是连接不上,报2003。找问题找了很久0.0, 最后用telnet链接端口: telnet xx.xx.xxx.xx 3306 竟然提示 拒绝? 再次查看3306 端口是否开放tcp
[root@izwz9938t1plpjzo15letsz card]# firewall-cmd --zone=public --query-port=80/tcp yes
已经开放了,索性先把防火墙关闭,测试
systemctl stop firewalld
查看防火墙状态:
[root@izwz9938t1plpjzo15letsz card]# firewall-cmd --state not running
然而仍是连接不上,到这一步真的快怀疑人生了。 后来查阅资料猛然看到这一句话:
因而让主管看一下阿里云的安全组,主管直接甩给了帐号密码0.0。 而后在安全组里配置了3306端口, 测试
[root@izwz9938t1plpjzo15letsz card]# telnet xx.xxx.xx.xxx 3306 Trying 39.108.66.218... Connected to 39.108.66.218. Escape character is '^]'. N 5.6.36-log£Y7E3nT9^QXIBOFO<|!(Emysql_native_passwordConnection closed by foreign host.
额,终于能够了。
通过以上两步,3306端口已能远程链接,但navicat链接时又报1045 错误?这不是帐号密码有错误吗? 可我已经在服务器端能链接上了? 没办法,修改密码试试,
use mysql; update mysql.user set authentication_string=password('newpassword') where user='root';
奇迹出现了,navicat 能够链接上了。
ok,至此网站已成功迁移,并能够正常访问。
参考资料:
Centos7 防火墙相关操做: https://blog.csdn.net/weiyangdong/article/details/79540217
关于CentOS7 能够ping通 可是telnet没法链接上端口的问题http://www.javashuo.com/article/p-blxjhysq-ha.html
MySQL远程链接失败(错误码:2003) https://www.cnblogs.com/YunnuoFan/p/8482449.html