Install MySQL on EC2

procedure memo

install ubuntu mysql on ec2

install mysql-server and setup mysql privillege table via mysql_secure_installation.

sudo apt install nginx mysql-server
sudo mysql_secure_installation

step.2 create a new user

create a database and a user for the database with minimum permission.

Note: set charset to UTF8mb4 to store emoji

sudo mysql -u root -p

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';

CREATE DATABASE 'database' character set UTF8mb4 collate utf8mb4_bin;

GRANT ALL PRIVILEGES ON database.* TO 'username'@'localhost' WITH GRANT OPTION;

step.3 install php

sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip

step.4 download wordpress

cd /tmp
curl -O https://wordpress.org/latest.tar.gz
mv wp-config-sample.php wp-config.php

## open the link below to generate salt
chrome https://api.wordpress.org/secret-key/1.1/salt/

step.5 setup nginx

  • default.conf
  • php-fpm unix domain socket

ref

https://stackoverflow.com/questions/25774975/unable-to-start-php-fpm-cannot-get-uid-for-user-apache

Commits

2022-11-27 00:25:35897b048fupdate remark-custom-container to 1.2.0
commit 897b048fe31450b5d4f6545855125b76492f9066
Author: koka &>
Date:   Sun Nov 27 00:25:35 2022 +0900

  update remark-custom-container to 1.2.0
  
  fix

diff --git a/_posts/2019-02-20-setup_ubuntu_mysql.md b/_posts/2019-02-20-setup_ubuntu_mysql.md
index 77b7437..01e440f 100644
--- a/_posts/2019-02-20-setup_ubuntu_mysql.md
+++ b/_posts/2019-02-20-setup_ubuntu_mysql.md
@@ -24,7 +24,9 @@ sudo mysql_secure_installation
create a database and a user for the database with minimum permission.

::: tip
+
Note: set charset to `UTF8mb4` to store emoji
+
:::

\```sql
2021-01-30 22:18:1735b550aecopy md
commit 35b550ae83af4efaeadf33471c8ca8a32c1079c8
Author: koka &>
Date:   Sat Jan 30 22:18:17 2021 +0900

  copy md

diff --git a/_posts/2019-02-20-setup_ubuntu_mysql.md b/_posts/2019-02-20-setup_ubuntu_mysql.md
new file mode 100644
index 0000000..77b7437
--- /dev/null
+++ b/_posts/2019-02-20-setup_ubuntu_mysql.md
@@ -0,0 +1,63 @@
+---
+title: 'Install MySQL on EC2'
+date: 2019-02-20
+categories:
+  - memo
+tags:
+  - AWS
+  - installation
+  - MySQL
+description: procedure memo
+---
+
+## install ubuntu mysql on ec2
+install `mysql-server` and setup mysql privillege table via `mysql_secure_installation`.
+
+\```sh
+sudo apt install nginx mysql-server
+sudo mysql_secure_installation
+
+\```
+
+
+## step.2 create a new user
+create a database and a user for the database with minimum permission.
+
+::: tip
+Note: set charset to `UTF8mb4` to store emoji
+:::
+
+\```sql
+sudo mysql -u root -p
+
+CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
+
+CREATE DATABASE 'database' character set UTF8mb4 collate utf8mb4_bin;
+
+GRANT ALL PRIVILEGES ON database.* TO 'username'@'localhost' WITH GRANT OPTION;
+\```
+
+## step.3 install php
+
+\```sh
+sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
+\```
+
+## step.4 download wordpress
+
+\```
+cd /tmp
+curl -O https://wordpress.org/latest.tar.gz
+mv wp-config-sample.php wp-config.php
+
+## open the link below to generate salt
+chrome https://api.wordpress.org/secret-key/1.1/salt/
+\```
+
+## step.5 setup nginx
+- default.conf
+- php-fpm unix domain socket
+
+
+## ref
+https://stackoverflow.com/questions/25774975/unable-to-start-php-fpm-cannot-get-uid-for-user-apache