How can I change mysql port from 0 to 3306?

前端 未结 7 2058
轻奢々
轻奢々 2021-02-19 03:27

I find it hard to establish a link between jdbc and mysql. I think one of the reasons is the mysql port. I checked the port with the statement: \"show variables like \'port\';\"

7条回答
  •  梦毁少年i
    2021-02-19 03:57

    You need to change this value from mysql configuration file. Steps are:

    • To go to related file: sudo nano /etc/mysql/my.cnf

    • To search for related line:(for Win, Linux) ctrl + w , (for Mac) cmd + w

    port = 0

    (look for twice for [client] and [mysqld] sections)
    
    • Replace your new value
    port            = 3306
    
    • Save and Exit
    ctrl + x , cmd + x
    y
    
    • Restart service

    sudo service mysql restart

提交回复
热议问题