Specified port 3306 is already in use when installing MySQL - mysql

I had used MySQL earlier and then later uninstalled it. But now when I try to re-install, it says that "the specified port 3306 is already in use". Is there any way to solve this problem?
I tried this method to solve but it didn't help
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 the running instance has deleted successfully.

1.Go to Run
2.Type "services.msc"
3.Search MySQL in running status and stop it.
4.Refresh the server and now install.

If you are linux user,
Find the task that use port 3306 with command
lsof -i TCP:3306
Find the PID of the task and kill it with command
kill -9 PID_NUMBER

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 Files\MySQL
C:\Program Files (x86)\MySQL
C:\ProgramData\MySQL
And if exists, delete the folder from the location.
C:\Users[Your-User-Name]\AppData\Roaming\MySQL
Restart your device and check the status.
source: Microsoft

On windows Ctrl + shift + delete to open task manager. Go-to services and scroll down to MySQl80, right click on it and select stop. Restart your xampp and start MySQL.

Related

During Install I can not create users, and other issues with install

Good Morning Stack Exchange!
Trying to get mysql installed on my personal computer and I've run into a few issues.
I can not create a user during install, If I try to add a user during install it fails on the create users step. So I figure I will just add the users after install via sql workbench, which brings me to number 2.
After installing mysql server, attempting to connect to the server with mysql workbench just asks me for the password endlessly until it locks me out. I know the password I'm using is correct because when I modify the mysql server instance via the installer it asks for the current root password, adn the password works there.
After install, if I stop the mysql service from running mysql workbench loads without issue.
Mysql installer can not stop the mysql service, to modify an install I have to manually stop the service.
The common thread to all of these issues is the windows service for mysql.
Troubleshooting steps
verified port 3306 was open in the firewall
disable firewall entirely
Turned off anti-virus
uninstalled anti-virus
Multiple restarts of both the service and computer
Uninstalled all my sql components and reinstalled (multiple times)
changed the root password via command shell (via This MySQL guide for recovering the root password)
Downloaded the installer again in case there was a corruption of my original file.
So I'm pretty stumped, I've been at this for two days and I don't feel any closer to a solution.
Configuration info:
windows 10 (intel core i-5, 16 gigs of ram, 96 gigs of open space on SSD)
MYSql Installer version 8.0.13.0
The first thing I would check is the logs.
However, given the info you provided it sounds like default settings are there but no root#localhost user password or root#127.0.0.1.
Check the my.ini existence for details and logs.
You may have to follow this to create the config file if it doesn’t exist - follow the link below.
https://dba.stackexchange.com/questions/21835/mysql-workbench-asking-for-password
Error log location in windows:
The error log is located in the data directory specified in your my.ini file. The default data directory location is C:\Program Files\MySQL\MySQL Server......

Xampp MySQL not starting - "Attempting to start MySQL service..."

