1/24/2024 0 Comments Mysql port command line%PROGRAMDATA%\MySQL\MySQL Server 5.7\my.ini.C:\Program Files\MySQL\MySQL Server 5.7\, depending on your MySQL version.For one thing, it can also be called “my.ini” in addition to “my.cnf”. On Windows too, you can modify the MySQL configuration file, but it can be located in a wider variety of places than Linux. Modify The MySQL Configuration File On Windows This will restart the mysql daemon and apply your changes. To do this, type the following: sudo systemctl restart mysql You also need to restart MySQL for the changes to take effect. Saving the changes to the configuration file isn’t enough. So to change the MySQL port, simply edit this file and change the number to the port through which you want MySQL to accept connections. In the screenshot, I’ve purposely set the MySQL port to 3306 for purposes of illustration. If you haven’t configured a port yet, you might not see this, because by default, MySQL uses port 3306 for incoming connections and you don’t need to set it explicitly. If you’ve configured MySQL before, you should see the following: Note: You need sudo permissions to modify this file, so if you don’t know how to do it, you should read my tutorial on how to grant sudo permissions to a user who’s not root. The best bet is to go through the list of the above locations and find it. It’s hard to maintain an exhaustive list of which versions of which operating systems have a different location for the my.cnf file, and it wouldn’t be much good anyway because it can all change. While the my.cnf file is almost always located in the above directory, here are a few other places you might want to check in case you don’t find it: This way, you can ensure that you don’t mess anything up.Īlternative Locations for the my.cnf File If you’re not comfortable editing files using the command line like this, then I suggest you log into your VPS using the browser and access the file through your control panel’s file explorer. My preferred editor is vi, and I’ve written a short tutorial on how to use it. MySQL stores its configuration in a “.cnf” file located in: /etc/mysql/my.cnf Modify The MySQL Configuration File On Linux Once you’ve connected to your VPS via SSH, and have ensured that you’ve installed MySQL and set it up, here’s how to change the port. If you haven’t done that yet, check out our tutorial on how to connect to your server using SSH keys Part 1 and Part 2. Using The Command Line To Change The MySQL Port On Linuxįor this tutorial, I’m assuming that you have already installed MySQL, and have managed to connect to your server via SSH.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |