MySQL - Can't Connect Locally - mysql

I am setting up MySQL on an Ubuntu 11.04 Server and had a problem connecting remotely. I changed the bind-address property in the my.cnf file to be the IP address of the server instead of 127.0.0.1 loopback. Now remote connections work fine, but I can't connect to it locally with my local web app. How can I accomplish this? Thanks!

You can comment out or remove the bind-address from your my.cnf if you want mysql to listen on all IP addresses. Restart.

Related

Ubuntu + MySQL remote connections

I run two servers one being a web hosting and one being a VPS. I want to use my MySQL server on my web hosting and done everything possible but it still will not work. I started by running the mysql command to grant privileges and it showed that the command went through fine although I still got a refused connection on my web server. I then got told to comment out bind_address in the config but once again it failed.
How can I go about fixing this?
Thanks.
You have to allow mysql to accept requests from remote not only localhost.
To do that you should edit /etc/mysql/mysql.conf.d/mysqld.cnf and change from:
bind-address = 127.0.0.1
to:
bind-address = 0.0.0.0
and restart the mysql server with this command: systemctl restart mysql.service

Unable to connect to Mysql Database hosted on VM Windows Server using 3306 port

I have been trying to find a solution but could not fixed my problem. MySQL database is hosted on a remote server inside Virtual Machine, I have only rights to the Virtal Machne, I have tried following solutions but still my problem is not fixed: Added 3306 port for MYSQL in firewall settings, disabled the firewall, remove bind-address from my.ini files on my local machine as well as server and grant the priviliges from mysql client tool but no success. Can anyone help me out with this problem please?

"Host 'xxx.x.xx.xx' is not allowed to connect to this MySQL server"

In C#, windows forms, I'm trying to connect to a web server (for testing, 000webhost.com) and whatever I do it keeps saying "Host 'xxx.xxx.xxx.xxx' is not allowed to connect to this MySQL server" (where the X's are my WAN IP address).
If I do this on localhost, then it works perfectly fine, but whenever I try to connect to a database on any web server that exception gets thrown. Why does it do that and how can I fix it?
You must configure the MySQL server to allow connections from other computers than local host only.
probably there's a mysql configuration which prevents you from connecting outside localhost.
you have to bind all addresses permitted to connect to the server and comment out or delete line relative to skip-networking.
open your my.cnf configuration file (depends on machine you are on) but it should be on
/etc/mysql/my.cnf
delete bind-address line or set it to this value:
bind-address 0.0.0.0
comment out or delete it:
#skip-networking
reboot mysql server:
service mysql(d) restart
now you should be able to connect to it from any host.

How do I connect to my local MacBook MySQL form Vagrant VM Box?

I've set up Vagrant VM, it's working well for me.
Local MySQL is working good too when connection via localhost.
But I can't find a way how to connect via vagrant to macbook local MySQL.
The only visible IP to my vagrant is my local IP address of macbook: 10.0.0.4
It pings it, but this IP is not answering any requests to port 3306, though my.cnf config is set to:
bind-address = 0.0.0.0:3306
and Mac firewall switched off for a test.
I'm not sure what info to provide, let me know in comments and I will expand my question.
Thanks a lot
In terms of being able to access the instance of mysql running on your VM's host machine, you can use the ip that vagrant uses for its natted interface.
mysql -uroot -h 10.0.2.2
If you've configured a bridged interface for your vagrant machine then you can use the ip that your host has on the interface that you have bridged to with vagrant.
I've tested this with the brew installed version of mysql and it works when the mysql server on the host is bound on 0.0.0.0 or 127.0.0.1, i.e. mysql.server start --bind-address=127.0.0.1
You can connect from your vagrant box to local mysql using
mysql --host=10.0.2.2 -uroot -p

Mysql access remotely

I have deployed one django application on live IP adress Backend is Mysql running on the same IP.
There is pythoncard(GUI) application installed on some another DNS/Gateway.
I am getting 2003 can't connect mysql server on ...242* while executing.
Grant all and everything done but it is raising the same error. How do I connect to that host through internet or static IP.
HOw to resolve it? Mysql level or application level
Thank you
This is my.conf
[client]
port=3306
[mysql]
default-character-set=latin1
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3306
bind-address = 110.243.143.*** # SERVER IPADDRESS
# skip-networking
#Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/Program Files (x86)/MySQL/MySQL Server 5.5/"
Make sure MySQL is listening on your public IP. You can set this in my.cnf. The property you are looking for is bind-address.
Next, make sure your user is authorized to connect from a remote IP. You can adjust the permissions using the GRANT statement.