1 创建RDS数据库
点击创建数据库
引擎选项
模板
设置
连接
2 EC2连接Mysql
$ sudo yum list mariadb*
Installed Packages
mariadb-connector-c.x86_64 3.1.13-1.amzn2023.0.3 @amazonlinux
mariadb-connector-c-config.noarch 3.1.13-1.amzn2023.0.3 @amazonlinux
mariadb105.x86_64 3:10.5.23-1.amzn2023.0.1 @amazonlinux
mariadb105-backup.x86_64 3:10.5.23-1.amzn2023.0.1 @amazonlinux
mariadb105-common.x86_64 3:10.5.23-1.amzn2023.0.1 @amazonlinux
mariadb105-cracklib-password-check.x86_64 3:10.5.23-1.amzn2023.0.1 @amazonlinux
mariadb105-errmsg.x86_64 3:10.5.23-1.amzn2023.0.1 @amazonlinux
mariadb105-gssapi-server.x86_64 3:10.5.23-1.amzn2023.0.1 @amazonlinux
mariadb105-server.x86_64 3:10.5.23-1.amzn2023.0.1 @amazonlinux
mariadb105-server-utils.x86_64 3:10.5.23-1.amzn2023.0.1 @amazonlinux
Available Packages
mariadb-connector-c-devel.x86_64 3.1.13-1.amzn2023.0.3 amazonlinux
mariadb-connector-c-test.x86_64 3.1.13-1.amzn2023.0.3 amazonlinux
mariadb105-connect-engine.x86_64 3:10.5.23-1.amzn2023.0.1 amazonlinux
mariadb105-devel.x86_64 3:10.5.23-1.amzn2023.0.1 amazonlinux
mariadb105-oqgraph-engine.x86_64 3:10.5.23-1.amzn2023.0.1 amazonlinux
mariadb105-pam.x86_64 3:10.5.23-1.amzn2023.0.1 amazonlinux
mariadb105-rocksdb-engine.x86_64 3:10.5.23-1.amzn2023.0.1 amazonlinux
mariadb105-sphinx-engine.x86_64 3:10.5.23-1.amzn2023.0.1 amazonlinux
mariadb105-test.x86_64 3:10.5.23-1.amzn2023.0.1 amazonlinux# sudo yum install -y mariadb105-server.x86_64# mysql -h database1.xxxxxxxxx.us-east-2.rds.amazonaws.com -uadmin -p12345678
> show databases;
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 26
Server version: 8.0.35 Source distributionCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MySQL [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| test |
+--------------------+
5 rows in set (0.001 sec)
注意:如果多次创建连接同一个EC2实例,每次EC2实例会创建一个安全组,EC2的安全组只能有五个,超过五个就连接不上了。