I’m trying to start MySQL from XAMPP (under Windows Vista), but it’s saying that’s port 3306 is busy.
What would be the best way with check what application is using that port and how to free it?
Dharman♦
30.4k22 gold badges84 silver badges132 bronze badges
asked May 26, 2011 at 9:27
4
Just Open task manager and Kill MySql service.
answered Nov 25, 2014 at 14:36
asasasas
2012 silver badges2 bronze badges
In a command shell, run:
netstat -b -p TCP
or
netstat -an | grep -i listen | grep -E 3306
The first command will output a list that you will need to look through for the line that displays localhost:3306
in the second column. Below this is the application’s name using the port.
The secondary command will find find the exact port you are looking for and looks something like this:
<example-name>:user <example-name>$ netstat -an | grep -i listen | grep -E 3306
tcp46 0 0 *.3306 *.* LISTEN
hanorine
7,1363 gold badges14 silver badges18 bronze badges
answered May 26, 2011 at 9:33
Linus KleenLinus Kleen
33.7k11 gold badges91 silver badges99 bronze badges
2
I had the same problem and was stuck on this thing for a day and I couldn’t find a perfect answer anywhere.
So I gave it a shot on my own and it worked. This solution is for Windows users. I use Windows 7.
My xampp control panel was displaying an error that port 3306 is busy and in use by some file (name was specified).. say «filename.de».
Now follow the following steps:
- press Ctrl+Alt+Del and open Task Manager.
- Open the «Processes» list and Check for «show all processes» under the list of processes. If you don’t see any such option, don’t worry! as sometimes administrator permission is required to show some processes.
- Now, when you click on «show all processes» button, all the process will be displayed.
- Now, switch to «services» tab in the task manager, and a list of services will be displayed. Now look for a service named «filename.de» <— filename that was diplayed in the error message in xampp.
- When you find that service, ‘right-click’, and then click in option.. GoTo Process.
- You will be redirected to the «Processes» tab with focus on a process corresponding to that service. ‘Right-Click’ and then click on «end process tree».
- Now, the issue has been solved! But might have to do the same thing again when you restart your PC. So it is best to keep your PC in sleep-mode.
- Otherwise, to solve this issue permanently, open «msconfig» and uncheck that particular process from the services list and click on apply. and you can restart your system.
Nev
1,51921 silver badges18 bronze badges
answered Aug 18, 2013 at 19:09
PrabhatPrabhat
811 silver badge6 bronze badges
0
I’ve been having trouble for hours on this error. I was trying to run MySQL from XAMPP after quite some time. It gave errors, similar to yours, it said that port 3306 is in use. If you:
- are running on Windows 10
- are avoiding to change the port number of MySQL from 3306
- can’t see any program using the 3306 port from
netstat
- reinstalling and deleting everything yet it still give the same error
- are enabling and using Hyper-V
- all of the other solutions didn’t work
This is the solution that worked for me:
- Go to the most right of the taskbar and right-click the connection icon, click
Open Network & Internet settings
- Click
Change adapter options
- Right-click and Disable everything that relates to Hyper-V
I ran MySQL again at now it works.
answered Jan 11, 2021 at 12:36
rareguyrareguy
611 silver badge5 bronze badges
2
As Mentioned By @Segun Emmanuel Run the Following Command:
netstat -a -b
You will get a list of Applications that are using different PORTS. Press Ctrl + F
and write 3306 to find out which Application is using PORT 3306.
After this, Go to Task Manager via Search Bar or by pressing CTRL + ALT + DEL
. Then Under the Background Processes, find out mysqld.exe
, right-click on it and you will find an option to close it, namely «End Task
«.
Then go to your Xampp Control Panel and start the MySQL service.
answered Mar 28, 2020 at 6:19
Kashif IftikharKashif Iftikhar
2841 gold badge9 silver badges28 bronze badges
1
If mysql is not starting in xampp, it might be a port conflict issue. Mysql run by default on port 3306. you need to check if another application is occupying that port. use following command to check app occupying a port
Linux: netstat -tulpn | grep 3306
Window: netstat -a -b
Mac: lsof -nP -i4TCP:3306
if you find an application occupying that port, stop the application and restart xampp. As an alternative, you can go to php.ini file or click configure in the xampp for mysql and change the mysql port to 3307
answered Mar 9, 2019 at 12:35
ABODEABODE
9182 gold badges15 silver badges12 bronze badges
In my case it was javaw.exe which was starting on port 3306. This exe does not cause problem if I am logged in using single user in my Windows 10. But if I have multiple logins, it starts this exe for each user and blocks MySQL to start on 3306 port.
Going to task manager and killing this exe for the other user fixed the issue and MySQl could start.
answered Aug 18, 2017 at 11:29
Windows icon -> Open cmd.exe.
Type netstat -a -b
.
Find what’s using it. In my case it was this:
So, I went to task manager. There were no process called so. The I went to services and disabled these two:
Now everything works fine.
Azametzin
5,16312 gold badges28 silver badges45 bronze badges
answered Apr 14, 2020 at 13:20
I had this problem (slight variation as I was using MAMP)
I found this problem was due to having MySQL Workbench installed, MySQL Workbench started the mySQL service on bootup which in turn stopped MAMP being able to use the port.
To fix this I had 2 options,
- Uninstall MySQL Workbench
- Open Task, click services tab, kill the current MySQL service
This then allowed MAMP to use port 3306
Dharman♦
30.4k22 gold badges84 silver badges132 bronze badges
answered May 10, 2016 at 13:36
AndrewBramwellAndrewBramwell
4941 gold badge7 silver badges26 bronze badges
This error occurs if you have installed mysql two times. mysql by default uses the port 3306. If you have installed it twice then already there is a mysql at your port number 3306. So you will have to change your port.
If you are using xampp then you can easily change your port. Steps to change port:
Step 1: Open your xampp as administrator.
Step 2: Click on ‘Config’ at the top right corner of your xampp.
Step 3: Click on ‘Service and Port Settings’ and after that change the main port of mysql from 3306 to 3307 and the click on save.
Step 4: Then click on ‘config’ which is in front of mysql and open ‘my.ini’ file which will be a text file.
Step 5: Now wherever in the text file you see the port number mentioned as 3306 change it to 3307 and then save the file.
After doing this again start your mysql server and it will start running on port 3307.
This worked for me and I hope it will work for anyone else who encounters the same issue.
answered May 8, 2021 at 12:08
This command kills the existing mysql process and perhaps one can start it afresh
sudo pkill mysql
It has helped me solve this challenge most of times
1. Turn off the application which is using this port, open terminal and run "lsof -n -P -i | grep 3306" to figure out.
2. Use different ports, right click on the server -> Edit.
answered Apr 19, 2022 at 17:53
For this problem, a simpler way on Windows is:-
- Go to Task Manager
- Go to Services
- There will be a services named MySQl80 right click on it and then select
«Stop» - Try and start the MySQl module on XAMPP server again
answered Jul 19, 2019 at 7:22
If you where not able to find any application or process listening on port 3306
, you might need to check your network adapters.
-
Disable adapters you do not use.
-
Pay also attention to the Hyper-V generated network adapter, disable it if you don’t need it. Sometimes it can reserve some ports and commands like
netstat
will not be able to find it out
Dharman♦
30.4k22 gold badges84 silver badges132 bronze badges
answered Sep 18, 2020 at 12:47
WilliemWilliem
1,1311 gold badge12 silver badges19 bronze badges
- Run XAMPP with Administrator
- If you already installed MySQL Service, Uninstall it and install again. If you not already install it install MySQL Service.
answered Feb 18 at 16:33
If you are on a Windows machine, I suggest you to follow the steps mentioned below to uninstall MySQL from the device.
- Step 1
Uninstall MySQL from Control Panel. To do so,
Go to Control Panel > Programs and Features > Select MySQL > Click on Uninstall.
After you have uninstalled MySQL through Add/Remove programs, you now need to remove the existing database information which includes your actual data. If you need any of that data, be sure to back it up. Next you can delete the data directory.
- Step 2
Run Command Prompt as Administrator
and execute the following command to stop and remove MySQL service.
Net stop MySQL
Sc delete MySQL
- Step 3
Click on Start, type in Show hidden files and folders.
Select the View tab and select Show hidden files and folders.
Now explore the following locations and delete following folders.
-
C:Program FilesMySQL
-
C:Program Files (x86)MySQL
-
C:ProgramDataMySQL
And if exists, delete the folder from the location.
- C:Users[Your-User-Name]AppDataRoamingMySQL
Restart your device and check the status.
source: Microsoft
Block
Are you looking to get certified in DevOps, SRE and DevSecOps?
There are two types of errors which occur in MySql are as follows:-
- Another instance is already running:- This error occurs when MySql has been installed by you in command-line (cmd) before installing XAMPP server.
▪Open cmd and run as administrator
▪So, type this in command-line (cmd ) = “sc delete mysql”
▪It will show you that running instance has deleted succesfully.
2. MySql port 3306 already in use error:-
Often , this error occurs when XAMPP or MAMP is used for configuring to start MySQL and PHP on system startup and by default MySQL uses port 3306.
We have to change this port from old to new one like this :-
▪Firstly you have to open XAMPP Control Panel.
▪Just click MySql config button->click my.ini file
▪It will open in Notepad , after that u have to find and change port no from 3306 to 3307 in two places
▪ Save it.
- Author
- Recent Posts
I have a problem with MySQL. I can access is locally (and via web phpmyadmin)
But I can’t access it from a remote computer.
Configuration:
- OS: CentOS7
- MySQL: MySQL Community 8
The port to the service is opened in the firewall. I can verify that via this command.
I also have two users in MySQL (an user with host localhost and an user with host %)
But when I check the port from an nother network. I can’t access it
Did I forgot something? Or did I made mistake?
Any help will be very appreciated
asked Jan 16, 2020 at 17:40
6
Typically you would edit the /etc/my.cnf
(this is the location for CentOS 7) file and make the following changes:
- Add the line:
bind-address = 0.0.0.0
- Comment out the line
skip-networking
by placing a#
in front.
IE:
[mysqld]
bind-address = 0.0.0.0
# skip-networking
The first line defines that this is for the MySql daemon. The second line tells MySql to bind to a network interface, 0.0.0.0
means all interfaces. The third line tells MySql to not skip networking configuration routines.
Note that other distributions may have the MySQL configuration file in different folder locations.
answered Jan 16, 2020 at 20:17
1
Make sure your firewall is open, that is something that can catch you.
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
This will verify port 3306 is open on your server and will accept connections to MySQL.
UPDATE: I didn’t see the part where you had the port open. Cancel this response
answered Jan 16, 2020 at 21:52
In mysql, Can’t connect to MySQL server on localhost error occurs when mysql is unable to connect to localhost due to the connection issue with mysql or a database configuration issue with mysql. You may see an error Can’t connect to MySQL server on ‘127.0.0.1’ when you connect to ip and unable to connect to localhost 3306. You can’t connect to mysql server on localhost or ip 127.0.0.1 (3306) because either the mysql server may not be started or it may not be running, or the network connection to the mysql server is not established, or the mysql server port is different.
Some times, the application can’t connect to local mysql server or mysql could not connect server may not be running or mysql unable to connect to localhost:3306. The application can’t connect to mysql server on ‘localhost:3306’.
If you are trying to access mysql server from a remote server, the error message “Can’t connect to MySQL server on ‘ localhost ‘” may be displayed in the application. This error occurs if the application is unable to connect to mysql server due to a variety of reasons. In this post, we will see the error message “Can’t connect to MySQL server on ‘ localhost ‘” and how to fix this error.
The error message indicates that there is a problem when connecting to mysql from the calling application. If you identify a connectivity issue, the error message will be fixed.
Can't connect to MySQL server on 'localhost'
Can't connect to local MySQL server through socket '/tmp/mysql.sock'
Root Cause
The error is shown in the application because the application was unable to connect to the mysql server. There could be a number of reasons. This issue is caused by a network failure.
The network failure could be on mysql server side or on the connecting application side. The other reason is that the mysql server is not running on the server. Mysql may be shut down manually, or mysql may not be running on the server machine due to some error.
Solution 1
If the database is running on the local machine, run the ping command with localhost. If the database is running on the remote server, ping the ip of the database server. In this way, we can validate the database server is alive or shutdown or network issue. If the ping does not respond, check that the server is switched on. Check that the network cable is connected correctly.
For local machine
$> ping 127.0.0.1
For remote server
$> ping <ip of the remote server>
$> ping 172.168.1.3
Solution 2
Check that mysql is running or not in the database server. The mysql server may be switched off or stopped due to some critical error. try to restart the mysql server. Check the following command to check whether the mysql server is running or not.
$> netstat -ln | grep mysql
fcc1dd9a70716e73 stream 0 0 fcc1dd9a734eb92b 0 0 0 /tmp/mysqlx.sock
fcc1dd9a707174b3 stream 0 0 fcc1dd9a732f1f7b 0 0 0 /tmp/mysql.sock
The command above shows the network status of the mysql command. The command below will show whether or not the mysql port is listening. The default port number is 3306.
$> netstat -ln | grep 3306
tcp4 0 0 127.0.0.1.3306 127.0.0.1.53815 ESTABLISHED
tcp4 0 0 127.0.0.1.53815 127.0.0.1.3306 ESTABLISHED
tcp4 0 0 127.0.0.1.3306 127.0.0.1.53814 ESTABLISHED
tcp4 0 0 127.0.0.1.53814 127.0.0.1.3306 ESTABLISHED
If the above two commands do not return the expected result, check whether the mysql process is running or not using the following command.
$> ps -ax | grep mysql
113 ?? 4:47.15 /usr/local/mysql/bin/mysqld --user=_mysql --basedir=/usr/local/mysql ... ... ... ... ... ... ... ... --early-plugin-load=keyring_file=keyring_file.so
Solution 3
If mysql is running, check the status of mysql service. If the server appears to be running. Stop the server and restart the service again. If mysql server is hung due to issues such as memory issues, the network issue will be resolved. Use the command below to check the service
$> sudo server mysql status
$> sudo server mysql stop
$> sudo server mysql start
$> sudo /etc/init.d/mysqld status
$> sudo /etc/init.d/mysqld stop
$> sudo /etc/init.d/mysqld start
Solution 4
The mysql server is running without error. Network issues have been resolved and no network issues have been identified. Now connect to mysql server using mysql command. You can also check using the telnet command
$> telnet 172.168.1.3 3306
$> mysql -u root -p -h <host name/ip>
if the port is different from the default port 3306
$> mysql -u root -p -h <host name/ip> -P <port>
Solution 5
If the above command is working successfully and you still see error in mysql. Check out my.cnf file. My.cnf file contains all configurations of mysql. Run the command below to find the location of my.cnf file,
$> mysql --help | grep my.cnf
or just run
$> mysql --help
Open my.cnf file and search for the word bind-address. If there is an existing change as below. If it doesn’t exist, add the line below.
to refer the localhost
bind-address = 127.0.0.1
to refer for any address
bind-address = 0.0.0.0
Solution 6
If all of the above steps are checked and configured, restart the mysql server. All changes will be updated and start with a new configuration. If there is an error in the configuration, mysql will throw an error and will not start the server. Run the command below to check and restart mysql server
$> sudo server mysql status
$> sudo server mysql stop
$> sudo server mysql start
Solution 7
Start the mysql server with install and initialize option and check the mysql server is running or not. if you are using windows, run the mysql server as admin.
C:Program FilesMySQLMySQL Serverbin>mysqld --install
C:Program FilesMySQLMySQL Serverbin>mysqld --initialize
Solution 8
If you are using windows operating system and mysql database is installed newly, then use “MySQL Installer – Community” from the menu to reconfigure. select “mysql server” in the product tab and click the “reconfigure” in the “Quick Action” tab. This will reconfigure the mysql database.
Have you ever encountered a conflicting port when starting MySQL on XAMPP? here is what I’m talking about
09:29:18 [mysql] Problem detected!
09:29:18 [mysql] Port 3306 in use by "Unable to open process"!
09:29:18 [mysql] MySQL WILL NOT start without the configured ports free!
09:29:18 [mysql] You need to uninstall/disable/reconfigure the blocking application
09:29:18 [mysql] or reconfigure MySQL and the Control Panel to listen on a different port
Here is one of the methods to solve this issue using the following steps.
Step1:
Stop the Apache server, if it is already running.
On the XAMPP Control Panel, click on Stop under the Module Apache on Action Column.
Step 2:
Edit the value to port
On the XAMPP Control Panel, under the Module MySQL click on Config on Action Column and select “my.ini”.
Step 3:
On my.ini- Editor window,
Scroll down to
# password = your_password
port=3306
socket="C:/xampp/mysql/mysql.sock"
Then change the port number from 3306 to 3307.
Scroll down to # The MySQL server. default-character-set=utf8mb4 [mysqld] skip-grant-tables=TRUE port=3306 socket="C:/xampp/mysql/mysql.sock" then change the port number from 3306 to 3307. Save file and close.
Step 4:
Close the XAMPP Control Panel and restart it.
Step 5:
Start the Apache server and then start MySQL, you will now see that MySQL is trying to connect to the xampp server through port 3307.
Conclusion
We have just learned how to solve the conflicting port when starting MySQL on XAMPP. If you need to know how to install XAMPP Step by Step on a Windows machine check this.
-
Главная
Список форумов
Ошибки Open Server
-
Поиск
-
- Текущее время: 05 июн 2023, 19:45
- Часовой пояс: UTC+03:00
-
Avalon
- Сообщения: 4
- Зарегистрирован: 28 авг 2016, 20:05
Невозможно занять порт 3306 поскольку он уже используется
Добрый день
У меня следующая ошибка:
Невозможно занять порт 3306 поскольку он уже используется: c:program filesmysqlmysql server 5.7binmysqld.exe
Как быть? Ведь MySQL мне тоже нужен.
Заранее спасибо за советы!
-
Avalon
- Сообщения: 4
- Зарегистрирован: 28 авг 2016, 20:05
-
Ростислаv
- Сообщения: 1
- Зарегистрирован: 16 ноя 2021, 11:56