I am trying to install and test a MySQL ODBC Connector on my machine (Windows 7) to connect to a remote MySQL DB server, but, when I configure and test the connection, I keep getting the following error:
Connection Failed
[MySQL][ODBC 5.3(w) Driver]Access denied for user 'root'#'(my host)' (using password: YES):
The problem is, I can connect with MySQL Workbench (remotely - from my local machine to the remote server) just fine. I have read this FAQ extensively but it's not helping out. I have tried:
Checking if mysql is running on the server (it is. I even tried restarting it many times);
Checking if the port is listening for connection on the remote server. It is.
Connecting to the remote server using MySQL Workbench. It works.
Checking if the IP address and Ports of the remote database are correct;
Checking if the user (root) and password are correct;
Re-entering the password on the ODBC config window;
Checking and modifying the contents of the "my.conf" on the remote server to allow connections from all sides (0.0.0.0);
Including (my host) on the GRANT HOST tables from mySQL (I also tried the wildcard '%' but it's the same as nothing);
Running a FLUSH HOSTS; And FLUSH PRIVILEGES; command on the remote mySQL server to reset the privilege cache;
Turning off my Firewall during the configuration of the ODBC driver;
Checked if the MySQL variable 'skip_networking' is OFF in order to allow remote connections.
What is frustrating is that I can connect with MySQL Workbench on my local machine (with the same IP/user/password), just not with ODBC.
What could I be doing wrong, or what could be messing up my attempt to connect with ODBC?
Update: I managed to set up the ODBC driver and get it running correctly on the server side. I can connect there to the localhost using a command line (with the "isql" command). But I still can't connect over remotely with my Windows 7 machine.
Solved.
As it turns out, it was a permissions problem. I ran the following command on the remote server SQL:
GRANT ALL PRIVILEGES ON *.* TO 'root'#'(my_host)' IDENTIFIED BY '(my_password)';
I had run the previous command, but without the "IDENTIFIED BY" password. Then, to reset the mysql permissions cache, I also ran
FLUSH PRIVILEGES;
And now it works.
Worked for me too only with 64bit odbc driver not for mySQL 32 bit.
We had a similar case that 'user'#'%' was granted at server but ODBC connect failed at a PC while workbench connect successfully.
MariaDB 10.0.31,
MySQL ODBC 3.51,
MySQL Workbench 8.0
Solved by install MariaDB Connector/ODBC 3.1 instead of the MySQL ODBC (https://downloads.mariadb.org/connector-odbc/).
Related
Description
I've downloaded MySQL installer 5.7.21 for Windows onto my windows 10 machine and setup a server on port 3306 (I see the server status is "Running" within MySQL workbench, and I've also confirmed this by looking in Windows "Services" settings).
I created a database on this server with a dummy table. I have no issue executing sql statements.
Within the Windows firewall I set both "mysql_port_3306" and "Port 3306" as "Allowed App"s.
In MySQL Workbench I connected to the server and issued the (deprecated) command
GRANT ALL ON *.* TO 'username'#'1.2.3.4' IDENTIFIED BY 'password';
with username, 1.2.3.4, and password replaced by my username, the IP address of my laptop (a different cpu than the one I'm setting this server up on), and the password.
On the laptop I created a new connection within MySQL Workbench with the following connection parameters:
Connection Method: Standard (TCP/IP)
Hostname: the full name of the computer hosting the database (which is also the server host name)
Port 3306
Username and Password: the same values set in the SQL statement above
Problem
After doing all this when I test the connection on my laptop the program goes into "Not Responding" status for a short time then becomes usable again without giving results for the connection test. If I try to connect I receive the following error:
Cannot Connect to Database Server
Are there other steps I need to take to connect to the server I've created? Most of the guides I read have to do with installing the workbench, starting the server, or connecting to a server which is already configured to allow remote connections, but I feel I'm missing a step.
Thanks!
Do I have to install MySQL on Windows to be able to connect to a MySQL server running on Linux and edit the files from windows ? Because I was installing the Workbench for SQL (I'm using MySQL Workbench Guide, Source: MySQL Workbench), then allow access to Linux (vps) from my pc, when I tried to install it, I'm stuck in the Windows config settings. Can someone help? (Screenshot provided.)
1 more thing: the program said "installing wmi" then "Could not set up connection: Could not connect to target machine."
you can install only workbench in windows without installing mysql server but you need to create a user on linux mysql server, who can then access it from the windows machine:
CREATE USER 'newuser'#'IP of the windows machine' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'newuser'#'IP of the windows machine';
FLUSH PRIVILEGES;
if you want the user to access regardless IP then you can use '%' instead of IP
I installed a MySQL database server on Centos 7 on a machine with local IP address 192.168.1.40. I run all the post installation checks to make sure that the database is up and running. (It is)
I then installed MySQL Workbench on a second Windows machine (ip address 192.168.1.3) on the same local network.
It is my understanding that remote connection to a mysql database are disabled so I run on the database the command
GRANT ALL PRIVILEGES ON *.* TO 'root'#'192.168.1.3' IDENTIFIED BY 'password' WITH GRANT OPTION;
then I added to the /etc/my.cnf the string
bind-address=0.0.0.0
and restarted the server
Trying to connect from the remote workbench to the server i get the error
Did I miss something?
I have a MySQL Server 5.5.32 running on Ubuntu 12.04. Ubuntu is being run on VM. Host platform is Windows 7. How can I connect with the Ubuntu's MySQL from Windows?
I have done the following so far:
GRANT ALL PRIVILEGES ON *.* TO 'root'#'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Running a show grant for root; displays this:
+-------------------------------------------------------------+
| Grants for root#% |
+-------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'#'%' WITH GRANT OPTION |
+-------------------------------------------------------------+
But when I try to connect to this server from SQLYog running on Windows, I get an error Error 2003 Cannot connect to mysql server on '192.168.xxx.xxx'.
The IP being feed to SQLYog, I got it from ifconfig. Supplied the inet addr.
inet addr:192.168.226.xxx Bcast:192.168.226.yyy
Is the address being used is incorrect or are these grant issues? Please advice.
You problem is that (probably) your mysql is bind to 127.0.0.1 instead of 0.0.0.0.
You should change bind in /etc/mysql/my.cnf to 0.0.0.0
bind-address = 0.0.0.0
And then restart mysql of course.
In newer versions of MySQL, instead of skip-networking the default is now to listen only on localhost
bind-address = 127.0.0.1
So you need to add your machine IP to here or simply comment it out if you are not worry about security concerns.
The error message Error No. 2003: Can't connect to MySQL server on 'localhost' (or some other host)
simply means that connection is not possible for one of the following (or similar) reasons:
There is no MySQL server running at the specified host
Connection to the MySQL server is not allowed using TCP-IP. Check the 'skip-networking' setting in the MySQL configuration file (my.ini on Windows, my.cnf on Unix/Linux). It shall be commented out like '#skip-networking'. If it is not commented out, then do it and restart the MySQL server for the change to take effect. SQLyog needs to connect using TCP-IP.
Some networking issue prevents connection. It could be a network malconfiguration or a firewall issue. We have experienced sometimes that some firewalls is blocking TCP-IP connections even if it claims to be disabled. Most often it will help to uninstall and reinstall the firewall.
When trying to connect to a MySQL server at an ISP this error message often indicates that direct connection to MySQL has been blocked. You must then use HTTP-tunneling or SSH-tunneling to connect.
I think the problem is with the Network Adapter settings in your VM settings
Do like this in your VM settings.
VM Settings -> Network Adapter Settings -> Select Bridged
The VM will connect to the physical network when the network connection is on bridged mode.
Try to ping the VM host in your windows machine after changing the network connection to bridged.
If the VM is pinging in your windows machine then it will work.
Error No. 2003: Can't connect to MySQL server on '192.168.x.x'
simply means that connection is not possible for one of the following (or similar) reasons:
There is no MySQL server running at the specified host
Connection to the MySQL server is not allowed using TCP-IP. Check the 'skip-networking' setting in the MySQL configuration file (my.ini on Windows, my.cnf on Unix/Linux). It shall be commented out like '#skip-networking'. If it is not commented out, then do it and restart the MySQL server for the change to take effect. SQLyog needs to connect using TCP-IP.
Make sure that you are able to connect to MySQL port using telnet
C:\telnet hostname/IP_address port
I have mysql DB on cloud linux server. I am able to connect db when I access it through the putty mean ssh connection.
But when I try to access this DB remotely by toad , it couldn't connect to the DB.
I tried edition my.cnf file also. But it has no entry regarding "skip-networking" or something which is preventing me to connect.
I couldn't understand why this is happening.
To connect to mysql server through remote computer, you have to give explicit permission particularly to your IP address or computer name
GRANT ALL PRIVILEGES ON *.* to '<username used to log in to mysql>'#'<IP Addess>'