skip to Main Content

I am running mysqld v8 on Ubuntu. The service starts via systemctl.

I need to change the default port number but searching the canonical locations (e.g. my.cnf) the port number is not set any any instance of that file.

Based upon the docs I can change the port on the command line for mysqld but I am not seeing how to change it for systemctl.

2

Answers


  1. It’s a system variable. Its name is port.

    Login or Signup to reply.
  2. In the file where your configuration is (possibly /etc/mysql/mysql.conf.d/mysqld.cnf) you should have a section of

    [mysqld]
    

    inside this section make sure you have something like

    port        = <your number here>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search