LoginSignup
2
2

More than 5 years have passed since last update.

【導入】データベース(MariaDB) - CentOS 7

Posted at

インストール

パッケージをインストールする。

$ sudo yum -y install mariadb-server mariadb-devel

セットアップ

サーバのパラメータを変更する。

$ sudo vi /etc/mysql/server.cnf
--- server.cnf.org      2015-08-23 02:08:25.576869647 +0900
+++ server.cnf  2015-08-23 02:06:47.233860950 +0900
@@ -11,6 +11,29 @@
 # this is only for the mysqld standalone daemon
 [mysqld]

+#
+# Tuning
+#
+max_allowed_packet     = 32MB
+
+#
+# InnoDB
+#
+innodb_file_format     = Barracuda
+innodb_file_per_table  = 1
+innodb_additional_mem_pool_size        = 20MB
+innodb_buffer_pool_size        = 512MB
+innodb_log_buffer_size = 64MB
+innodb_log_file_size   = 10MB
+
+#
+# * UTF 8 Settings
+#
+init-connect           = SET NAMES utf8
+character_set_server   = utf8
+collation_server       = utf8_general_ci
+skip-character-set-client-handshake
+
 # this is only for embedded server
 [embedded]

コマンドラインツールのパラメータを変更する。

$ vi /etc/mysql/mysql-clients.cnf
--- mysql-clients.cnf.org       2014-12-19 19:57:31.000000000 +0900
+++ mysql-clients.cnf   2015-08-23 01:52:30.219840564 +0900
@@ -4,6 +4,7 @@
 #

 [mysql]
+default_character_set  = utf8

 [mysql_upgrade]

@@ -14,6 +15,7 @@
 [mysqlcheck]

 [mysqldump]
+default_character_set  = utf8

 [mysqlimport]

サービスを有効にする。

$ sudo systemctl enable mariadb.service

サービスを起動する。

$ sudo systemctl start mariadb.service

サービスの起動状態を確認する。

$ systemctl status mariadb.service
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2