I'm having a weird problem where I can connect to a certain database server from my local machine (and my friend can also connect to the database server from his local machine) but we can't connect to the database server from his AWS server.
What I get on the AWS server is:
"Can't connect to MySQL server on '<IP address>' ".
It's not as if the database server is only allowing connections from certain IP addresses; it didn't know about my IP address before I tried to connect.
Any idea what could be different about my AWS machine that could be making the connection not work?
Is the MySQL server inside the same network as the local machines? If so, it might explain why local machines can connect but the remote AWS can not.
By default, MySQL disables all remote connections. You can check if the remote connections are enabled. It could also be an issue with port block. MySQL uses port 3306 by default. Either MySQL or the AWS might not be configured to send data through the firewall on port 3306.
Here is a decent article explaining how to open these things up.
http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html
Related
I have several vms instances running in my vm player. Several of them are cent-OS acting as HTTP servers. The HTTP server is/are accessible over network. The HTTP server is on nginx.
Then I have a vm running on cent-OS having MySQL installed. And another vm instance running MS Server 2019 having MySQL Installed. Am using MySQL 8.0.18 on both these machines.
All these machines are on same sub-net and gateway. for example the IP of one of my vm having HTTP server is 192.168.0.133. And the machines with cent-OS having MySQL Server installed is having IP 192.168.0.140 and machine with MS Server 2019 having MySQL server is having IP 192.168.0.141.
Now the issue is am unable to access any of these MySQL servers from the network(LAN) or in other words am unable to access the MySQL server running on either .140 or .141 from the machine .133 meanwhile am able to access the HTTP server across the network.
But if I running MySQL server on the same machine having HTTP server. There occurs no problem whether I use 127.0.0.1 or localhost in my db host configuration
My application is based on a PHP framework known as laravel.
I have disabled firewall from both the above machines. The port 3306 is open on both machines. Am able to ping all machines with each other.
I had tried things like:
skip-networking(commenting out this one or just deleting),
bind-address(IP of the machine running MYSQL server),
grant privileges on an ip or from any IP to users/user,
flush privileges
Even modified iptables.
Am entering db host as the IP of the machine where MySQL is running.
The error am getting is SQLSTATE[HY000] [2002] Connection refused
You've nearly done it all right. Setting bind-address to the server's IP however means that you must connect via SSH.
Change the IP to 0.0.0.0 and restart MySQL, and hopefully that should be you all set.
i have configured the phpmyadmin's config.inc.php file and a drop down menu has appeared accordingly in localhost/phpmyadmin to select the server. But when i try to connect to the server it says:
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
i have added my ip address to the online host server in the cpanel and have access to the remote sql connection.
please help.
Most hosts block incoming connections to the MySQL server as a security measure. You'll have to ask your host about unblocking port 3306 and how to access your MySQL directly -- or run an API on your web host, which would have access to the MySQL server due to being on the same network, and access the database through that. For phpMyAdmin specifically, just install it on your web host instead of your local machine, then access it through the internet rather than localhost.
I'm trying to setup a new connection in MySQL Workbench to MySQL server on my other network computer named say: SERVER
Hostname: SERVER
Port:3306
Username and password I leave blank.
I'm getting "unknown server host"
SERVER has dynamic IP.
How do I provide the correct Hostname?
I don't think that you can connect to a computer of your network with its name only in MySQL Workbench.
So, if you can't allocate a fixed IP with DHCP to your computer running MySQL maybe you could use port forwarding in your router config (localhost:port -> computer2_ip:mysql_port) so you will be able to connect to localhost:port in MySQL Workbench. You could also create a tunnel between the two computer but I think this is rather a question for ServerFault.
I ma following this tutorial on how to connect to a remote MySQL server, however It seems the command doesn't work and often results in Operation timed out when trying to connect to the server:
ssh mysql.xxxxx.com
I can connect directly from my hosting account but not through the Shell on my Mac OS.
There may be a firewall or other network security device in place that prevents you from being able to connect from your Mac. Also, it is possible that the MySQL server is not configured to allow inbound network connections.
You might ask your hosting provider if they filter access to the MySQL port (default is 3306), or if your host is pre-configured with a firewall, and you might check your MySQL configuration file to ensure it is listening for inbound connections.
When you ssh into a remote server, and you do not specify a user name, ssh defaults to your current user.
bobs-macbook-pro:~ bob$ ssh server.acme.com
is the same as:
bobs-macbook-pro:~ bob$ ssh bob#server.acme.com
Try using your username when 'sshing' into the remote mysql machine.
There are two ways to specify your username, either one should work.
1. bobs-macbook-pro:~ bob$ ssh bob#server.acme.com
2. bobs-macbook-pro:~ bob$ ssh server.acme.com -l bob
I am setting up CakePHP for the first time in order to develop the server side of the website I'm building. I already have a database set up on a remote server. So I want CakePHP to connect to that server. That's not working. I get a notice "Cake is NOT able to connect to the database."
I've tried changing the settings in cake\app\database.php:
persistent: true or false
host: with or without prefix 'http://'
But none of that helps. All the examples I've seen have server set to 'localhost'.
Can anyone tell me if cakePHP can connect to a remote db? Or am I completely missing the point and should I be using the mysql server included in my WAMP set?
You have 2 options
Option 1
Your webhost needs to allow connections to the mysql instance from outside the local network.
Check the manuals for the webhost if you're allowed to change the mysql configuration yourself you may be allowed to accept incoming connections.
Your method only works when the host accepts incoming connections on for example port 3306 which is the default mysql port.
Option 2
If you have SSH access to the remote host, you're able to set up a tunnel.
Which would make you connect to the Mysql Instance though your SSH connection on a local port.
One way you could do this is by using PuTTY.
How to set up a MySQL tunnel in PuTTY
Initiate the connection and keep it alive.
Use the host 127.0.0.1 and port 3306 in your CakePHP Database config.
Username & Password would be your MySQL User Credentials