DEV Community


Installing the MySQL CLI on an EC2 Instance

thomasstep profile image Thomas Step Originally published at on ・1 min read

The other day I spun up an RDS cluster in a VPC and wanted to connect to it to make sure everything looked correctly configured. However, since I put the cluster in a private subnet and only allowed connections from the VPC, I was not able to connect from my desktop. The solution I decided to go for was spinning up a small EC2 instance, SSHing into the EC2 instance, and connecting to my database through the CLI. Unfortunately, the default AMI does not come with the mysql CLI installed. Here is how I installed it.

$ sudo yum install -y
$ sudo yum install -y mysql-community-client
$ mysql -u MY_USER -p`MY_PASSWORD` -h MY_HOST -P 3306
mysql> show databases;

Enter fullscreen mode Exit fullscreen mode

After installing and connecting to my database, I was able to confirm that everything was up an running.

Discussion (0)

Forem Open with the Forem app