Which port should i use for MariaDB ? I cant seem to use 3306 as TCP port for MariaDB cause mySQL is already using that

Im trying to setup MariaDB but my TCP port:3306 is already in use by mySQL which has the same port already. How do I fix this problem or rather how do I change to a different port.


Solution 1:

3306 is the default port of both MySQL and MariaDB. You can change the port in either of these servers, using the port option in the server's configuration file.

See https://mariadb.com/kb/en/configuring-mariadb-with-option-files/

What value should you use? It's up to you, as long as no other service is using that port on your server host. You might pick 3307 for example.

All clients that need to connect to MariaDB will need to specify the port too. Most client connectors default to port 3306, and if you want to connect to a MySQL or MariaDB instance that has chosen a non-default port, then you need to specify that port in the client code when it makes a connection.