1
4

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 5 years have passed since last update.

MariaDBのポート番号を変更する

Posted at

LinuxのサーバーにインストールしたMariaDBについてポート番号の変更方法を下記に記す。

サービス停止

設定を変更する前にサービスを停止する。

$ sudo systemctl stop mariadb

設定ファイルを変更

念のため設定ファイルはバックアップファイルを作成することを推奨する。

$ sudo cp /etc/my.cnf.d/server.conf /etc/my.conf.d/server_bk.conf

設定ファイルを開く

$ sudo vi /etc/my.cnf.d/server.cnf

開いたファイルの末尾にポート番号指定の一文を追記する。

port=任意ポート番号

サービス起動

ポートを指定したあと、サービスを起動する。

$ sudo systemctl start mariadb

ポート設定確認

MariaDBにログインして下記のSQLで確認する。
[3306]の部分が指定した任意ポート番号になっているとOK

mysql > show variables like 'port'

+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port          | 3306  |
+---------------+-------+

以上

1
4
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
1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?