Can not connect to MySQL Server by 127.0.0.1 - mysql

I'm using Ubuntu 12.04 32bit AND MySQL Server 5.5.31
I can connect to MySQL Server with following command successfully :
$ mysql -u root -p -h localhost
But when i'm using 127.0.0.1 instead localhost can not connect :
$ mysql -u root -p -h 127.0.0.1
The error is :
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)
Any ideas would be awesome.

Maybe the allowed host for root is 'localhost' and your host doesnt map 127.0.0.1<->localhost correctly?
Try setting the host for this user to 127.0.0.1 or % (allow ALL ips to connect)

Have you uncommented the my.cnf's line
skip-networking

Please check this http://dev.mysql.com/doc/refman/5.1/en/can-not-connect-to-server.html for a solution.

Update my.cnf file to include the following line
bind-address=128.2.177.192

Related

ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1:3306' (111)

use the following command:
mysql -u root -h 127.0.0.1 -p
and the error message is :
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)
Who can help me to fix it?
Try this:
Check mysql.conf and sure that you have this: bind-address = 127.0.0.1 and comment it #
Then restart mysql service
If you use Macports, edit /opt/local/etc/mysql57/macports-default.cnf and comment skip-networking line.
After that, restart mysql server.

XAMPP and hidden service MYSQL DB cant connect

I am trying to remotely connect to my hidden service MySQL DB
mysql -u root -p -h 127.0.0.1 connected
works fine on local host
I am following this tutorial on reddit:
/r/TOR/comments/222bum/running_mysql_as_a_hidden_service/
I have xampp running on Ubuntu and and tor MySQL listens to port 3306 and Apache on 80
I am trying to connect to my DB remotely with command:
proxychains mysql -u root -p -h http://xxxxxxx.onion DBNAME
Getting this error:
ERROR 2003 (HY000): Can't connect to MySQL server on
'http://xxxxxxxxx.onion' (111)
tried this with socat
socat TCP-LISTEN:3308 SOCKS4A:127.0.0.1:xxxxj.onion:3306,socksport=9050
or
socat TCP-LISTEN:3308 SOCKS4A:localhost:xxxxj.onion:3306,socksport=9050
did not work in tor panel it says but only when i try to proxychains mysql -h 127.0.0.1 -u user -p P 33606
Sep 26 18:43:09.000 [warn] Rejecting SOCKS request for anonymous
connection to private address [scrubbed].
thanks for reply but still cant get it to work
root:/var/lib/tor/hidden_service$ proxychains mysql -u user -h TOR.onion database -p
ProxyChains-3.1 (http://proxychains.sf.net)
Enter password:
|DNS-request| TOR.onion
|S-chain|-<>-127.0.0.1:9050-<><>-4.2.2.2:53-<><>-OK`enter code here`
|DNS-response| TOR.onion is 104.239.213.7
|S-chain|-<>-127.0.0.1:9050-<><>-104.239.213.7:3306-<--timeout
ERROR 2003 (HY000): Can't connect to MySQL server on 'TOR.onion' (111)
GRANT ALL ON Databasename.* TO 'user'#'127.0.0.1
getting some error in console phpmyadmin SQL error
i m prety new to this any help is appreicated
mysql workbench works fine on localhost but when trying to add the onion instead of localhost it dosent work:******
Any suggestions thanks
Change your interface to 0.0.0.0 so external connections can happen (bind-address=0.0.0.0 in my.cnf or equivalent)
GRANT access to the external IP in MySQL: GRANT ALL ON <DB>.* TO '<user>'#'<external_ip>';

Connecting to a mysql running on a Docker container ubuntu 16.04

I have mysql container on docker. Mysql is running correcty now(because my application is running).
When I type docker-compose ps I see mysql is up. This is related part in pom.xml :
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://127.0.0.1:3310/fraud_dev</url>
<defaultSchemaName>abc_dev</defaultSchemaName>
<username>abc_dev</username>
<password>abc_dev_123</password>
I am trying to connect mysql on localhost terminal. I am typing this :
mysql -u 'abc_dev'#'localhost:3310' -p
I am typing password. Then I am getting this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I dont know where I am wrong. How can I fix it?
Thanks.
You do not use the standard mysql port 3306. Because of this you have to specify the used port with
mysql -u abc_dev -p -h localhost --port 3310

Connecting to MySQL through Cygwin

I have XAMPP running on my desktop and can connect to the MySQL server via phpMyAdmin. However, when I try to connect through Cygwin:
Error: Can't connect to local MySQL server through socket '/var/run/mysql.sock' (2)
I've tried connecting to MySQL on the same machine, my local dev server and my remote server, all failed.
mysql -h 127.0.0.1 -P <PORT> -u root -p
This is what worked for me. Make sure you check what is the correct port.
Check the mysqld PID with:
ps -sW | grep mysqld
And then find the PORT with:
netstat -nao | grep <PID>
Have fun!
you can also add the alias of itself.
alias mysql = 'mysql -u {user} -p{password} -h 127.0.0.1'

Can't get mysqldump to connect to local mysql instance (error 2003 / 10061)

I've got mysql 5.1 on a windows xp machine. It's listening on port 3308. I'm trying to use mysqldump:
> mysqldump -u root -pmypassword dbname > out.sql
Getting an error:
mysqldump: Got error: 2003: Can't connect to MySQL server on 'localhost' (10061) when trying to connect
Not sure what the problem is, looking at --help dumps variables and shows port=3308 as I set in the mysql installation (instead of default 3306). I don't think there's anything different with my installation. I also tried explicitly setting the port # on the command line but still same error.
Thanks
To connect through a port (and not the default 3306), use:
mysqldump -u root -pmypassword -P 3308 dbname > out.sql
Besides that, a simple test to see if MySQL responds at port 3308 is to try telneting:
telnet 127.0.0.1 3308
If MySQL is listening on port 3308, it'll respond with an error and the version running.
Go to run type services.msc
then
locate mysql service and start it .this solved
If your Mysql-Client is 5.5.16 please upgrade it to 5.6.10, this process worked for me if your mysql server is 5.6.10.