Connect to RDS MySQL instance from ec2 Linux AMI - mysql command not found
Solution 1
When using Amazon Linux 2 AMI, we need to install mysql. Use this command to install mysql on the instance:
sudo yum install mysql
And then you can connect using this command:
mysql -h change-to-your-rds-endpoint.rds.amazonaws.com -u <USER> -p
Solution 2
Install mysql client on AWS Linux EC2:
$ sudo yum install mysql
Connect:
$ mysql -h endpoint -P port -u masteruser -p
If you enter your password and nothing happens, check your security groups. You may need to edit your inbound rules.
Solution 3
First install mysql into your ec2 instace using below command
sudo apt-get install mysql-server mysql-client
After installing mysql try with below cmd to connect RDS
mysql -h hostname -u username - p password
Solution 4
You'll need to install MySQL. Amazon AMIs use yum instead of apt so use:
sudo yum install mysql-server mysql-client
if you are working to setup a LAMP (Linux, Apache, MySQL, PHP) server then follow these instructions http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html
theyuv
New to programming. Learning/working on java web application using Java, Javascript, mysql, Tomcat.
Updated on June 06, 2022Comments
-
theyuv almost 2 years
I try to connect to my RDS MySQL instance from an SSH connection to my ec2 server (through PUTTY) as outlined here: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ConnectToInstance.html#USER_ConnectToInstance.CLI
But I get:
-bash: mysql: command not found
I think maybe I have to install the MySQL Utility client on my ec2 linux server? If this is the case how do I do this?
I try to run the
mysql
command from my/home/ec2-user
directory. -
theyuv over 8 yearsI'm using centOS so I think my command is
yum install mysql
. Also, I had to install all of mysql in order to get the mysql client. Isn't that a bit wasteful? -
WesternGun over 5 yearsjust install
mariadb
. That would be enough. No need to install the server.