problems connecting to port 3306 mysql workbench with XAMPP - mysql

I'm trying to learn the apache / mysql / php stack bundled with XAMPP. I can't connect to the MySQL server using the MySQL workbench:
Your connection attempt failed for user 'root' from your host to server at localhost:3306: Can't connect to MySQL server on '127.0.0.1' (61)
Thinking it's a port problem, I check the port directly in Terminal with the command telnet 3306:
telnet: connect to address 127.0.0.1: Connection refused
Obviously the problem isn't with the Workbench, but something to do with the port connection itself.
I'm using:
OS 10.8 Mountain Lion
XAMPP 1.7.3
MySQL workbench 5.2.47

Sorry all, I'm posting my own question and answer. I had this problem and it nearly destroyed me because I could not find the correct answer anywhere on the interwebz. I finally overcame it, and wanted to post my findings in case it helps another befuddled traveler.
It turns out when you install XAMPP and choose to run the security routines, it automatically turns on a setting in the MySQL preferences to block connections on port 3306 from localhost. To fix this, open my.cnf in the xampp folder xamppfiles/etc. Look for the setting "skip-networking" which tells mySQL to block the port 3306. Comment this out by adding a pound sign so it is "#skip-networking". Now, the telnet command should work, and you should be able to use the Workbench.
Hope this is helpful for somebody!If it fixes your problem, give me a shout at #mrcheeks3185.

I faced same problem but I solved it.
I changed the MySQL workbench port to 3307 in the file below
C:\ProgramData\MySQL\MySQL Server 5.7\my.ini
and keep the default port 3306 for XAMPP

for mac you should create only a user with password and grant access(in my case a I use root with password) and turn on ip address and use that address to connect with a client like navcat or workbench I use XAMPP 7.3
ip address network given by XAMPP
connection config in navcat
test connection

I found that file after mount the image disk created for xampp, there you can find new_disc_mounted/etc/my.cnf

If you do not have my.cnf you can first go to xampp->mysql->bin->my.ini, copy
the contents of the file, next create my.cnf (in the bin folder) and paste the content to the file you just created.
This works for me. I had the same problem. Now I can use both Xampp and Workbench on one PC.
There is an issue: when you start workbench you get some warning that some features may not work properly since database is not fully compatible.

If changing ports won't work. What I did, I just make sure both XAMPP and MySQL Workbench don't start the server at the same time. Just go to MySQL Workbench, Select Server > Startup/Shutdown > Shutdown.

its due to different version of xampp, open log file and check last status of mysql there is showing error find it or remark/change it

Actually XAMPP and MySQL workBench might be using same port an are conflicting "3306" in so you are getting that error
Please try changing the workBench's default port number to other number and try again

Related

Problem with mysql workbench and xampp server

I am trying to create a project with mysql. For the past two days I had been using XAMPP server for the mysql server and mysql workbench to use it and it has been working perfectly. Today after having to restart my pc for a windows update, when I turned on the XAMPP mysql server and tried going to my connection in mysql workbench, mysql workbench is giving me an error
Could not connect; Server may not be running Message: Lost connection to mysql server at 'waiting for initial communication packet'. system error 10060
I have tried multiple solutions; Changing the port of the mysql server. Using a different username and password, the root username. And have tried restarting my computer multiple times to fix the problem. If any more information is needed to find the problem I will update this question to provide more information.
UPDATE 1:
I left my laptop running and when I returned the workbench had connected successfully. I believe the problem comes from restarting the pc as the day after I posted this question I restarted my pc to fix a problem and I am currently having the same situation.
Maybe the problem is the Windows Firewall or the Antivirus.
If the server is running all the time and the service not stop, the port is blocked.
Check if the default port is Listening:
C:\Windows\System32>netstat -an |find "3306"
Or you can use the Microsoft Tool PortQry.exe download from:
https://www.microsoft.com/en-us/download/details.aspx?id=17148
Example of use:
C:\PortQryV2>PortQry.exe -n 127.0.0.1 -e 3306
Querying target system called:
127.0.0.1
Attempting to resolve IP address to a name...
IP address resolved to WF-SA02
querying...
TCP port 3306 (unknown service): LISTENING
C:\PortQryV2>
Might be an SSL problem. The problem is: XAMPP does not use SSL and MySQL Workbench uses SSL as a default setting.
You can select "If available" in the Use SSL dropdown box of the SSL tab of the connection pane. Use the tool icon in the startup window to edit already existing connections. Works in MySQL Workbench 8.0.28+

