Amazon Linux AMI install mysql client programs for RDS

ADVERTISEMENTS



Amazon Linux AMI install mysql programs using yum

How do I install mysql command for management Amazon RDS or Managed Databases for Amazon Lightsail on Amazon Linux AMI?Amazon has its own Linux distribution called Amazon Linux AMI. It is mostly binary compatible with Red Hat Enterprise Linux, and therefore CentOS Linux. This page explains how to install mysql client programs on Amazon Linux AMI for managing databases (RDS and Lightsail database service) in the cloud from the CLI.

The procedure is as follows:

Update your system by running: sudo yum update Install mysql client on Amazon Linux AMI by typing sudo yum install mysql57 Install existing client, run: sudo yum install mysql57 Test your setup by connecting to RDS

Let us see all commands and examples in details.

Find mysql client on Amazon Linux AMI

Use the following yum command:

sudo yum search mysql5

sudo yum list mysql5?



Let us find out a description and summary information about package named mysql57.x86_64

sudo yum info mysql57.x86_64

sudo yum info mysql57

Sample outputs:

Available Packages Name : mysql57 Arch : x86_64 Version : 5.7.27 Release : 1.13 .amzn1 Size : 14 M Repo : amzn-updates/latest Summary : MySQL client programs and shared libraries URL : http://www.mysql.com License : GPLv2 with exceptions and LGPLv2 and BSD Description : MySQL is a multi-user, multi-threaded SQL database server. MySQL is a : client/server implementation consisting of a server daemon ( mysqld ) : and many different client programs and libraries. The base package : contains the standard MySQL client programs and generic MySQL files. Available Packages Name : mysql57 Arch : x86_64 Version : 5.7.27 Release : 1.13.amzn1 Size : 14 M Repo : amzn-updates/latest Summary : MySQL client programs and shared libraries URL : http://www.mysql.com License : GPLv2 with exceptions and LGPLv2 and BSD Description : MySQL is a multi-user, multi-threaded SQL database server. MySQL is a : client/server implementation consisting of a server daemon (mysqld) : and many different client programs and libraries. The base package : contains the standard MySQL client programs and generic MySQL files.

Install MySQL client programs and shared libraries

Now you know how to search and list mysql client program. Therefore go ahead and type the following command to install the same:

sudo yum update

sudo yum install mysql57



Verify installation

Type the following command:

mysql --version

Sample outputs:

mysql Ver 14.14 Distrib 5.7.27, for Linux (x86_64) using EditLine wrapper

The syntax is s follows for connection:

mysql -u {db_user} -p -h {host_name_here} {db_name_here}

How do I connect to RDS or Lightsail database service?

Using mysql is very easy. Invoke it from the shell prompt. In this example, connect to RDS:

mysql -u {User_name} -p -h {RDS_End_Point} {DB_NAME}

mysql -u mydbuser -p -h xyz.us-east-1.rds.amazonaws.com



Where mysql command options are as follows:,

-u : User name for login for AWS RDS cloud database server

: User name for login for AWS RDS cloud database server -p : Password to use when connecting to RDS server

: Password to use when connecting to RDS server -h : Connect to given RDS host or endpoint

: Connect to given RDS host or endpoint {DB_NAME} : Specify RDS database name

Conclusion

You learned how to install the mysql client package using the CLI methods on Amazon Linux AMI based systems running on AWS cloud EC2 or Lightsail server. See the Amazon RDS page for more information.