MySQL connection from my desktop to remote MySQL not working - mysql

The error specifically says "Host ..com is not allowed to connect to this MySQL Server"
I have the correct userid and password which works fine on remote MySQL if I RDP and login locally.
The TCP port 3306 is not blocked as far as I am concerned. I used PortQry tool from my desktop and did "PortQry -n -e 3306" and I got "LISTENING" response.

Below is the excerpt from the mySql Docs
If the following error occurs when you try to connect from a host
other than the one on which the MySQL server is running, it means that
there is no row in the user table with a Host value that matches the
client host:
Host ... is not allowed to connect to this MySQL server You can fix
this by setting up an account for the combination of client host name
and user name that you are using when trying to connect.
If the following error occurs when you try to connect from a host
other than the one on which the MySQL server is running, it means that
there is no row in the user table with a Host value that matches the
client host:
Host ... is not allowed to connect to this MySQL server You can fix
this by setting up an account for the combination of client host name
and user name that you are using when trying to connect.
I hope this solves your problem.

Related

How does MySQL determine host of client when connecting remotely?

I'm trying to establish a connection to a MySQL server on a remote host. Both machines are running RH 7.5 and MySQL 5.7.
I can connect to the server as a root user. I did that, and used it to set up a secondary user like this:
CREATE USER 'foo'#'client-ip-address' identified by 'my-password';
and then
GRANT ALL PRIVILEGES ON my-db.* to 'foo'#'client-ip-addres';
That all went fine. But to my surprise, when I tried to connect using this new user, I got an error I wasn't used to:
$ mysql -u foo -h server-ip-address -pmy-password my-db
Access denied for user 'foo'#'some-hostname-not-an-ip.com' (using password: YES)
I know the IP address of the client (where I'm connecting from), which is why I set up the user with that value in the "host" column on the server. But the client is obviously trying to establish a connection using a value for "host" that is not the IP address. Instead it's some hostname, and not an IP address at all.
Where is this value coming from? How does mysql determine its own host when it tries to connect to a remote server? In the past I've only ever seen it use the machine's own IP address.

Cannot connect to MySQL database on home computer

Description
I've downloaded MySQL installer 5.7.21 for Windows onto my windows 10 machine and setup a server on port 3306 (I see the server status is "Running" within MySQL workbench, and I've also confirmed this by looking in Windows "Services" settings).
I created a database on this server with a dummy table. I have no issue executing sql statements.
Within the Windows firewall I set both "mysql_port_3306" and "Port 3306" as "Allowed App"s.
In MySQL Workbench I connected to the server and issued the (deprecated) command
GRANT ALL ON *.* TO 'username'#'1.2.3.4' IDENTIFIED BY 'password';
with username, 1.2.3.4, and password replaced by my username, the IP address of my laptop (a different cpu than the one I'm setting this server up on), and the password.
On the laptop I created a new connection within MySQL Workbench with the following connection parameters:
Connection Method: Standard (TCP/IP)
Hostname: the full name of the computer hosting the database (which is also the server host name)
Port 3306
Username and Password: the same values set in the SQL statement above
Problem
After doing all this when I test the connection on my laptop the program goes into "Not Responding" status for a short time then becomes usable again without giving results for the connection test. If I try to connect I receive the following error:
Cannot Connect to Database Server
Are there other steps I need to take to connect to the server I've created? Most of the guides I read have to do with installing the workbench, starting the server, or connecting to a server which is already configured to allow remote connections, but I feel I'm missing a step.
Thanks!

If the server on my mac is not running for MySQL, is can I try to run other databases on my machine?

I have a java project which connects to a MySQL database. Earlier it was working fine, but I think I messed up some of the configuration settings when trying to connect not via localhost. After messing around for hours and not making any progress (including completely reinstalling MySQL onto my mac and pc ( I was trying to connect these) ) I have given up and now am thinking of using some other database software like Postgre. Will the same error come up since its to do with not being able to connect as the server is not running?
The error at the moment is:
Your connection attempt failed for user 'root' from your host to server at 127.0.0.1:3306:
Access denied for user 'root'#'localhost' (using password: YES)
Please:
Check that mysql is running on server 127.0.0.1
Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
Check the root has rights to connect to 127.0.0.1 from your address (mysql rights define what clients can connect to the server and from which machines)
Make sure you are both providing a password if needed and using the correct password for 127.0.0.1 connecting from the host address you're connecting from

MySql Remote server connection access denied

I have created a free application using openshift, and created MySQL and phpmyadmin cartridges and inside my phpmyadmin I have gave access to all users from anywhere with all privileges now the problem is when I try to connect from my local MySQL workbench i get connected but I don't see my tables I have created in remote server using phpmyadmin and I can't do any action at all like creating schemas or tables where i get
ERROR 1044: Access denied for user ''#'localhost'
Remember that I allowed all privileges for any user, but I still get access denied for any action except only for the database connection.
Make sure the user you've given full permissions to is the same user MySQL Workbench is connecting as -- there's a difference between the hosts % and localhost for instance. From MySQL Workbench, issue the "Status" command and compare the username and host against what you've configured.
You're apparently connecting through 'localhost' so you have to give full permissions to the anonymous user with host localhost (or change your connection type to tcp so that your connection is via 127.0.0.1 instead of localhost).
Edit for further clarification: The MySQL permission structure treats different types of connections differently; a client connecting via TCP connection always appears to come from an IP address, even if it's from the "local host" (in the sense of being on the same machine), in which case that IP address of the incoming connection may be 127.0.0.1. Socket type connections are registered in MySQL as coming from the host "localhost" (literally, in this case). This is why we're verifying which host MySQL Workbench is connecting as.
Different connection types appear differently to MYSQL even if they're coming from the same "local machine." Furthermore, the wildcard host does not include 'localhost' socket connections, those are a separate entry in the permissions field with the 'localhost' host name; the wildcard does not apply, as I explained above. This is the reason why we're checking which permissions you set against what MySQL Workbench is connecting as; it's the most common cause of difficulties such as these.

Connecting to MySQL on AWS via Query Browser While Outside the U.S

I am running MySQL on an Amazon AWS Instance. I was able to previously connect to the MySQL Database via MySQL Query Browser. Now I am traveling outside the U.S. and I am having trouble connecting via the Query Browser. I am able to use Terminal to create an ssh connection and then login to MySQL, so it does not appear to be a larger issue with the MySQL Database.
Has anyone else had a similar problem? Any ideas how I can fix this?
This is the error I get from the MySQL Browser
Your connection attempt
failed for user 'admin' from your host to server at
ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com:3306: Can't connect to
MySQL server on 'ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com' (4)
Please: 1 Check that mysql is running on server
ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com
2 Check that mysql is
running on port 3306 (note: 3306 is the default, but this can be
changed)
3 Check the admin has rights to connect to
ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com from your address (mysql
rights define what clients can connect to the server and from which
machines)
4 Make sure you are both providing a password if needed and
using the correct password for
ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com connecting from the host
address you're connecting from
The only possible problem I see could be #4, but I ran and re-ran this command via Terminal:
grant all privileges on *.* to 'admin'#'%' identified by '<pass>' with grant option;