阿里云RDS导入功能只支持最大为100M的脚步导入,如果sql脚步超过这个大小怎么导入呢?下面介绍一种方法可以支持超大sql脚本导入:那就是通过本地服务器把脚步导入到远处RDS数据库(本人实测,导入4.8G的sql脚本文件)。
步骤 :
1 登录可以通过内网访问RDS的云服务器ECS,并将sql脚本文件通过ftp上传到root目录下。
当然也可以通过本地Linux服务器,此处推荐阿里云ECS是因为内网可以访问,阿里内网为千兆带宽,上传或导入脚本速度比较快。
2 安装mysql,如:
apt-get install mysql-client-5.6
3 连接远程服务器,输入密码登录,如下命令:
mysql -h host –u userName -p dbName
host:RDS访问路径,
userName
:数据库访问用户名 ,dbName
:需要导入sql脚本的数据库名称
具体参考如下显示:
mysql -h host –u userName -p dbName
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 235196939
Server version: 5.6.29 Source distribution
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
4 导入sql脚本
mysql>
sorce /root/test.sql