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

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.

Related

Why phpmyadmin refuses to connect over localhost but accepts 127.0.0.1?

I just updated my mac to 10.13 and reinstalled my dev tools. While setting up phpmyadmin it was unable to connect to mysql using:
$cfg['Servers'][$i]['host'] = 'localhost';
phpmyadmin throws:
phpMyAdmin tried to connect to the MySQL server, and the server
rejected the connection. You should check the host, username and
password in your configuration and make sure that they correspond to
the information given by the administrator of the MySQL server.
instead I had to use to get it working:
$cfg['Servers'][$i]['host'] = '127.0.0.1';
In the past I could leave the default "localhost" and had no issues but it won't connect via socket any more.
My mysql user is 'root'#'localhost', using latest mysql, apache, phpmyadmin.
What could be the reason?
Thanks
Thanks to #N00b Pr0grammer's suggestion, I went trough the different solution still I figured it out.
On fresh installs of OS X, php.ini is turned off, and by default looks for mysqli.default_socket at "/var/mysql/mysql.sock" so I had to 1. rename php.ini.default to php.ini than 2. set:
mysqli.default_socket = /tmp/mysql.sock
and restart apache. Now phpmyadmin is able to connect to mysql via localhost as well.
There can be more than one reason for this to happen and the same has been discussed on this question as well. I suggest that you go through the answers provided on this question to resolve the error based on your environment that you hold.
This is the ServerFault question!
The common problem that I tend to see in dev environments is this:
You may have IPv6 enabled, its very possible localhost resolves to the IPv6 localhost, that is not defined in your MySQL config.

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

problems connecting to port 3306 mysql workbench with XAMPP

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

Trouble sharing MySQL database with other machines on our network

I have been trying to share a MySQL database across our internal network but I am having no luck getting it to work. I am using MAMP. I have edited the my.cnf template and commented out the bind-address line so it looks like this: #bind-address = 127.0.0.1
The IP of the machine that is hosting the MySQL database is 192.168.0.152. When I put this IP in when making a MySQL connection via PHP I get the following error:
Can't connect to MySQL server on '192.168.0.152' (61)
Obviously I am missing a step somewhere. What else am I need to do?

Mysql Workbench error "system error:61"

I have mysql installed several months ago. However I do remember using mysql workbench successfully at one point of time. Today I try launching it and get following error
Lost connection to MySQL server at 'reading initial communication packet', system error: 61
open /etc/mysql/my.cnf in a text editor and try changing:
bind-address = 127.0.0.1
to
#bind-address = 127.0.0.1
and then restart MySQL.
Try using the connection method: Local Socket/Pipe.
If you are trying to use the MySQL Workbench and connect through an SSH tunnel, you will get this error when your SSH connection does not complete successfully (e.g. improper host, password, key file, etc)
A good way to trouble shoot this is to separately test the the ssh connection from the machine you are trying to connect from and establish that you can do so succesfully.
I came across the same problem.I fix this below:
3306 port may be occupied by other process, so mysql change the port to 3307(or nearly other port 3308...).So when you connect,change the port to 3307 and try