8
  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.

Kodali444
  • 1,283
  • 1
  • 17
  • 21

2 Answers2

9

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.
6

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