How to install mysql client on Amazon linux 2

If you are using Amazon Linux 2 (AMI) based on RedHat and want to connect to a remote database using mysql-client it, then here is the way to not only install the client but also to use AMI CLI to manage cloud databases services of Amazon such as RDS and Lightsail database service.

Install MySQL client on Amazon Linux 2

  • On the AMI command line, first-run system update: yum update
  • Now, install MySQL client on Amazon Linux 2 using this syntax- yum install mysql
  • Check installed MySQL/MariaDB versionmysql --version
  • Connect to AWS RDS, Lightsail database service, or any other database using MySQL-client
    mysql -u database_user -p -h host_name or Ip-address  
  • Example
    mysql -u root -p -h

Other Examples-

You can also use the client to connect some database running on any other server using IP-address

mysql -u root  -p -h

If you are running MySQL on some custom port then you have to mention the port number as well, for example

mysql -u root  -p -h --port 3307 --protocol=TCP

MySQL client on Amazon Linux 2



Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.