[RUBY] Procedure for publishing an application using AWS (4) Creating a database

Introduction

I will describe the procedure to publish the application using AWS. In this article, we will create a database.

Create a database

Create a database to save the data of the WEB application.

Database type

The types of databases are as follows.

--Hierarchical database --Network database --Relational database

The most used of these is the relational database. Software that manages relational databases is called a relational database management system (RDBMS). MySQL is one of the RDBMS. MySQL is an RDBMS developed and provided by Oracle, which allows you to create, edit, and delete databases. It is released as open source software and anyone can use it free of charge. Since it can be used together with Ruby on Rails, in this article we will create a database using MySQL.

Install MySQL

Execute the following command to install MySQL. This time install version 5.6.

sudo yum -y install mysql56-server mysql56-devel mysql56

Start MySQL

Execute the following command to start MySQL.

sudo service mysqld start

Execute the following command, and if "running" is displayed, it can be started successfully.

sudo service mysqld status

What is the service command?

A command that can be used on UNIX (Linux, Mac, etc.) to start and stop services.

What is mysqld

The above command is mysqld instead of mysql, with a "d" at the end. This d is an abbreviation for the Linux term "daemon" and means "server".

MySQL password setting

By default, the installed MySQL can be accessed as the root user, Since the password has not been set, set the password. For example, to set the password to'AbCdEf1234', execute the following command.

sudo /usr/libexec/mysql56/mysqladmin -u root password 'AbCdEf1234'

MySQL connection check

Execute the following command and check if you can connect to MySQL. You will be asked to enter the password, so enter the password you set earlier. OK if no error occurs.

mysql -u root -p

About MySQL command options

The options of the above MySQL command have the following meanings.

-u.Specify user name
-p.Password specification

Related article

Procedure to publish application using AWS (1) Create AWS account Procedure to publish application using AWS (2) Create EC2 instance [How to publish an application using AWS (3) EC2 instance environment construction] (https://qiita.com/osawa4017/items/8dc09203f84e04bf0e66) [Procedure to publish application using AWS (5) Publish application] (https://qiita.com/osawa4017/items/6f3125fcc21f73024311) [Procedure to publish application using AWS (6) Install Nginx] (https://qiita.com/osawa4017/items/9b707baf6ddde623068c)

Recommended Posts

Procedure for publishing an application using AWS (4) Creating a database
Procedure for publishing an application using AWS (5) Publish an application
Procedure for publishing an application using AWS (6) Introduce Nginx
Procedure for publishing an application using AWS (7) Automatic deployment by Capistrano
[For beginners] Procedure for creating a controller using rails
A memorandum for creating an extended logger using org.slf4j.Logger
Creating a 2021 weekly calendar (refill for personal organizer) using Ruby
Explanation of Ruby on rails for beginners ③ ~ Creating a database ~
Procedure for building a Rails application development environment with Docker [Rails, MySQL, Docker]
How to publish an application using AWS (3) EC2 instance environment construction
Procedure for building an authorization server using Authlete (CIBA compatible version)
Creating an InputAccesorryView for sending messages
About creating an application with springboot
# 1 [Beginner] Create a web application (website) with Eclipse from knowledge 0. "Let's build an environment for creating web applications"
Creating a java web application development environment with docker for mac part1
Deploy a Node.js application to an ECS instance using the Cloud Toolkit
A memorandum for android application development beginners
Creating a user authentication function using devise
AdMob setting procedure for Android application (December 2016)
Rails Basics of creating a new application
Send an email using JavaMail on AWS
Creating a sample program using the problem of a database specialist in DDD Improvement 2
Creating a sample program using the problem of a database specialist in DDD Improvement 1
Create an animation in which characters emerge for a moment using molecular dynamics
From creating a Spring Boot project to running an application with VS Code