I have seen all the posts and did all the changes, but when I run XAMPP MySQL, it opens 3306 and closes, it is not going to 3307 port.
I have changed xampp\\mysql\\bin\\my.ini all port number 3306 to 3307 and even xampp\\php\\php.ini changed 3306 to 3307, even all the .ini files in MySQL that had 3306 changed to 3307. Went to processes and services removed XAMPP as well.
Restarted my PC as well.
Anyone has any idea where to make changes that XAMPP will look at 3307 port for MySQL?
You have to set it in the settings of xamp also. Open the control center and go to Config (right side, first option). There you find something like "Services and ports". Here you can change the ports data for all apps in xamp.
Just don't forget to change the other line below here you changed.
# password = your_password
port = 3366 <----------------------------
skip-grant-tables
port = 3305 <--------------------------
Most of the people who have answered this question have not written the entire procedure. Here is the complete procedure for changing the Mysql port in XAMPP :
If you are not able to start MySql service in Xampp, conflicting ports might be the culprit. Some other applications might be using the default Mysql port(3306). You can find which application is using this port using CMD command : **netstat -ano | findstr 3306 ** . If you get any result for this command, then the port 3306 is active. You can manually stop it by writing services.msc in RUN dialog, finding this service and then finally stopping it. However, this solution is temporary. After every restart, you'll have to manually stop this service. Other option is to change the port of MySQL Xampp from 3306 to something else(like 3308). Here is how to do it :
# password = your_password
port = 3308
# The MySQL server
[mysqld]
port= 3308
$cfg['Servers'][$i]['port'] = 3308;
(Other wise this error will occur in while opening " phpmyadmin ": (HY000/2002): No connection could be made because the target machine actively refused it.
Save the changes.
Now, you have to mention this new port in your project code :
//After adding the port:
$conn = mysqli_connect("localhost:3308" , "root" , "", "database_name");
That's it.
Cheers!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.