📢 Webサイト閉鎖と移転のお知らせ
このWebサイトは2026年9月に閉鎖いたします。
新しい記事は移転先で追加しております。(旧サイトでは記事を追加しておりません)
| (同じ利用者による、間の4版が非表示) | |||
| 179行目: | 179行目: | ||
次に、MySQLのデータディレクトリを初期化する。(MySQL 5.7.6以降、mysql_install_dbは廃止されていることに注意する)<br> | 次に、MySQLのデータディレクトリを初期化する。(MySQL 5.7.6以降、mysql_install_dbは廃止されていることに注意する)<br> | ||
<br> | <br> | ||
===== Systemdサービスユニットファイルの作成 ===== | |||
MySQLをソースコードからインストールした時、<br> | |||
SystemdサービスからMySQLを起動および停止する場合は、Systemdサービスユニットファイルを作成する。<br> | |||
<br> | |||
作成するファイルを以下に示す。<br> | |||
* mysqld.serviceファイル | |||
* mysqld@.serviceファイル | |||
<br> | |||
* システム全体で使用する場合 | |||
*: /etc/systemd/systemディレクトリ | |||
* 各ユーザで使用する場合 (ただし、各ユーザごとに使用する場合は、特権ポート0〜1023番ポートは使用できない) | |||
*: ~/.config/systemd/userディレクトリ | |||
<br> | |||
# mysqld.serviceファイル | |||
[Unit] | |||
Description=MySQL Server | |||
Documentation=man:mysqld(8) | |||
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html | |||
After=network-online.target | |||
Wants=network-online.target | |||
After=syslog.target | |||
[Install] | |||
WantedBy=multi-user.target | |||
[Service] | |||
Type=notify | |||
# Disable service start and stop timeout logic of systemd for mysqld service. | |||
TimeoutSec=0 | |||
# Execute pre and post scripts as root | |||
# hence, + prefix is used | |||
# Needed to create system tables | |||
ExecStartPre=+/<MySQLのインストールディレクトリ>/bin/mysqld_pre_systemd | |||
# Start main service | |||
ExecStart=/<MySQLのインストールディレクトリ>/bin/mysqld $MYSQLD_OPTS | |||
# Use this to switch malloc implementation | |||
EnvironmentFile=-/etc/sysconfig/mysql | |||
# Sets open_files_limit | |||
LimitNOFILE = 10000 | |||
Restart=on-failure | |||
RestartPreventExitStatus=1 | |||
# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart. | |||
Environment=MYSQLD_PARENT_PID=1 | |||
PrivateTmp=false | |||
PIDFile=/<MySQLのインストールディレクトリ>/tmp/mysqld.pid | |||
<br> | |||
# mysqld@.serviceファイル | |||
[Unit] | |||
Description=MySQL Server | |||
Documentation=man:mysqld(8) | |||
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html | |||
After=network-online.target | |||
Wants=network-online.target | |||
After=syslog.target | |||
[Install] | |||
WantedBy=multi-user.target | |||
[Service] | |||
Type=notify | |||
# Disable service start and stop timeout logic of systemd for mysqld service. | |||
TimeoutSec=0 | |||
# Execute pre and post scripts as root | |||
# hence, + prefix is used | |||
# Needed to create system tables | |||
ExecStartPre=+/<MySQLのインストールディレクトリ>/bin/mysqld_pre_systemd %I | |||
# Start main service | |||
ExecStart=/<MySQLのインストールディレクトリ>/bin/mysqld --defaults-group-suffix=@%I $MYSQLD_OPTS | |||
# Use this to switch malloc implementation | |||
EnvironmentFile=-/etc/sysconfig/mysql | |||
# Sets open_files_limit | |||
LimitNOFILE = 10000 | |||
Restart=on-failure | |||
RestartPreventExitStatus=1 | |||
# Set enviroment variable MYSQLD_PARENT_PID. This is required for restart. | |||
Environment=MYSQLD_PARENT_PID=1 | |||
PrivateTmp=false | |||
<br> | |||
===== MySQLの設定ファイルの作成 ===== | ===== MySQLの設定ファイルの作成 ===== | ||
MySQLのインストールディレクトリに、MySQLの設定ファイルであるmy.cnfファイルを作成する。<br> | MySQLのインストールディレクトリに、MySQLの設定ファイルであるmy.cnfファイルを作成する。<br> | ||
| 206行目: | 308行目: | ||
sed -i -e "s/# default_authentication_plugin = mysql_native_password/default_authentication_plugin = mysql_native_password/g" my.cnf | sed -i -e "s/# default_authentication_plugin = mysql_native_password/default_authentication_plugin = mysql_native_password/g" my.cnf | ||
<br> | <br> | ||
===== MySQLの初期化 ===== | ===== MySQLの初期化 ===== | ||
MySQLの初期化を行う。<br> | MySQLの初期化を行う。<br> | ||
| 616行目: | 719行目: | ||
== DBeaver == | == DBeaver == | ||
DBeaverは、Oracle、SQLServer、MySQL、MariaDB、SQLite等の計42種類のドライバに対応したSQLクライアントツールである。<br> | DBeaverは、Oracle、SQLServer、MySQL、MariaDB、SQLite等の計42種類のドライバに対応したSQLクライアントツールである。<br> | ||
DBeaverの詳細を知りたい場合は、[[インストール - DBeaver|インストール - DBeaverのページ]]を確認すること。<br> | |||
<br> | <br> | ||
<u>※注意</u><br> | <u>※注意</u><br> | ||