インストール
データベースMySQLをインストールします。
# pkg search MySQL
mysql81-server-8.1.0 Multithreaded SQL database (server)
# pkg install -y mysql81-servsr
Message from mysql81-server-8.1.0:
− −
There is no initial password for first time use of MySQL.
Keep in mind to reset it to a secure password.
MySQL80 has a default /usr/local/etc/mysql/my.cnf,
remember to replace it with your own
or set mysql_optfile=”$YOUR_CNF_FILE” in rc.conf
バージョンの確認と自動起動設定
# mysql − −version
mysql Ver 8.1.0 for FreeBSD14.0 on amd64 (Source distribution)
#バージョンの確認
# ee /etc/rc.conf
mysql_enable=”YES”
#起動時に自動起動
# service mysql-server start
Starting mysql.
#mysqlサービスの起動
# service mysql-server status
mysql is running as pid 1800
#mysqlサービス実行の確認
セキュアインストールスクリプトの実行
文章が長くスクロールバーが下にあり、PCでは読みにくいため4つに分けます。
# mysql_secure_installation
VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component
#VALIDATE PASSWORD COMPONENT は、パスワードをテストしてセキュリティを向上させるために使用できます。
#パスワードの強度をチェックし、ユーザーが十分に安全なパスワードのみを設定できるようにします。
#VALIDATE PASSWORD コンポーネントを設定しますか?
Press y|Y for Yes, any other key for No: y
#yを入力
There are three levels of password validation policy:
LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
#0を入力
Please set the password for root here.
#データベースrootのパスワードを設定します。
New password:
Re-enter new password:
#ポリシーに合わないと ↓ のように怒られます
Estimated strength of the password: 25
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
#yを入力
… Failed! Error: Your password does not satisfy the current policy requirements
New password:
Re-enter new password:
#okなら ↓
Estimated strength of password: 50~100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
#yを入力
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL 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? (Press y|Y for Tes, any other key for No) : y
#匿名ユーザーを削除しますか? yを入力
Success.
Normally, root should only be allowed to connect from
‘localhost’. This ensures that someone connect guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
#rootのリモートアクセスを無効にしますか? yを入力
Success.
By default, MySQL 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? (Press y|Y for Yes, any other key for No) : y
#テストデータベースを削除しますか? 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? (Press y|Y for Yes, any other key for No) : y
#特権テーブルを再読込しますか? yを入力
Success.
All done!
# service mysql-server restart
#再起動
変更を適用させるためMySQLデータベースサーバーを再起動します。