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.
Related
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.
I deploy a mysql service on my company remote develop CentOS machine, I'm sure the service is turn on, and it can be access from an other reomte linux machine.
However, I can't connect it from my own Windows PC. I tried mysql workbench client and HeidiSQL client, both failed. I can ping through the remote IP address. I have tried anything I can found on google. Like
add bind-address = 127.0.0.1 to cnf file, and comment out the skip-networking.
I also tried the answer on another question Can't connect to remote server using MySQL Workbench on mac, which allow all machine can access to the service.
But my PC still can't connect to it, which report code 10060 error. So what should I do?
That bind-address = 127.0.0.1 config option means that your mysql server only accepts connections from the localhost, which is your actual CentOS machine. Make sure to set bind-address = 0.0.0.0.
Also, make sure that:
you have connectivity from your windows machine to the CentOS one
no firewall blocks the external connections to the local mysql port
Regarding potential security concerns from opening your mysql instance to the whole internet - first make it work, then make it better
I had the same issue here man,and i discovered that we need to create a user that isnt the root user. I my case, i don't know why yet, the issue was that.
The solution
Steps:
1 - Check the firewall (create a rule for port 3306 or disable it).
2 - Comment the line # bind-address=0.0.0.0 at [mysqld] config optin in C:\ProgramData\MySQL\MySQL Server 5.7\my.ini
3 - Create the user to remote access:
mysql> CREATE USER 'net'#'%' IDENTIFIED BY '123';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'net'#'%' WITH GRANT OPTION;
In my case, solved.
I recently installed a LAMP stack on an ec2 instance that's running Ubuntu Linux. I followed the instructions found here. I also installed phpmyadmin. To the best of my knowledge, while I was installing MySQL, I answered no when prompted to answer the question Disallow root login remotely? I could be mistaken though. I've read elsewhere that in order to allow root login remotely, I would need to edit the mysql .conf file found in the /etc folder somewhere and edit the bridge setting.
I've tried connecting by doing the following:
$con = mysqli_connect('ec-2 ip address', 'root', 'root', 'db_name');
if(mysqli_connect_errno($con)) {
echo mysqli_connect_error($con);
die;
}
This is the error message I get when I connect:
Can't connect to MySQL server on '54.201.165.105' (61)
I ended up answering this myself after just doing a little bit of research. Turns out that the security groups pn AWS had nothing to do with the problem. I had to go to the file at /etc/mysql/my.cnf and comment out the line that read bind_address = 127.0.0.1. Then I had to execute an SQL statement in phpmyadmin that went like this
GRANT ALL PRIVILEGES ON *.* TO 'root'#'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
Thanks for all of the help though, guys. I appreciate it.
You need modify the AWS Security Group for the instance and set firewall rules to allow 3306 inbound traffic as well as modify the OS firewall rules to allow the same traffic.
As the screenshots show, I have the accounts setup to allow remote connections but as shown in the second screenshot I still cannot connect remotely.
I use for testing in the virtual machine (Ubuntu 16.04), for me, I fixed the error changing the file 50-server.cnf.
My server is Ubuntu, so changing the file below:
50-server.cnf
The path of this file:
/etc/mysql/mariadb.conf.d
PS: Create a backup of the file before the change.
Only change in file the bind-address 127.0.0.0 to bind-address 0.0.0.0
After this restart service and try again.
Regarding that user, need to allow for external connections.
I hope that this info helps you.
Mysql by default binds to 0.0.0.0 which is all interfaces on your system. Which means you can already connect from another computer. The issue is perhaps permissions. You can enable remote connections by running the following command:
GRANT ALL PRIVILEGES ON *.* TO 'root'#'192.168.%' IDENTIFIED BY '' WITH GRANT OPTION;
MariaDB packages bind MariaDB to 127.0.0.1 (the loopback IP address) by default as a security measure using the bind-address configuration directive. Old MySQL packages sometimes disabled TCP/IP networking altogether using the skip-networking directive.
Steps to allow remote connections are provided in the MariaDB Knowledge Base at https://mariadb.com/kb/en/mariadb/configuring-mariadb-for-remote-client-access/
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