This time we will build a server with EC2. The contents of the first part are assumed, so please check if you haven't done so yet. This time, we will describe the essential software such as node.js and Ruby in EC2 as if they have already been installed. https://qiita.com/kotobuki562/items/57ffbaadad8ec8d16a4f
This time we will use MariaDB. This is because the instance is running on Amazon Linux 2. You can think of it as a derivative of MYSQL.
Enter the following command to install the database. MariaDB can be installed with the yum command.
[ec2-user@ip-111-11-11-111 ~]$ sudo yum -y install mysql56-server mysql56-devel mysql56 mariadb-server mysql-devel
Start MariaDB with the systemctl command.
[ec2-user@ip-111-11-11-111 ~]$ sudo systemctl start mariadb
Let's check if it is started with the status command.
[ec2-user@ip-111-11-11-111 ~]$ sudo systemctl status mariadb
If "active (running)" is displayed in green letters, it is successful.
By default, the user name is "root", but you can set the password yourself. When you execute the following command, you will be asked various yes / no, so answer yes. When "New password:" is displayed, enter the password you have decided. Make a note so that you do not forget it.
[ec2-user@ip-111-11-11-111 ~]$ sudo /usr/bin/mysql_secure_installation
Let's connect to the database when we're done. After confirming the connection, let's exit with "exit".
[ec2-user@ip-111-11-11-111 ~]$ mysql -u root -p
This completes the EC2 database design. Next time, I would like to describe how to actually register and deploy the SSH key on GitHub.
Recommended Posts