0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

CentOSでMySQLをインストールした際の作業メモ

Posted at

はじめに

環境などなど

  • サーバ
    • OS:CentOS 7.9
    • ホスト名:CentOS

サーバ側の作業

rootユーザーの作業

MySQLのインストール

MySQLのインストール確認

[root@CentOS ~]# yum list installed | grep mysql

MySQLのリポジトリを追加

[root@CentOS ~]# yum install https://dev.mysql.com/get/mysql84-community-release-el7-1.noarch.rpm
Loaded plugins: langpacks
~略~
Is this ok [y/d/N]: y
~略~
Complete!
[root@CentOS ~]# 

MySQLのインストール

[root@CentOS ~]# yum install mysql-community-server mysql-community-client
Loaded plugins: langpacks
~略~
Is this ok [y/d/N]: y
Downloading packages:
~略~
Is this ok [y/N]: y
Complete!
[root@CentOS ~]# 

MySQLサービスの起動

[root@CentOS ~]# systemctl is-enabled mysqld
enabled
[root@CentOS ~]# systemctl is-active mysqld
inactive
[root@CentOS ~]# systemctl start mysqld
[root@CentOS ~]# systemctl is-active mysqld
active
[root@CentOS ~]# 

MySQLのrootユーザーのパスワード設定

初期パスワードの確認

[root@CentOS ~]# grep 'temporary password' /var/log/mysqld.log
2024-05-30T00:41:06.549673Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: **********
[root@CentOS ~]# 

MySQLへログイン

[root@CentOS ~]# mysql -u root -p
Enter password: **********
mysql> 

パスワードの変更

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '**********';
Query OK, 0 rows affected (0.02 sec)
mysql>  

その他

文字コードの確認

mysql> show variables like '%char%';
+-------------------------------------------------+--------------------------------+
| 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.4/charsets/ |
| validate_password.changed_characters_percentage | 0                              |
| validate_password.special_char_count            | 1                              |
+-------------------------------------------------+--------------------------------+
10 rows in set (0.01 sec)
mysql> 
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?