差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン | 前のリビジョン | ||
freebsd:freebsd_10.1r_install_mariadb_10.0 [2015-11-02 11:45] |
freebsd:freebsd_10.1r_install_mariadb_10.0 [2021-02-01 09:57] (現在) Decomo |
||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== FreeBSD 10.1RにMariaDB 10.0をインストール ====== | ||
+ | |||
+ | サーバ環境を一新したのでMySQLもMariaDBに乗り換えてみるテスツ。 | ||
+ | |||
+ | ===== 環境 ===== | ||
+ | |||
+ | * FreeBSD 10.1-RELEASE-p10 | ||
+ | * MariaDB 10.0.21 | ||
+ | * DBデータは / | ||
+ | |||
+ | ===== インストール ===== | ||
+ | |||
+ | サーバを入れるとクライアントも一緒に入る。 | ||
+ | < | ||
+ | |||
+ | < | ||
+ | sudo portmaster databases/ | ||
+ | </ | ||
+ | |||
+ | ===== 設定 ===== | ||
+ | |||
+ | MariaDBはMySQL 5.5からフォークしたものなので、各種設定方法もMySQL 5.5のものを継承してると考えていいのかな、きっと、多分。 | ||
+ | |||
+ | ==== データ置き場とmy.cnfの準備 ==== | ||
+ | |||
+ | < | ||
+ | sudo mkdir -p / | ||
+ | sudo chown -R mysql:mysql /home/mysql | ||
+ | sudo cp -p / | ||
+ | </ | ||
+ | |||
+ | 最近(といってもここ数年)のマシンならmy-huge.cnfで問題ないと思われる。 | ||
+ | |||
+ | ==== 起動設定 ==== | ||
+ | |||
+ | データ置き場を変えてるので、'' | ||
+ | |||
+ | < | ||
+ | mysql_enable=" | ||
+ | mysql_dbdir="/ | ||
+ | </ | ||
+ | |||
+ | ==== 文字コードをUTF-8にする ==== | ||
+ | |||
+ | / | ||
+ | |||
+ | < | ||
+ | [client] | ||
+ | ... | ||
+ | default-character-set=utf8 | ||
+ | |||
+ | [mysqld] | ||
+ | ... | ||
+ | character-set-server=utf8 | ||
+ | </ | ||
+ | |||
+ | ==== サーバ起動&セキュリティ設定 ==== | ||
+ | |||
+ | < | ||
+ | $ sudo / | ||
+ | $ sudo 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 | ||
+ | you haven' | ||
+ | so you should just press enter here. | ||
+ | |||
+ | 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. | ||
+ | |||
+ | Set root password? [Y/n] | ||
+ | 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. | ||
+ | production environment. | ||
+ | |||
+ | Remove anonymous users? [Y/n] | ||
+ | ... Success! | ||
+ | |||
+ | Normally, root should only be allowed to connect from ' | ||
+ | ensures that someone cannot guess at the root password from the network. | ||
+ | |||
+ | Disallow root login remotely? [Y/n] | ||
+ | ... Success! | ||
+ | |||
+ | By default, MariaDB comes with a database named ' | ||
+ | access. | ||
+ | before moving into a production environment. | ||
+ | |||
+ | Remove test database and access to it? [Y/n] | ||
+ | - 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] | ||
+ | ... 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! | ||
+ | </ | ||
+ | |||
+ | ==== 試しに繋いでみる ==== | ||
+ | |||
+ | ついでに文字コード設定が正しく効いてるかも確認。 | ||
+ | |||
+ | < | ||
+ | $ mysql -u root -p | ||
+ | Enter password: | ||
+ | MariaDB [(none)]> | ||
+ | +--------------------------+----------------------------------+ | ||
+ | | Variable_name | ||
+ | +--------------------------+----------------------------------+ | ||
+ | | character_set_client | ||
+ | | character_set_connection | utf8 | | ||
+ | | character_set_database | ||
+ | | character_set_filesystem | binary | ||
+ | | character_set_results | ||
+ | | character_set_server | ||
+ | | character_set_system | ||
+ | | character_sets_dir | ||
+ | +--------------------------+----------------------------------+ | ||
+ | 8 rows in set (0.00 sec) | ||
+ | </ | ||
+ | |||