前回、MariaDB 10.1.16 のリビルドが正常に終了したので

MariaDB 10.1.16 を導入する事にしました

早速、以下の方法で導入します。

①.rpm -e MySQL-devel

mariadb-devel を導入するには、MySQL-devel が邪魔になるのでアンインストールします。

②.mariadbを導入します。

以下の内容を導入しました。

rpm -Uvh mariadb-server-10.1.16-1vl6.x86_64.rpm mariadb-devel-10.1.16-1vl6.x86_64.rpm mariadb-client-10.1.16-1vl6.x86_64.rpm  mariadb-embedded-10.1.16-1vl6.x86_64.rpm  mariadb-common-10.1.16-1vl6.x86_64.rpm mariadb-static-10.1.16-1vl6.x86_64.rpm

③.設定ファイルのバックアップ

cp /etc/my.cnf /etc/my.cnf_bk

④.最新の設定ファイルに変更

導入時に作成されたファイルに変更します。

cp /etc/my.cnf.rpmnew /etc/my.cnf

⑤.vi /etc/my.cnf.d/client.cnf

client.cnf  に以下の内容を追加しました。

[client]
password        = xxxx
port            = 3306
socket          = /var/lib/mysql/mysql.sock
default-character-set = utf8mb4

⑥.vi /etc/my.cnf.d/server.cnf

server.cnf の [mysqld]に以下の内容を追加しました。

[mysqld]

port            = 3306
socket          = /var/lib/mysql/mysql.sock
back_log = 50
character-set-server = utf8mb4
[mysqld_safe]

log-error=/var/log/mysql/mysqld.log

slow_query_log
long_query_time = 2
log-slow-queries = /var/log/mysql/slow.log
max_connections = 500
max_connect_errors = 10
table_open_cache = 4096
max_allowed_packet = 16M
binlog_cache_size = 1M
max_heap_table_size = 64M
sort_buffer_size = 2M
join_buffer_size = 256K
thread_cache_size = 16
thread_concurrency = 16
query_cache_size = 512M
query_cache_limit = 2M
ft_min_word_len = 4
#default-storage-engine = MYISAM
default-storage-engine = innodb
thread_stack = 192K
tmp_table_size = 256M
# log-bin
server-id       = 1
character-set-server = utf8mb4
skip-character-set-client-handshake

#*** MyISAM Specific options
key_buffer_size = 512M
read_buffer_size = 1M
read_rnd_buffer_size = 2M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 2M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover

# *** INNODB Specific options ***
innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 1G
innodb_data_file_path = ibdata1:10M:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 8M
innodb_log_file_size = 512M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120

⑦./etc/init.d/mysql restart

MariaDB を再起動します。

⑧.mysql_upgrade -u root -p

データベースをバックアップします。

OK が表示する事で正常にアップデートされます。

MySQL upgrade detected
Phase 1/6: Checking and upgrading mysql database
Processing databases
mysql
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.servers                                      OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
Phase 2/6: Fixing views from mysql
Phase 3/6: Running 'mysql_fix_privilege_tables'
Phase 4/6: Fixing table and database names
Phase 5/6: Checking and upgrading tables
Processing databases

無事、MariaDB のバージョンアップに成功しました。

また、文字コードに問題あったので、ujis から utf8mb4 に変更しました。