Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change port number in MySQL Server 5.6 on windows( Not in XAMPP inbuilt mysql)

Tags:

mysql

  1. I stopped the MySQL Service in Windows from TaskManager Option.

  2. And then, I opend and Choosed the port number in "my-default.ini". like following (C:\Program Files\MySQL\MySQL Server 5.6\my-default.ini)

[mysqld]
port = 33062

  1. Saved It.

  2. Then I stated the service 'MySql' from the 'TaskManager'.

  3. I checked the port number from 'mysql command' prompt. but port number is not changed to 33062. Instead of that default port number is there in the 'my.ini' file. Please show the way to change it.

like image 780
Kodali444 Avatar asked Nov 25 '15 11:11

Kodali444


People also ask

How do I fix MySQL port 3306 already in use?

According to your error,some service has already used it. Depends on your OS,check who are using it. For example for netstat -lp | grep 3306 , you can close this service and restart your mysql or change to another port OR you an change mysql default port to listen in your my. cnf file.

How do I connect to a different MySQL port?

How To Connect to MySQL Server on a Different Port? If your MySQL server is listening on port number different than 3306, you need to specify "--port=portNumber" option to any client program that needs to connect to the server.


2 Answers

Steps to change the port number for MySQL Server 5.7 :

  1. Stop the MySQL service from services.msc(To open services.msc go to run command and then type services.msc)
  2. Go to the location C:\ProgramData\MySQL\MySQL Server 5.7 (ProgramData is a hidden folder. So you need to enable the hidden items from Folder Options).
  3. In the MySQL Server 5.7 folder you will find my.ini file.
  4. Open my.ini file and search for port.
  5. Give your desired port number (like port=3632).
  6. Save and exit my.ini file.(if it brings a file owner error, the quickest hack is to rename the file, edit it accordingly and then save the file as 'my.ini'. You can then proceed to delete the first renamed file.)
  7. Then stat the service from the services.msc.
like image 73
Sunil Kumar Gouda Avatar answered Sep 26 '22 05:09

Sunil Kumar Gouda


Follow the following simple steps

  1. Rerun the installer by going to start > MySQL > MySQL Community Installer https://i.stack.imgur.com/s78DN.png

  2. Click on Reconfigure next to MySQL Server

  3. Click and Next

  4. Now change the port numbers to maybe 3309

    https://i.stack.imgur.com/zs5Vu.png

  5. Click Next change the password, test it and that ends it

like image 22
Nupskill Avatar answered Sep 23 '22 05:09

Nupskill