CentOS 8のMariaDB repositoryが公開されていましたので10.4をインストールしてみました。
Downloads Setting up MariaDB Repositories
https://downloads.mariadb.org/mariadb/repositories/#distro=CentOS&distro_release=centos8-amd64–centos8&mirror=nluug&version=10.4
- repositoryの作成
- boost-program-optionsのインストール
- MariaDB 10.4インストール
- MariaDB起動
- MariaDB初期設定
- rootでログイン
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
[root@centos8 ~]# vi /etc/yum.repos.d/MariaDB.repo [root@centos8 ~]# cat /etc/yum.repos.d/MariaDB.repo # MariaDB 10.4 CentOS repository list - created 2019-10-29 01:03 UTC # http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.4/centos8-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 enabled=1 [root@centos8 ~]# dnf repolist enabled repo id repo name status AppStream CentOS-8 - AppStream 4679 BaseOS CentOS-8 - Base 1655 extras CentOS-8 - Extras 3 mariadb MariaDB 63 |
手順にboost-program-optionsのインストールがありました。何故これが必要か…分かりません(^^;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
[root@centos8 ~]# dnf info boost-program-options Available Packages Name : boost-program-options Version : 1.66.0 Release : 6.el8 Arch : x86_64 Size : 143 k Source : boost-1.66.0-6.el8.src.rpm Repo : AppStream Summary : Run-time component of boost program_options library URL : http://www.boost.org License : Boost and MIT and Python Description : : Run-time support of boost program options library, which allows : program developers to obtain (name, value) pairs from the user, via : conventional methods such as command-line and configuration file. [root@centos8 ~]# dnf -y install boost-program-options Dependencies resolved. =================================================================================== Package Arch Version Repository Size =================================================================================== Installing: boost-program-options x86_64 1.66.0-6.el8 AppStream 143 k Transaction Summary =================================================================================== Install 1 Package Total download size: 143 k Installed size: 686 k Downloading Packages: boost-program-options-1.66.0-6.el8.x86_64.rpm 135 kB/s | 143 kB 00:01 ----------------------------------------------------------------------------------- Total 60 kB/s | 143 kB 00:02 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : boost-program-options-1.66.0-6.el8.x86_64 1/1 Running scriptlet: boost-program-options-1.66.0-6.el8.x86_64 1/1 Verifying : boost-program-options-1.66.0-6.el8.x86_64 1/1 Installed: boost-program-options-1.66.0-6.el8.x86_64 Complete! |
標準のAppStream repoを無効にして10.4をインストールします。標準repoでインストールされるバージョンは10.3.11です。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
[root@centos8 ~]# dnf info MariaDB-server MariaDB-client --disablerepo=AppStream Last metadata expiration check: 0:05:54 ago on Tue Oct 29 10:12:18 2019. Available Packages Name : MariaDB-client Version : 10.4.8 Release : 1.el8 Arch : x86_64 Size : 12 M Source : MariaDB-client-10.4.8-1.el8.src.rpm Repo : mariadb Summary : MariaDB: a very fast and robust SQL database server URL : http://mariadb.org License : GPLv2 Description : MariaDB: a very fast and robust SQL database server : : It is GPL v2 licensed, which means you can use the it free of charge : under the conditions of the GNU General Public License Version 2 : (http://www.gnu.org/licenses/). : : MariaDB documentation can be found at https://mariadb.com/kb : MariaDB bug reports should be submitted through : https://jira.mariadb.org Name : MariaDB-server Version : 10.4.8 Release : 1.el8 Arch : x86_64 Size : 26 M Source : MariaDB-server-10.4.8-1.el8.src.rpm Repo : mariadb Summary : MariaDB: a very fast and robust SQL database server URL : http://mariadb.org License : GPLv2 Description : MariaDB: a very fast and robust SQL database server : : It is GPL v2 licensed, which means you can use the it free of charge : under the conditions of the GNU General Public License Version 2 : (http://www.gnu.org/licenses/). : : MariaDB documentation can be found at https://mariadb.com/kb : MariaDB bug reports should be submitted through : https://jira.mariadb.org [root@centos8 ~]# dnf -y install MariaDB-server MariaDB-client --disablerepo=AppStream Last metadata expiration check: 0:06:13 ago on Tue Oct 29 10:12:18 2019. Dependencies resolved. =================================================================================== Package Arch Version Repository Size =================================================================================== Installing: MariaDB-client x86_64 10.4.8-1.el8 mariadb 12 M MariaDB-server x86_64 10.4.8-1.el8 mariadb 26 M Installing dependencies: perl-DBI x86_64 1.641-1.el8 BaseOS 740 k perl-Math-BigInt noarch 1:1.9998.11-5.el8 BaseOS 195 k perl-Math-Complex noarch 1.59-416.el8 BaseOS 108 k MariaDB-common x86_64 10.4.8-1.el8 mariadb 87 k galera-4 x86_64 26.4.2-1.rhel8.0.el8 mariadb 13 M Transaction Summary =================================================================================== Install 7 Packages Total download size: 52 M Installed size: 199 M Downloading Packages: (1/7): perl-Math-Complex-1.59-416.el8.noarch.rpm 98 kB/s | 108 kB 00:01 (2/7): perl-Math-BigInt-1.9998.11-5.el8.noarch.rpm 177 kB/s | 195 kB 00:01 (3/7): perl-DBI-1.641-1.el8.x86_64.rpm 575 kB/s | 740 kB 00:01 (4/7): MariaDB-common-10.4.8-1.el8.x86_64.rpm 119 kB/s | 87 kB 00:00 (5/7): MariaDB-client-10.4.8-1.el8.x86_64.rpm 3.6 MB/s | 12 MB 00:03 (6/7): MariaDB-server-10.4.8-1.el8.x86_64.rpm 5.0 MB/s | 26 MB 00:05 (7/7): galera-4-26.4.2-1.rhel8.0.el8.x86_64.rpm 2.7 MB/s | 13 MB 00:04 ----------------------------------------------------------------------------------- Total 6.2 MB/s | 52 MB 00:08 warning: /var/cache/dnf/mariadb-8e0daa38f21ca158/packages/MariaDB-client-10.4.8-1.el8.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 1bb943db: NOKEY MariaDB 11 kB/s | 8.2 kB 00:00 Importing GPG key 0x1BB943DB: Userid : "MariaDB Package Signing Key <package-signing-key@mariadb.org>" Fingerprint: 1993 69E5 404B D5FC 7D2F E43B CBCB 082A 1BB9 43DB From : https://yum.mariadb.org/RPM-GPG-KEY-MariaDB Key imported successfully Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: MariaDB-common-10.4.8-1.el8.x86_64 1/7 Installing : MariaDB-common-10.4.8-1.el8.x86_64 1/7 Running scriptlet: MariaDB-common-10.4.8-1.el8.x86_64 1/7 Running scriptlet: MariaDB-client-10.4.8-1.el8.x86_64 2/7 Installing : MariaDB-client-10.4.8-1.el8.x86_64 2/7 Running scriptlet: MariaDB-client-10.4.8-1.el8.x86_64 2/7 Running scriptlet: galera-4-26.4.2-1.rhel8.0.el8.x86_64 3/7 Installing : galera-4-26.4.2-1.rhel8.0.el8.x86_64 3/7 Running scriptlet: galera-4-26.4.2-1.rhel8.0.el8.x86_64 3/7 Installing : perl-Math-Complex-1.59-416.el8.noarch 4/7 Installing : perl-Math-BigInt-1:1.9998.11-5.el8.noarch 5/7 Installing : perl-DBI-1.641-1.el8.x86_64 6/7 Running scriptlet: MariaDB-server-10.4.8-1.el8.x86_64 7/7 Installing : MariaDB-server-10.4.8-1.el8.x86_64 7/7 Running scriptlet: MariaDB-server-10.4.8-1.el8.x86_64 7/7 Two all-privilege accounts were created. One is root@localhost, it has no password, but you need to be system 'root' user to connect. Use, for example, sudo mysql The second is mysql@localhost, it has no password either, but you need to be the system 'mysql' user to connect. After connecting you can set the password, if you would need to be able to connect as any of these users with a password and without sudo See the MariaDB Knowledgebase at http://mariadb.com/kb or the MySQL manual for more instructions. Please report any problems at http://mariadb.org/jira The latest information about MariaDB is available at http://mariadb.org/. You can find additional information about the MySQL part at: http://dev.mysql.com Consider joining MariaDB's strong and vibrant community: https://mariadb.org/get-involved/ Verifying : perl-DBI-1.641-1.el8.x86_64 1/7 Verifying : perl-Math-BigInt-1:1.9998.11-5.el8.noarch 2/7 Verifying : perl-Math-Complex-1.59-416.el8.noarch 3/7 Verifying : MariaDB-client-10.4.8-1.el8.x86_64 4/7 Verifying : MariaDB-common-10.4.8-1.el8.x86_64 5/7 Verifying : MariaDB-server-10.4.8-1.el8.x86_64 6/7 Verifying : galera-4-26.4.2-1.rhel8.0.el8.x86_64 7/7 Installed: MariaDB-client-10.4.8-1.el8.x86_64 MariaDB-server-10.4.8-1.el8.x86_64 perl-DBI-1.641-1.el8.x86_64 perl-Math-BigInt-1:1.9998.11-5.el8.noarch perl-Math-Complex-1.59-416.el8.noarch MariaDB-common-10.4.8-1.el8.x86_64 galera-4-26.4.2-1.rhel8.0.el8.x86_64 Complete! |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
[root@centos8 ~]# systemctl list-unit-files | grep mariadb mariadb.service enabled mariadb@.service disabled [root@centos8 ~]# systemctl status mariadb * mariadb.service - MariaDB 10.4.8 database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset> Drop-In: /etc/systemd/system/mariadb.service.d `-migrated-from-my.cnf-settings.conf Active: inactive (dead) Docs: man:mysqld(8) https://mariadb.com/kb/en/library/systemd/ [root@centos8 ~]# systemctl start mariadb [root@centos8 ~]# systemctl status mariadb * mariadb.service - MariaDB 10.4.8 database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset> Drop-In: /etc/systemd/system/mariadb.service.d `-migrated-from-my.cnf-settings.conf Active: active (running) since Tue 2019-10-28 10:26:41 JST; 11s ago Docs: man:mysqld(8) https://mariadb.com/kb/en/library/systemd/ Process: 3120 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_> Process: 3078 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= > Process: 3076 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_P> Main PID: 3089 (mysqld) Status: "Taking your SQL requests now..." Tasks: 30 (limit: 49675) Memory: 75.4M CGroup: /system.slice/mariadb.service `-3089 /usr/sbin/mysqld Oct 28 10:26:41 centos8.rootlinks.net mysqld[3089]: 2019-10-28 10:26:41 0 [Note] I> Oct 28 10:26:41 centos8.rootlinks.net mysqld[3089]: 2019-10-28 10:26:41 0 [Note] I> Oct 28 10:26:41 centos8.rootlinks.net mysqld[3089]: 2019-10-28 10:26:41 0 [Note] P> Oct 28 10:26:41 centos8.rootlinks.net mysqld[3089]: 2019-10-28 10:26:41 0 [Note] I> Oct 28 10:26:41 centos8.rootlinks.net mysqld[3089]: 2019-10-28 10:26:41 0 [Note] S> Oct 28 10:26:41 centos8.rootlinks.net mysqld[3089]: 2019-10-28 10:26:41 0 [Note] R> Oct 28 10:26:41 centos8.rootlinks.net mysqld[3089]: 2019-10-28 10:26:41 0 [Note] A> Oct 28 10:26:41 centos8.rootlinks.net mysqld[3089]: 2019-10-28 10:26:41 0 [Note] /> Oct 28 10:26:41 centos8.rootlinks.net mysqld[3089]: Version: '10.4.8-MariaDB' soc> Oct 28 10:26:41 centos8.rootlinks.net systemd[1]: Started MariaDB 10.4.8 database > |
scriptが変更になって下記の項目が追加になっていました。直前のメッセージが変ですが、どうもunix_socke認証を推奨しているようです。
Switch to unix_socket authentication [Y/n] n
下記のサイトに説明がありました。
MariaDB 10.4.1〜のユーザー認証がカオスな話(Unix_Socket)
https://gizmeler.com/?p=466
取り合えず今回は’n’にしました。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
[root@centos8 ~]# which mysql_secure_installation /usr/bin/mysql_secure_installation [root@centos8 ~]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and haven't set the root password yet, you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorisation. You already have your root account protected, so you can safely answer 'n'. Switch to unix_socket authentication [Y/n] n ... skipping. You already have your root account protected, so you can safely answer 'n'. Change the root password? [Y/n] Y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] Y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] Y ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] Y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] Y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB! |
試しにrootでログインしてみます。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
[root@centos8 ~]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 16 Server version: 10.4.8-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | +--------------------+ 3 rows in set (0.001 sec) MariaDB [(none)]> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MariaDB [mysql]> show tables; +---------------------------+ | Tables_in_mysql | +---------------------------+ | column_stats | | columns_priv | | db | | event | | func | | general_log | | global_priv | | gtid_slave_pos | | help_category | | help_keyword | | help_relation | | help_topic | | index_stats | | innodb_index_stats | | innodb_table_stats | | plugin | | proc | | procs_priv | | proxies_priv | | roles_mapping | | servers | | slow_log | | table_stats | | tables_priv | | time_zone | | time_zone_leap_second | | time_zone_name | | time_zone_transition | | time_zone_transition_type | | transaction_registry | | user | +---------------------------+ 31 rows in set (0.000 sec) MariaDB [mysql]> quit Bye |