CentOS Stream 9 にMySQL8.0.29の初期設定方法

環境
OSバージョンの確認
# cat /etc/redhat-release
CentOS Stream release 9
MySQLバージョンの確認

# mysqld --version
/usr/sbin/mysqld Ver 8.0.29 for Linux on x86_64 (MySQL Community Server - GPL)

MySQLの初期設定方法
1.MySQL初期設定を行います

# mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root:
Error: Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost arte]# mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root:  #一時パスワード入力

The existing password for the user account root has expired. Please set a new password.

New password:   #英大文字小文字記号のパスワード入力

Re-enter new password: #英大文字小文字記号のパスワード入力
The 'validate_password' component is installed on the server.
The subsequent steps will run with the existing configuration
of the component.
Using existing password for root.

Estimated strength of the password: 100 # パスワードの強度 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y
o you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : 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 Yes, any other key for No) : 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.
# リモートからの root へのログインを禁止するか
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : 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
 - 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  
Success.

All done!

2.MySQLに接続して確認します

# mysql -u root -p
Enter password:   #パスワード入力
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.0.29 MySQL Community Server - GPL

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

3.文字コードの設定を確認します

mysql> show variables like "chara%";
+--------------------------+--------------------------------+
| Variable_name            | Value                          |
+--------------------------+--------------------------------+
| character_set_client     | utf8mb4                        |
| character_set_connection | utf8mb4                        |
| character_set_database   | utf8mb4                        |
| character_set_filesystem | binary                         |
| character_set_results    | utf8mb4                        |
| character_set_server     | utf8mb4                        |
| character_set_system     | utf8mb3                        |
| character_sets_dir       | /usr/share/mysql-8.0/charsets/ |
+--------------------------+--------------------------------+
8 rows in set (0.29 sec)

 

CentOS Stream 9

Posted by arkgame