MySQL is a relational database management system and is often used to build the LAMP or LNMP environment. This topic describes how to install, configure, and remotely access a MySQL database on a Alibaba Cloud Linux ECS instance.
Prerequisites
- An Alibaba Cloud account is created. To create an Alibaba Cloud account, go to the account registration page.
- To use ECS instances that are located in mainland China regions, make sure that you have completed real-name verification for your account.
- An ECS instance is created. For more information, see Create an instance by using the provided wizard.
Background information
- Instance type: ecs.c6.large (two vCPUs and 4 GiB memory)
- Operating system: Alibaba Cloud Linux 2.1903 LTS 64-bit public image
- MySQL: 5.7.31
In this example, the following MySQL installation paths are used:
- Configuration file: /etc/my.cnf
- Data storage: /var/lib/mysql
- Command files: /usr/bin and /usr/sbin
- Port: 3306
Note You must add inbound rules to the security group associated with the ECS instance and allow inbound traffic on port 3306. For more information, see Add security group rules.
Step 1. Prepare the environment
Connect to your ECS instance. For more information, see Connect to a Linux instance by using an SSH key pair or Connect to a Linux instance by using a username and password.
Step 2: Install MySQL
Step 3. Configure MySQL
Step 4. Remotely access the MySQL database
You can use a database client or Data Management Service (DMS) provided by Alibaba Cloud to remotely access the MySQL database. In this topic, DMS is used to show how to remotely access the MySQL database.