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 an ECS instance that runs CentOS 8.
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 wizard.
Background information
In this topic, the following instance type and software versions are used. The operations
may vary based on the versions of your software.
- Instance type: ecs.c6.large (two vCPUs and 4 GiB memory)
- Operating system: the CentOS 8.2 64-bit public image
- MySQL: 8.0.21
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: Install MySQL
Step 2: Configure MySQL
Step 3. Remotely access the MySQL database
We recommend that you use an account other than root user to remotely access the MySQL database. In this example, a MySQL account is created to remotely access MySQL.