How to fix 'Can not connect to MySQL server' error? - mysql

First of all I apologize for my English is not perfect.
I'm trying to connect to mysql database remotely.
I have already done the basic steps such as, for example, comment the bind address in my.cnf.
I gave permissions to the appropriate users in MySQL.
I tried with my friend to do it connect to the database, and it worked but we were in the same room with the same router.
Now I'm home and I tried to connect my friend, but I always get error:
ERROR 2003 (HY000): Can not connect to MySQL server ....
Maybe it's a problem of my home router? I can not even do the telnet.
P.S. I've also taken steps to set the firewall.

Some reasons for that,
mysqld is not running on the local host. Check your operating
system's process list to ensure the mysqld process is present.
You're running a MySQL server on Windows with many TCP/IP connections
to it. If you're experiencing that quite often your clients get that
error, you can find a workaround here: Section B.5.2.2.1, “Connection
to MySQL Server Failing on Windows”.
Check whether the server is running on that host by executing telnet
some_host 3306 and pressing the Enter key a couple of times. (3306 is
the default MySQL port number. Change the value if your server is
listening to a different port.) If there is a MySQL server running
and listening to the port, you should get a response that includes
the server's version number. If you get an error such as telnet:
Unable to connect to remote host: Connection refused, then there is
no server running on the given port.
Look at this mySQL full documentation, it will be helpful.

Related

"Cannot Connect to Database Server" error connecting from MySQL Workbench to SiteGround MySQL Database

Situation:
I am trying to connect to my SiteGround server MySQL database directly from my local machine using MySQL Workbench. I am positive that the connection properties are entered correctly as the connection works if I am connected to Network A (phone data plan). But with Network B, the connection failed.
I allowed remote access to my server from my Network B IP, in fact, I allowed all IPs just for testing, therefore Network A is working.
I checked if there is any setting that blocks the port from my router and modem in Network B, but I found nothing.
I tried running netstat: nothing with port 3306.
I tried running telnet: "connect failed"
Question:
I am suspecting that my ISP has blocked the outgoing port 3306? Is there anything I can do to "unblock" it?
Or is there any workaround for connecting to my server database?
My connection set up screenshot:
Error screenshot:
Thank you in advance for your time and help!!

SSH tunnel to MySQL database

We're in the process of setting up Tableau connectivity to our company's sales database and so far, the people that have been attempting to connect (they're from some other company) keep getting denied. The errors they're getting are as follows.
Unable to connect to the ODBC Data Source. Check that the necessary drivers are installed and that the connection properties are valid.
Can't connect to MySQL server on '[IP address] (61).'
Unable to connect to the server '[IP address].' Check that the server is running and that you have access privileges to the requested database.
Today we opened ports 3306 and 20560. We were hoping we could set up some kind of port forwarding thing so that they connect to 20560. I'm not sure what we need to do to set that up, however. I was also told that SSH tunneling is an option, but connecting with PuTTY doesn't yield any results.
I'm at a complete loss as to what I need to do to allow them to connect. I'm also not sure that opening port 3306 is safe and I'd like to know if I should have it closed. I randomly picked port 20560 because it's not being used for anything. We don't want just anyone to connect, but I've been told that the IP address connecting to our database may not be static.

"Host is not allowed to connect to this MySQL server" over network

I am attempting to connect Tableau on a client (Windows 7) to a MySQL Server 5.6 (on Windows Server 2012 R2) that is hosting my data warehouse. This server is hosted on my university's network. Here is what I have done so far:
created a user that has privileges it needs (I ran GRANT ALL PRIVILEGES ON the user with FLUSH PRIVILEDGES, based on some other stack overflow posts)
made sure the host specified in the user table is "%"
made sure there was nothing in the my.cnf file that would prevent external connections (again based on another stackoverflow post)
ensured that the edition of MySQL running on the server is 64 bit, like the version of Tableau I'm running
I still get the "[MySQL][ODBC 5.3(w) Driver]Host 'vpn240-74.vpn.utah.edu' is not allowed to connect to this MySQL server" error. This same error is thrown when I try to telnet to the port on the server MySQL is listening on.
I have found that this error persists whether I am connected via a vpn or on campus. I can RDP to the server in question, ping it, and found the firewall rule for the port I am using, so I don't think there is anything network related that is stopping me.
All my stackoverflow research says that error means MySQL is convinced that the user is not allowed to connect from that specific hostname, but I get the same error whether I change the entry in the user table to be "%" or the specific hostname from the error message.
Also I see that the Tableau MySQL driver I installed is a lower version number than the MySQL instance I'm trying to hit (5.3 vs 5.6) but that is the newest driver on the Tableau site that I can find.
Any help greatly appreciated.
Have you tried making an ODBC connection in your computer to your MySQL server and testing it that way?
Tableau can then connect via an ODBC connection made rather than the explicit Tableau MySQL driver. In Tableau under More Servers... Other Databases (ODBC) shows up at the very bottom.

Unable to connect to MYSQL on a remote computer

I am working on windows and having a remote desktop connection of another machine. I am trying to connect to the mysql running on the remote machine through my MySql workbench, installed on my machine.
When I specify the details to connect to mysql i.e.
IP- a.b.c.d
port-3306
username=root
password=
But everytime it shows me an error saying-
Your connection attempt to connect to user='root'failed from your host to server at a.b.c.d:3306
Is it possible that I can connect to mysql on a different machine?
Certainly that is possible, mysql is a network transparent service. However obviously the normal access authorization rules apply.
do you have network access to the mysql port, this might be blocked by a firewall. You can check that by using telnet ip-address-of-server 3306. Does the server answer or do you get a timeout or are blocked? (the answer would look cryptic, soomething like 5.5.33-MariaDB[*[n7p~g!�iXccI$r9``Y{$mysql_native_password or similar )
the mysql server can be configured to not listen to remote connections. This can add security to the setup, but would obviously block any remote connection attempts. You will have to check the configuration files of mysql for that.
mysql itself implements an authorization level. So check if that 'root' user actually is allowed to connect from the outside. Those authorizations are stored in the internal "mysql" database.
Also it is not clear from the question what your network topology is: is the mysql server running on that system you have a "remote connection" to? Is the mysql-workbench running on that remote system or on your local system? This might affect the ip address you have to use inside the workbench.

Mysql not generating log when connection fails

I am continuously getting below error while connecting to mysql-
Can\'t connect to MySQL server on /ip/address
but mysql is not generating any log for this error. I have below entries in my.cnf file
log=/var/log/mysql_err.log
log-error=/var/log/mysql/mysql_error.log
I am using correct credentials. No issue of conections.
Now how will I determine the exact issue If I'll not get any log ?
Any Idea, how to solve this ?
This is not surprising:
the server can only log an incident it is aware of. However your client does not even reach the server at all! So how should the server know some client has attempted to contact it?
The error message you get clearly indicates that you do have a connection issue.
You can easily make a test to check the most common problems: just open a telnet connection from the system trying to connect to the system the sql server runs on, connect to the mysql port: telnet <ip-of-mysql-server> mysql
On typical unixoid systems "mysql" will be substituted by the "well known port number of mysql, which is 3306. otherwise you have to specify it manually. Do you get a connection at all? I would guess not. This means either the mysql server is not listening where expected (not running or configured otherwise) or the connection is blocked on network level (firewall).