Accessing MySQL database server from Workbench on remote workstation - mysql

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?

Related

MySQL Server Remote Connect

I've set up a MySQL server through GCS VMs, Set up all of the required users, etc however I can't remotely connect.
I've opened the ports through firewall, given all the required permissions, made sure the server is running and just about every other method I've found so far. I checked the my.ini file (Using 8.0 on Windows 2012 R2) and found no 'bind-address' value or similar in the file.
I've assigned a static IP, ran:
"CREATE USER 'root'#'%' identified by 'password'; GRANT ALL PRIVILEGES ON *.* to 'root'#'$';"
and I'm getting the error
Cannot connect to database server...
unable to connect to...
any help to do with remote connection appreciated :)

Can't connect to remote MySQL server on Windows

I'm trying to set up a MySQL server on Windows that will allow another computer to connect to it remotely. The client computer is getting a 'Can't connect to MySQL server' error in MySQL Workbench.
Both computers are on the same network, and the server is using a static IP address (I have forwarded ports in my router to allow external connections to the public IP address).
What I've tried (suggested by other threads):
In my.ini, setting bind-address = 0.0.0.0 / commenting out bind-address / commenting out skip-networking
Running GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'#'IP' IDENTIFIED BY 'PASSWORD';. When I run this, I get the error Using GRANT statement to modify existing user's properties other than privileges is deprecated and will be removed in a future release; however I can confirm that in Workbench, the user's privileges are all checked (under the 'Users and Privileges' screen).
In my router settings, forwarded port 3306 on the server's static IP address
Disabling the Windows Firewall on the server.
Verified that the MySQL Server Windows Service is running.
Can anyone advise?
Ref: Try connecting with mysql cli instead of work bench from the remote machine, so u can isolate that cli client u r able to access the remote DB. because the following reason might be causing connectivity issue in Workbench.
mysql cli cmd
install mysql.exe client program
from cmd prompt> mysql -hhostname -uusername -ppass dbname
Cannot connect to Database server (mysql workbench)
In MySQL Workbench (5.2.47 CE)
click Mange Server Instances (bottom right corner)
click Connection
in the Connection box select:
Local Instance ($ServerName) - root#127.0.0.1:3306 '<'Standard(TCP/IP)>
click Edit Selected...
under Parameters, Hostname change localhost or 127.0.0.1 to your NetBIOS name
click Test Connection

how to connect to a mysql server running on a linux virtual machine in azure

I searched a lot but not able to solve that problem.
i am able to access MySQL server running on different windows machine. steps i have taken are
changing my.ini file bind address to 0.0.0.0
creating user and granting permission by GRANT ALL PRIVILEGES ON DATABASE.* TO user#'%' IDENTIFIED BY 'password';
from command line to windows MySQL server mysql -h windows server ip -u user -p
it works fine and from MySQL workbench i am able to connect for windows MySQL server from my machine. BUT when in Linux virtual machine i have done the same thing
changing my.cnf file and change bind address to 0.0.0.0.
creating user and granting permission by GRANT ALL PRIVILEGES ON DATABASE.* TO user#'%' IDENTIFIED BY 'password';
From command line to LINUX MySQL server mysql -h linux server ip -u user -p
but for that i am getting following error after giving password ERROR 2003 (HY000): Can't connect to MySQL server on 'linux server ip' (10060) also when connecting from c# by following connection string <add name="MySqlConnection" connectionString="Server=LINUX_VM_SERVER_IP;Database=database;Uid=user;Pwd=password" providerName="MySql.Data.MySqlClient" />
i am getting Error : Unable to find and specified mysql host
i have checked in LINUX_VM that 0.0.0.0:3306 is in listening status.
if i try to telnet LINUX_VM MYSQL Server service using />telnet
LINUX_VM_IP 3306 i got the ERROR : Connecting To
LINUX_VM_IP...Could not open connection to the host, on port 3306:
First, try to connect to the database on the VM hosting the database. If the connection is successful, then the configuration of the database is correct. Otherwise, please check the configuration of your database.
Second, if you are able to connect to database on the VM, then the most possible cause of this issue is firewall. Please check if the local firewall (iptables) allows inbound connection on port 3306. For test purpose, you may disable the firewall temporarily. Also, please check if the NSG has been configured properly to allow the inbound traffic on port 3306.
Besides, if the VNET has been associated with a NSG, then we need to allow the inbound traffic in the NSG too.

MySQL - ODBC connect fails, Workbench connect works

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/).

How to access MySQL from a remote computer (not localhost)?

I have my dev environment set up as a Ubuntu Server (with LAMP installation) inside a vmware. The vmware is running on my local windows 7 machine. When I try to access my mysql server via HeidiSQL program the connection fails. I get a:
Server Error 2003, can't connect to mysql server on <IP ADRESS HERE>
I can however access the db server via PhpMyAdmin. MySQL is running and my connection credentials and port are all correct.
I read that you should enter the IPs of the computer you are trying to connect from as the "bind address" in the my.cnf file. Which I did. I tried both the internal network IP as well as the online IP. Still no luck, same message.
Since this isn't a production environment I would ideally like to allow anyone to access that server, not limit it by IP. Especially since my ISP assigns dynamic IPS. So I would have to change it all the time, assuming that even works.
So does anyone know how I can connect to my MySQL server from a remote computer?
P.S. I assume this is something developers have to deal with that's why I posted it here and not Super User. If it must be migrated please send it to Server Fault not Super User.
Ok, be aware this gives the world and his dog access to your mysql server.
GRANT ALL ON *.* to '%'#'%' WITH GRANT OPTION;
But say you are on your home network of 192.168.1.2/16 then you can at least limit it like this.
GRANT ALL ON *.* to '%'#'192.168.%' WITH GRANT OPTION;
Another option is that you have a user and password but want to connect from anywhere
GRANT ALL ON *.* to 'mysecretuser'#'%' IDENTIFIED BY 'mysecretpassword' WITH GRANT OPTION;
first check the ip assigned to vmware using from cmd
ipconfig/all
suppose ipassigned to vmware is 192.168.11.1
now in vmware in ubuntu check the ipadress
ifconfig
suppose ip adress of ubuntu is 192.168.11.137
now open mysql configurations
sudo nano /etc/mysql/my.cnf
change the bind address to ubuntu ip address
bind-address = 192.168.11.137
restart mysql
now connect to mysql
mysql -u root -p
and create a user with all privileges and host ip of vmware i.e 192.168.11.1
GRANT ALL ON db.* TO user#'192.168.11.1' IDENTIFIED BY 'PASSWORD';
now try to connect from windows.
also open port of mysql
/sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT
restart mysql and try to connect on ubuntu host ip address 192.168.11.137
For Heidi SQL I was able to get it to work following the instructions on this article:
http://mysql-tools.com/en/articles/http-tunnel/73-heidisql-a-http-tunnel.html
It uses a program called HTTP Tunnel. It's a lot slower but at least it works. If you use Navicat it comes with a PHP file that you can upload to your server and it will connect via that.