I've just installed XAMPP for Windows - should be the newest version (XAMPP Control Panel v3.2.1).
Apache is running just fine on port 80 and 443, but MySQL is not starting. When I press the start button, I get this message:
Attempting to start MySQL service...
Then a window pops up and asks me if I want to allow this, which I want. But nothing happens after that. I can press as many times as I want, but with the same result.
What can I do with MySQL?
If you have MySQL already installed on your windows then go to services.msc file on your windows and right click the MySQL file and stop the service, now open your XAMPP and start MySQL. Now MySQL will start on the port 3306.
I had an issue with this because I had accidentally installed XAMPP to c:\windows\program files (x86) which caused a Windows permissions issue.
The installation says not to install it there, but I thought it had said to install it there.
I uninstalled and reinstalled to c:\xampp and it worked.
After Stop xampp, go to configure and change the port 3306 to 3308 of mysql and save. Now start the sql......Enjoy
In the cmd type: services.msc Find MySql and change properties to the disabled.
In the control panel of Xampp uninstall MySql by the checkbox on the left side, and install again by the click in the same checkbox.
Windows 10 Users:
I had this issue too. A little bit of investigating helped out though. I had a problem before this one, that 3306 was being used. So what I found out was that port 3306 was being used by another program. Specifically a JDBC program I was trying to learn and I had xammp installed before I tried this JDBC out. So I deleted the whole file and then here I am, where you're at. The issue was that my 'ImagePath'(registry variable) was changed upon installing mySql again. To put it simply, xammp doesn't know where your mysqld.exe is at anymore, or the file is not in the location that you told it to be. Here's how to fix it:
Open run (Win + r) and type 'regedit'. This is where you edit your registry.
Navigate to: HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > MySql
Click on mySql and notice the ImagePath variable. Right click 'ImagePath' and click modify.
Enter the location of your xammp mySqld file (navigate through xammp to find it) Although it is likely the same as mine.
Cool Sources:
https://superuser.com/questions/222238/how-to-change-path-to-executable-for-a-windows-service/252850
https://dev.mysql.com/doc/mysql-windows-excerpt/5.7/en/mysql-installation-windows-path.html
Thanks dave
One of many reasons is xampp cannot start MySQL service by itself. Everything you need to do is run mySQL service manually.
First, make sure that 'mysqld.exe' is not running, if have, end it. (go to Task Manager > Progresses Tab > right click 'mysqld.exe' > end task)
Open your services.msc by Run (press 'Window + R') > services.msc or 0n your XAMPP ControlPanel, click 'Services' button.
Find 'MySQL' service, right click and run it.
Only stop My sql In Xampp For 15 Min After 15 min restart Mysql .If my sql running But Port Not Showing in Xampp then Click Config > my.ini edit this file and change port no 3306 > 3307 and save and Restart xampp .........
Only for windows
I have fixed the mysql startup issue by following below steps
Steps:
Open CMD and copy paste the command netstat -ano | findstr 3306
If you get any result for command then the Port 3306 is active
Now we want to kill the active port(3306), so now open powershell and paste the command
Stop-Process -Id (Get-NetTCPConnection -LocalPort 3306).OwningProcess -Force
Where 3306 is active port. Now port will be inactive
Start Mysql service from Xampp which will work fine now
Note: This works only if the port 3306 is in active state. If you didn't get any result from step 1 this method is not applicable. There could be some other errors
For other ports change 3306 to "Required port"
Ways to open CMD and Powershell
For CMD-> search for cmd from start menu
For Powershell-> search for powershell from start menu
Had this problem today, on a Windows 10 machine. Opened C:\xampp\data\mysql_error.log and looked for lines containing [ERROR].
Last error line was:
... [ERROR] InnoDB: File (unknown): 'close' returned OS error 206. Cannot continue operation
Important note: if your error is different, google it (you'll likely find a fix).
Searching for the above error, found this thread on Apache Friends Support Forum, which led me to the fix:
Open C:\xampp\mysql\bin\my.ini and add the following line towards the end of [mysqld] section (above the line containing ## UTF 8 Settings):
innodb_flush_method=normal
Restart MySQL service. Should run just fine.
Did you use the default installation path?
In my case, when i ran mysql_start.bat I got the following error:
Can`t find messagefile 'D:\xampp\mysql\share\errmsg.sys'
I moved my xampp folder to the root of the drive and it started working.
Hope it helps
If you have other testing applications like SQL web batch etc, uninstall them because they are running in port 3306.
I have the same problem. Finally found the solution:
The Relocate XAMPP option in the setup tool didn't correctly relocate the paths and corrupted them, I've manually changed the directories inside my.ini (base dir, data dir , ...). After that mysql started successfully.
The problem I had was changing the path of the Xammp folder in the system.
I can share how I solved the problem in my case.
It seems that somehow I had mySQL Server 5.7 installed. It didn't show on Add/Remove Programs list in Windows tough so I wasn't aware of it. I marked that after I looked up the XAMPP log.
Just after XAMPP launched it has shown in the log that there is a conflict in mySQL and indicated the folder where my mySQL Server 5.7 is installed. I removed mySQL 5.7 manually from Program Files (x86) and ProgramData folder, restarted and XAMPP mySQL started normally then.
I've tried only stopping the mySQL service but for me it didn't work. Only manually deleting all mySQL 5.7 folders seemed to have helped.
Everytime my MySQL starts, it will stop, then I noticed that some files are getting generated in C:\xampp\mysql\data. I tried deleting some files (like the Error logs, err file, etc.) on that directory. Back up first what you're going to delete to avoid losing data.
I don't know how it works. I'm just trying to enable HTTPS in my local machine but then suddenly MySQL can't be started. But now it's working.
I'm using Windows 10 and XAMPP 3.2.4.
This worked for me.
Search for Services in Windows Start
Find MySQL in it.
Right Click and Stop MySQL. Would work on XAMPP Now.
Note: If you wanna use the MYSQL prompt again, you will have to start the MYSQL from Service again.
In my case I had xampp installed with PHP 7.4.
But I needed PHP 8.
I downloaded xampp with PHP 8.
Installed it to C:/xampp8/ folder. When I started the new version, it started successfully.
But then I realized that I needed the database data from the old xampp installation. I stopped the new xampp(php 8 version) , and tried to start xampp (php 7.4 version) and saw that Apache started and was working fine, but mysql was not starting.
I tried many settings but couldn't start mysql from the old xampp.
Solution in my case to copy the data to the new xampp
I went to C:/xampp_old/mysql/data folder. And saw that each of my database has a separate folder inside data folder. I copied all the folders and pasted into
C:/xampp8/mysql/data/
Then I started new xampp and looked in phpmyadmin via browser and I got all my databases back.
In the xampp control panel, to the left of "MySQL" there is a green checkbox, click it to uninstall MySQL service. After that you can start MySQL from the same control panel. You can install those services again, it will still work.
What worked for me was to run xampp "as administrator". Fixed.
I solved this problem by removing all the information in the path
C:\xampp\mysql\data
And copy the information inside this path
C:\xampp\mysql\backup
In Windows, you should go: Start > Run > services.msc > Apache 2.4 > Properties > Start Mode > Automatic > Apply > Start > OK > [Same as MySQL]
if all solutions up did not work for you, make sure the service is running and not set to Disabled!
Go to Services from Control panel and open Services,
Search for Apache2.4 and mysql then switch it to enabled, in the column of status it should be switched to Running

Xampp Mysql wont start

I have read all the posts about this none fix it? please help ive even tryed re-installing my computer and reinstalling xampp
Errors:
00:33:43 [mysql] Problem detected!
00:33:43 [mysql] Port 3306 in use by ""C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin\mysqld" --defaults-file="C:\Program Files (x86)\MySQL\MySQL Server 5.1\my.ini" MySQL"!
00:33:43 [mysql] MySQL WILL NOT start without the configured ports free!
00:33:43 [mysql] You need to uninstall/disable/reconfigure the blocking application
00:33:43 [mysql] or reconfigure MySQL and the Control Panel to listen on a different port
00:33:43 [mysql] Attempting to start MySQL service...
Then i get a user account control to allow changes when i try to start mysql? something to do with net.exe? in C:\Windows, im not sure of the rest of the directory
If i say no to the user account cocntrol then it says this
00:33:49 [mysql] There may be an error, return code: 1223 - The operation was cancelled by the user.
If i say yes nothing happens? Apparently its windows 5.1 erroring? but the directory doesnt even exist? i deleted it all from Program Files and Program Files (x86), Also uninstalled all mysql components? Any thoughts
I had the same problem. I was using standalone MySQl for Java, and then I install XAMPP even after uninstalling stand-alone MySQL, XAMPP MySQL wouldn't start.
The problem is even after uninstalling MySQL MySQL service is normally still in the registry. The solution is to remove MySQL service from registry. The easiest way to do this, run XAMP-control in Administrator mode, and remove MySQL from service list and start MySQL again. That's it
Here is the way to know the program, use netstat -ao
You have the port and the associated pid.
Get the pid for 3306.
Then launch taskmgr
Show column pid (Menu > Select > Column selection > check PID)
You know the program which uses this 3306 port.
Kill it
Restart your XAMP
Then for not starting this "3306 port" program, launch services.msc.
It is certainly a MySQL, search for it and desactivate it at startup.
close Xampp server
go to C:\xampp\mysql\data
delete the ibdata1 file
restart xampp server
yes i already get this, the problem is that you already install MySQL as standalone version OR with VM i guess , and then you install xampp, the solution for that, is open process monitor, and close MySQL, MySQL Server 5.1 then you can start xampp and will work fine ^^
I just uninstall the register service using
sc delete MySQL
and restart my xmapp service; then it works OK.

Mysql service wont start on windows 2008 server r1

About a month ago, after I changed a startup parameter on mysql administrator, my server got frozen. So I rebooted. Ever since my mysql service wont start on startup or when I try to start it manually. I can only start mysql in console mode (mysqld --console).
I have tried many things but none of them worked:
I have uninstalled and rebooted the server and then installed again;
I have deleted everything in program files folder related to mysql and installed again
I have deleted all the related files in programdata folder
I have treid to use 3307 port instead of 3306 but still not worked
Now when I install mysql again it can never manage to start the service during the setup procccess, so it never manages to end of installation. But I can still start the mysql server on command line with "mysqld --console"
I tried to look into the event lgo , the only error I see is plugin federated is disabled, I looked for solutitions about this error but none worked for me. I believe this might be something abput windows. Any help appreciated.
Uninstall, delete and all the cleanup you did above.
Additionaly manually delete MySQL Windows service.
This can be done by command line using sc stop MySQL then sc delete MySQL.
Before installing, a reboot shouldn't be necessary.
Recreating the Windows service manually, if the installer doesn't do it for you, can be done using "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install (as the manual says).
If the MySQL installer has installed the service with on demand start-up type, you can edit to start automatically at boot using: sc config MySQL start= auto (the white space after the = sign is intentional and needed). Afterwards you can start the service using sc start MySQL.

Mysql service is missing

I have installed Mysql server locally and everything was working Ok but today when I tried to get a connection to the local db, I got an error. After checking services showed that the MySql service is missing.
What is the problem?
I have done it by the following way
Start cmd
Go to the "C:\Program Files\MySQL\MySQL Server 5.6\bin"
type mysqld --install
Like the following image. See for more information.
Go to your mysql bin directory and install mysql service again:
c:
cd \mysql\bin
mysqld-nt.exe --install
or if mysqld-nt.exe is missing (depending on version):
mysqld.exe --install
Then go to services, start the service and set it to automatic start.
I also face the same problem. do the simple steps
Go to bin directory copy the path and set it as a environment variable.
Run the command prompt as admin and cd to bin directory:
Run command : mysqld –install
Now the services are successfully installed
Start the service in service windows of os
Type mysql and go
I came across the same problem. I properly installed the MYSQL Workbench 6.x, but faced the connection as below:
I did a bit R&D on this and found that MySQL service in service.msc is not present. To achieve this I created a new connection in MySQL Workbench then manually configured the MySQL Database Server in "System Profile" (see the below picture).
You also need to install MySQL Database Server and set a configuration file path for my.ini. Now at last test the connection (make sure MySQL service is running in services.msc).
If you wish to have your config file on a different path you have to give your service a name:
mysqld --install NAME --defaults-file=C:\my-opts2.cnf
You can also use the name to install multiple mysql services listening on different sockets if you need that for some reason.
You can see why it's failing by copying the execution path and adding --console to the end in the terminal.
Finally, you can modify the starting path of a service by regediting:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NAME
That works well but it isn't as useful because the windows service mechanism provides little logging capabilities.
Go to
C:\Program Files\MySQL\MySQL Server 5.2\bin
then Open MySQLInstanceConfig file
then complete the wizard.
Click finish
Solve the problem
I think this is the best way to change the port number also.
It works for me