Using XAMPP and Mysql Workbench together

There are some related posts to this but I still can't figure this out. I have a working install of XAMPP(latest version) and MySQL Workbench 8.0.17 installed. I just want to be able to use Workbench with the MySQL that ships with the XAMPP install.
In the latest version of XAMPP, it first sets an IP address before I can start apache and mysql. MySQL seems to be running on port 3307.
Here is the Workbench screen to make a new connection. XAMPP is running on localhost - should that be my hostname?
If I try a localhost or 127.0.0.1 hostname with port 3307 (where I think XAMPP's MySQL is) I get this popup alert. If I continue, I still don't see any of my databases listed on the main screen.
This is the way I have used to connecting MySQL workbench to Xampp MySQL.
01) Click on the Plus icon.
02) Check the Xampp MySQL port number.
03)Type the connection name and check the port number with your Xampp MySql port number.
04) Click on the "Continue Anyway" button.
05) Then click on the "OK" button to save the connection.
06) Now you can see the connection you just created and click on it to connect to the MySQL database.
07) Just try to run some SQL code to if properly connected to Xampp Mysql.
I finally find solution on mac:
Notice that XAMPP server works on virtue machine inside with debian system and MoriaDB, so if you'd like to run Mysql WorkBench on MacOS outside, you must not use 127.0.0.1 or localhost as host name.
Please check your ip address of XAMPP on its panel General tab, mainly like 192.xxx.xxx.x, this is your host name!
And if you disable or uninstall mysql in your system, you can safely use default port 3306, or if you must use both XAMPP and local version, modify one pls.
Then, when it comes to user part, do not use root! Please add a new user in phpMyAdmin with hostname %, or open XAMPP terminal and use mysql instructions.
After filling all those above, Mysql will be able to start (although with warning, you can ignore it).
The way I 'fixed' this issue was to install an older version of xampp (5.4x) which ships with mysql, not mariadb. Before the install, I dumped all my dbs into a file and then imported them again after the install. Through XAMPP/phpMyAdmin I could see the fresh database. I tried to connect with MySQL Workbench and walla!
If you are on Ubuntu, run this command on terminal
sudo /opt/lampp/bin/mysql_upgrade
and then follow #prasadgayan 's answer above.
Note: It is a slight chance that your mysql_upgrade be in some other directory. If that's the case, run it from that path.
Please comment, if something similar work for Windows as well.
Namaste🙏
Reference: Tables could not be fetched - Error loading schema content
Normally the issue is that one is trying to use root as a user, which is somewhat prohibited. So just create a new user with the correct access privileges granted. Here's a solution, that worked on a Mac (but should be relevant to most OS's).
Start the XAMPP stack. For simplicity, open phpMyAdmin, by default accessible via 127.0.0.1:80/phpmyadmin/ or 127.0.0.1:80/phpmyadmin/ locally.
In case needed, log in with the username root and an empty password field.
Create or pick a database for the user, to grant access to, for example "test_db". Enter the following in any SQL prompt (which normally can be executed by pressing [ctrl] + [enter]):
create user userbob identified by 'Pass2bob!';
grant all privileges on test_db.* to userbob#localhost;
Note your Xampp IP-adress which tends to default to "192.168.64.2" and port 3306. Now you should be able to access that database.
I tested the connection with some PHP-code, which I included here and might come handy for someone. 3306 is default as MySQL/Maria the database port, but I left it here in case someone, sometime, have to use a different port.
<?php
$con = mysqli_connect("192.168.64.2","userbob","Pass2bob!","test_db", 3306);
if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); }
?>

Can't connect to MySQL server on 'IP' (111)

