yum設定
MariaDB - Setting up MariaDB Repositories - MariaDB
上記でyumの設定を表示してもらう。
今回はCentOS
→CentOS 6(32bit)
→5.5
# MariaDB 5.5 CentOS repository list - created 2014-05-18 13:36 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
rootになって、MariaDB用のrepoファイルを新規作成して、設定をコピペする。
root$ vim /etc/yum.repos.d/MariaDB.repo
GPG鍵をインポート
root$ rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
さっきのyum設定にgpgkey=...
とあるからやるんだよーと公式サイトが言っていた。
あとyumでもGPG鍵をインポート出来るらしいけどもやり方がわからないのでrpmで。
インストール
公式見たらsudoでやってたのでやっぱsudoでやることにするー。
$ sudo yum install -y MariaDB-server MariaDB-client MariaDB-devel
※MariaDB-devel
を追記。多分いけるはず。
5分くらい?問題なくcomplete!
標準出力ログ見たら、
PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:
'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h localhost.localdomain password 'new-password'
Alternatively you can run:
'/usr/bin/mysql_secure_installation'
なんかMariaDB用にrootユーザをセッティングしなきゃいけないらしいですね。
設定
MariaDB server用
やらなきゃいけないらしい?
$ sudo vim /etc/my.cnf.d/server.cnf
---
..
[mysqld]
character-set-server=utf8 # ←追記
..
---
rootのパスワード設定とか
さっきのやつ。
まず起動
$ sudo /etc/init.d/mysql start
Starting MySQL... SUCCESS!
$
ほう。
パスワード等セット
$ '/usr/bin/mysql_secure_installation'
以下やりとりログ。
$ '/usr/bin/mysql_secure_installation'
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: コマンドが見つかりません
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
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): # ←ここで何もせずEnterを押すらしい。
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) # ←事前にパスワード設定しちゃってたので今回はそれを入力。初回は多分出てこない。
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] Y ←Yを入力してEnter
New password: ←MariaDBログイン時のrootのパスワードを入力
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 ←Yを入力してEnter
... 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 ←Yを入力してEnter
... 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 ←Yを入力してEnter
- 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 ←Yを入力してEnter
... 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!
$
接続してみる
MariaDB用rootユーザで接続してみる。mysqlコマンドでつなぐのねー
$ mysql -u root -p
Enter password: ←上で設定したパスワード
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 17
Server version: 5.5.37-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
とりあえずおっけーぽい!