Abstract:

preface

Ali Cloud data management, also known as THE RDS management tool of Ali Cloud, has been mentioned before. Because I prefer to use GUI management tools, so I have been using phpMyAdmin, but if you do not use PHP environment, like installing a Ghost blog will not use PHP environment at all, at this time very awkward. That’s when DMS came to mind.

Here’s how to install MariaDB and set up posture to use DMS.

To prepare

The cloud wing plan

Student users can purchase ECS with certain configuration after student authentication on aliyun official website, only 9.9 yuan per month, student users do not need to worry about spending too much on the server.

User after students after the certification can be in the related website to buy, address: promotion.aliyun.com/ntms/campus… , bought a good server can go to just registered account management in the management console to view the server and some of its configuration.

The remote control

To prepare, refer to the following tutorial:

【 cloud computing 1024 kinds of play 】 Use DMS as long as a browser easy operation and maintenance tasks 【 cloud computing 1024 kinds of play 】ECS and lightweight application server remote control introduction

The installation

For a detailed installation and administration tutorial, see Ubuntu Installing MariaDB Server.

Suitable for:

Ubuntu 14.04 LTS (Trusty) supports 5.5 to the latest Ubuntu 16.04 LTS (Xenial) supports 10.0 to the latest

This tutorial uses version 10.2 as an example. For other versions, just change 10.2 below to 10.1 10.0 5.5

apt update
apt install software-properties-common -y

apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
add-apt-repository 'deb [arch = amd64, i386, ppc64el] http://mirrors.tuna.tsinghua.edu.cn/mariadb/repo/10.2/ubuntu xenial main'
apt update
apt install mariadb-server -yCopy the code





During the installation, the system prompts you to set the database Root password. You need to enter the password twice.

Security Settings

Enter the following command to turn off some unsafe Settings:

mysql_secure_installation  Copy the code

Enter current password for root (enter for none):

Note: Enter the password of user root, which is empty by default, and press Enter.

Set root password? [Y/n] y

Do you want to set the root password? Type n. I already have a password.

Remove anonymous users? [Y/n] y

Explanation: Do you want to remove anonymous users? Type y for yes.

Disallow root login remotely? [Y/n] y

Don’t want root to log in remotely? Enter n to indicate no. DMS is the remote login of user root.

Remove test database and access to it? [Y/n] y

Explanation: Do you want to remove the test database? Type y for yes.

Reload privilege tables now? [Y/n] y

Explanation: Want to reload permissions? Type y for yes.

Disallow root Login remotely? It is recommended for novice users to enter n to allow DMS to be managed through the root account, which naturally raises certain security risks. I will explain how to avoid them later. Advanced play will naturally separate account open remote, but so difficult also up.

Remote connection setup

Server firewall

Ubuntu has a uFW firewall by default. Let’s open port 3306:

ufw allow mysqlCopy the code

Open the remote connection of the account

First, we need to log in to MariaDB from the command line:

mysql -u root -pCopy the code

You will then need to enter the root password, which is hidden, not that it has not been entered.

Then run:

GRANT ALL PRIVILEGES ON *.* TO 'root'@The '%' IDENTIFIED BY 'root password' WITH GRANT OPTION;
FLUSH PRIVILEGES;Copy the code

How do I exit the MySQL command line?

Enter the content, don’t forget; No. :

quit;Copy the code

Database setup

Modify the /etc/mysql.my.cnf file

On line 47, change bind-address = 127.0.0.1 to:

bind- the address = 0.0.0.0Copy the code

Otherwise, the database can only be accessed locally. Restart the database to take effect

service mysql restartCopy the code

The security group

Enter the ECS instance security group and add the rule:

Protocol type select: MySQL authorization object

For a private network (VPC) enter:

100.104.175.0/24100104. 72.0/24100104. 5.0/24100104. 205.0/24Copy the code

For a classic network type:

,10.153 121.43.18.0/24120.55. 177.0/24,10.137. 42.136/24, 176.106/24Copy the code

In this way, our port 3306 is only open to THE IP of DMS, so that it will not be connected by other malicious IP addresses and can avoid certain security problems.

DMS connection

Access the DMS console: dms.console.aliyun.com/#/dms/rsLis…

Click Add Database:

Corresponding input relevant data:

The ECS instanceID is the instanceID of the ECS:

OK, click login, of course:

Then we get to DMS, which is no less powerful than phpMyAdmin and much more intuitive.

As for how to play DMS due to space constraints, I look forward to explaining it later ~