It is impossible to connect to mysql that I setup with phpmyadmin on a debian 8 VPS. I have been searching for hours, I have even followed this guide http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html but nothing, it seems imposible to get to connect to it, I even have created a phpmyadmin profile that is not on localhost and on %...
Thanks a lot for helping...
111 means connection refused, so make sure your mysql config is correct, and check your firewall.
Mysql config details (from Can't connect to MySQL server error 111):
If you have lines like this :
skip-networking
bind-address = 127.0.0.1
In your my.cnf configuration file, you should comment them (add a # at the beginning of the lines), and restart MySQL.
That's the first thing to try. Then try turning off any firewall and connecting again. That will tell you whether there's a firewall problem.

Wamp mysql : ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

I installed wampserver on my xp machine month ago.. Now when I try to connect to mysql via phpmyadmin or mysql console I get the error :
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost'
(10061)
Wamp icon in the tray is green meaning it's running ok.. I checked for mysql service and it's running and using the port 3306 .. I turned off the firewall.. I tried everything and it's not working.. I eventually uninstalled wamp totally and removed all its files and re-installed it again and same error.. When I try to telnet localhost 3306 it doesn't connect and I get the error :
Could not open connection to the host on port 3306: connect failed
I searched the web for hours, but didn't find any working solution. It seems that many people are having the same problem and most of them didn't find the solution.
Ok .. searching the internet for more several hours I've found one little clue that actually fixed my problem.
When I type netstat -a I get a list of active ports including 3306 (the one mysql uses). The Foreign Address column for some ports is 0.0.0.0.0 but for 3306 is [::]:0. I'm not a network guy but it turned out that it means it's a IPv6 port and it should be IPv4.
Adding the following line in the file my.ini under [mysqld] and restarting the service solved the problem.
bind-address=127.0.0.1
Note
My wamp version is 2.4 and mysql version is 5.6.12 running under win XP.
my.ini file for me is located at c:\wamp\bin\mysql\mysql5.6.12.
Hope this helps who suffered my pain.
In my.ini there is - for example -the entry
# Secure File Priv.
secure-file-priv="C:/ProgramData/MySQL/MySQL Server 5.7/Uploads"
If this path is not (further) existing, mysql cannot be started.
You have then to put an existing path.
I also did some research on my side I reconfigure the sql parameters then in the type and networking section you have to uncheck the open windows button Firewall ports for network access then you have to press next until closing without anything modify other

ODBC 3.51 Driver Can't connect to MySQL server on localhost (10061)

Exactly what the title said; I'm trying to configure an ODBC connection for MySQL 5.0, but upon clicking Test Data Source, it returns the above error.
I'm pretty sure most of you have seen this question before, and I did do some research before thinking about posting this, but so far, none of what I found and tried were able to help.
I'm using MySQL 5.0, running on Windows 7 32-bit. I can browse the database fine with the MySQL Query browser which means (I'm assuming) that the username and password are fine.
There is a 'MySQL 5 - Started' under Services. I named it that way because I had installed an older version of MySQL (3, iirc) for a project. Since I don't need it yet, I disabled it (it's not running).
Here's what I tried:
Firewalls were disabled to begin with.
Replacing the 'localhost' with '127.0.0.1' (Didn't work)
Going into Command prompt, cd to C:\Program Files\MySQL\MySQL Server 5.0\bin, and executing mysqld-nt (I have no idea what that is for, but it didn't do anything)
Running 'Telnet localhost 3306' in the Command Prompt returns 'Could not open connection to the host , on port 3306: Connect failed.
Stopping the service, going into C:\Program Files\MySQL\MySQL Server 5.0\data, deleting ib_logfile0, ib_logfile1, and ibdata1, and then restarting the service (Didn't work).
I'm assuming here that it might have something to do with the port 3306, as typing netstat -a in the command prompt gets me a list with no 3306 in it (as far as my eye can tell), so I'm not really sure how to proceed (port forwarding? Don't know how to do that).
Any help would be much appreciated. Thanks.
I had same problem before, please check your Mysql Service and make Startup Type as Automatic and Restart.
If you really tried most of the solutions and still didn't succeed, try to delete or rename(to any name) the ib_logfile0 and ib_logfile1 in the data folder of mysql. For me the path is wamp/bin/mysql/mysql5.6.12/data. because i am using wamp. And run the mysqld service. May it helps you. Good luck.
MySQL server might got stopped.Please check the status of MySQL server in the services if it got stopped please start the services and try to connect again.
You said
Replacing the 'localhost' with '127.0.0.1' (Didn't work)
For my network (in mysqld.cnf) replacing 127.0.0.1 with 0.0.0.0 just worked... connected.