您的位置:首页 > 数据库

sql文件导入阿里云RDS数据库操作

2018-03-06 11:20 519 查看
阿里云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
:数据库访问用户名 ,[code]dbName
:需要导入sql脚本的数据库名称[/code]
具体参考如下显示:

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>



rds中该ip处于黑名单中,此时无法进行此操作。

4 导入sql脚本
mysql>
sorce /root/test.sql
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mysql 阿里云rds