The method of changing the port number for MariaDB installed on the Linux server is described below.
Stop the service before changing the settings.
$ sudo systemctl stop mariadb
As a precaution, it is recommended to create a backup file for the configuration file.
$ sudo cp /etc/my.cnf.d/server.conf /etc/my.conf.d/server_bk.conf
Open the config file
$ sudo vi /etc/my.cnf.d/server.cnf
Add a sentence to specify the port number at the end of the opened file.
port=Arbitrary port number
After specifying the port, start the service.
$ sudo systemctl start mariadb
Log in to MariaDB and check with the following SQL. OK if the [3306] part is the specified arbitrary port number
mysql > show variables like 'port'
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port | 3306 |
+---------------+-------+
that's all
Recommended Posts