I am trying to set up a database for a class project and we are using MySqlWorkbench 8.0. I am able to set up a database and connect to it locally but I cant seem to get remote connections to work. I have already researched the problem and here are a list of things I've already tried. (I am using windows 10)
I have looked at the my.ini file for the bind-adress property as this seemed to be the most common problem but it isn't even in the my.ini file.
I have added a user using this query to grant permission for others to connect using other ips
CREATE USER 'USER'#'%' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON *.* TO 'USER'#'%' WITH GRANT OPTION;
FLUSH privileges;
I have tried disabling my firewalls as well as just allowing connections to port 3306 to no avail
Anything would help. All of the answers i found online were outdated or pertained to the bind-adress which i cannot find in the my.ini file
Hmm, Let double-check these points: but this's NOT a problem of MySqlWorkbench
Same as you did so far. Update bind-address to 0.0.0.0 which accept all
Yes, It's same but double check by select user, host from mysql.user;
NO disable the firewall, add TCP port of mysql
If you're using a cloud server you have to add MySQL port in network policy setting, if you're using LAN you may need to open port in the gateway
When you make sure all work then I belive that you can connect via command line or MySqlWorkbench or any SQL Tools which support MySQL.
Related
I've looked in so many areas to try to fix this problem and I can't seem to find a solution. Im running ubuntu linux with the latest mysql and phpmyadmin installation. I found that connecting to the database locally works but if I try to connect remotely it keeps denying the connections. The only way I can login to phpmyadmin is if I put the ip address in the bar, connecting via the web address will not work.
Are you trying to connect to MySQL remotely or PHPMyAdmin remotely?
If you are trying to access MySQL remotely, you need to do the following:
Edit the bind-address variable in /etc/my.cnf, to 0.0.0.0 or the IP address of your server
Make sure your MySQL user has permissions from remote hosts, do this using:
CREATE USER 'myuser'#'localhost' IDENTIFIED BY 'mypass';
CREATE USER 'myuser'#'%' IDENTIFIED BY 'mypass';
Then:
GRANT ALL ON . TO 'myuser'#'localhost';
GRANT ALL ON . TO 'myuser'#'%';
Then go ahead and restart the mysql instance on your server. This also assumes you have set IP tables up to allow port 3306 TCP incoming to your server.
I am not so into DB and I have the following problem.
I have installed a MySql 5.7.17 on a remote Ubuntu 16.04 server and I have to connect to this server from a client installed on my laptop.
So The first thing that I have done is that I have changed the bind-address directive values (into the /etc/mysql/mysql.conf.d/mysqld.cnf file) from:
Bind-address=127.0.0.1
to:
bind-address = 0.0.0.0
to allow also external connection.
The problem is that when I try to connect from my client (installed on my laptop) I obtain this error:
Host 'XXX.YYY.ZZ.JJ' is not allowed to connect to this MySQL server
(where **XXX.YYY.ZZ.JJ* is my laptop IP address).
From what I have understood I also have to give to the mysql user w the db permissions to connect from any host and not just from localhost.
I think that it should be something related to the grant: https://dev.mysql.com/doc/refman/5.5/en/grant.html
What exactly have I to do? I think that I have to access to MySql from my server shell (via SSH) and then perform a query that grant some privileges to the root user (the MySql user) to allow to access from outside.
But I don't know what exactly I have to do. How can I allow this external connection for the roo user?
As you mentioned, you need to login to mysql server with root access and then run following command on mysql prompt
GRANT ALL PRIVILEGES ON your_db_name.* TO 'your_db_user_name'#'%' IDENTIFIED BY 'newpassword';
you can also specify a specific IP instead of %
GRANT ALL PRIVILEGES ON your_db_name.* TO 'your_db_user_name'#'your_IP_here' IDENTIFIED BY 'newpassword';
you can also specify a for all databases
GRANT ALL PRIVILEGES ON *.* TO 'your_db_user_name'#'your_IP_here' IDENTIFIED BY 'newpassword';
I have a MYSQL server running on my Windows 7 and I need to access it from a Debian VM but when I try I get this error :
ERROR 2003 (HY000): Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (110)
I checked in my.ini and there is no sign of "bind-address" parameter around so I just can't figure out where the error is.. I can perfectly manage it locally from my Windows. My company is using a proxy but as my VM is on my machine it shouldn't block anything there..
Thanks for your help !
You need to change user host adress as * or given xxx.xxx.xxx.xxx IP.
Look at here: grant remote access of MySQL database from any IP address
To access MySQL from outside. you should enable MySQL remote access .
1- Comment out following lines in Mysql Config(my.cnf/my.ini(for windows))
#bind-address= 127.0.0.1 (if not exist add it and then comment out)
#skip-networking
2- Save the file and restart Mysql server
3- Update GRANT privilege
By default, mysql username and password you are using is allowed to access mysql-server locally. So need to update privilege.
Run following query to update privilege
GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'#'%' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;
Change the 'USERNAME' to your Database user and 'PASSWORD' to User Password
You should check that:
"bind-address = 0.0.0.0" is present in your my.cnf
The user your are using has remote access (not just 'locahost')
Check that MySQL port (usually 3306) is opened if you have a firewall running
I would really advice to create a specific user for remote access with limited rights.
Finally I uninstalled everything and trieed again and it worked so now I close this ticket for good.
Thanks to those who have tried to help me !
I have mysql installed in an instance of google compute engine. I am able to connect to it via the shell however I want to use the MySQL workbench.
Is it possible to connect to it? I cant seem to make a connection.
Any help is appreciated,
Thanks!
Not sure if your shell is run local on host via ssh, so it's just a guess that your mysql Server is just accepting connections from localhost.
To change this open your my.cnf File (on Debian Systems saved in /etc/mysql/my.cnf) and comment the folloing Line:
change:
bind-address =127.0.0.1
to:
#bind-address =127.0.0.1
Be sure also to allow root connection from outside, modifying MySQL user table :
GRANT ALL PRIVILEGES ON . TO 'root'#'%' IDENTIFIED BY 'password';
SOehl's answer can be correct, however I did not comment. Instead i changed it to bind-address 0.0.0.0.
I am using a synology 713+ nas server, and just started using MySQL with it.
I created a database, a table and a user with '%' as host, so it should be able to connect from anywhere.
Using the local ip to the nas-server, I am able to connect to the database without a problem. But when I try using the external ip, I get the following message instantly;
'Unable to connect to any of the specified MySQL hosts.'
In the 'my.cnf' file, I have disabled 'skip-networking' and set 'bind-address' to 0.0.0.0.
I am unable to see the 'bind-address' variable in phpMyAdmin, so I am unsure if it is actually using it.
If I try to connect while the database is offline, I times out after 30 seconds, but when it is online it refuses instantly, which tells me that it is able to find the server, but not allowed to connect.
What in the world is going on, and what can I do?
Edit:
All ports on the nas are open, and my router is forwarding port 3306 to the nas.
Restarting mysql and the whole nas did not work.
I suspect the 'bind-address' variable is not being used...
I had a similar problem and I solved it this way:
Try to create a new user from sql command of phpmyadmin like this:
CREATE USER 'myuser'#'%' IDENTIFIED BY 'mypassword'; GRANT ALL ON *.* to myuser;
and use this user for the connection.
MariaDB 10 default port is 3307