Access denied for remote cloudSQL from a cloud instance - mysql

I have two VM instances in google cloud console connecting to the same cloud SQL database, with no issues. I created a new instance and I can't connect it to the cloud SQL. The new instance was created as follows:
Clone an existing instance that works with the database.
Add the new ephemeral IP to the list of authorized networks of the database.
SSH to the new instance and connect to mysql with the same command that works on the other two instances.
Mysql connection is denied for the user:
$ mysql -u <user> -p -h <cloudSQL IP>
Enter password:
ERROR 1045 (28000): Access denied for user 'user'#'IP' (using password: YES)
Am I missing something? I have followed the documentation and I can't find any similar issue.

After one or two hours it was working. Changes took a while though. I tried restarting both the instances and the database, unsuccessfully. But time did the trick.

Related

AWS Lightsail to external mySQL connections failing

I created a new instance (bitnami WordPress) in AWS Lightsail. Everything works fine. I am trying to connect to an external MySQL server (outside of AWS) from this Lightrail instance.
I am using the command:
mysql -u user_name -h xx.xx.xx.xx -p
Unfortunately, I am receiving this error message. I am unsure why the Lightrail instance resolves the external IP (outside of AWS) to the local Lightrail instance.
ERROR 1045 (28000): Access denied for user 'user_name'#'ec2-xx-xx-xx-xx.us-east-2.compute.amazonaws.com' (using password: YES)
I have performed an extensive search and could not find any similar issues.
FWIW, I have tried to add skip_name_resolve to the my.cnf file in vain.
I hope someone has run into this situation and was able to find a solution.
I could open a ticket with AWS; however, given that I have a basic account, I cannot place any support calls with AWS. I appreciate your help in advance.

RDS Mysql ERROR 1045 (28000): Access denied for user #IP (using password: YES)

[This is not a duplicate question]
I have created a RDS MySQL instance with same Security Policy and under same VPC as my EC2 instance.
However when i am trying to access the Instance from EC2 machine i am getting error:
ERROR 1045 (28000): Access denied for user 'User'#'IP' (using password: YES)
Not sure if i am missing Anything.
In MYSQL setup we can resolve this error with added Privileges for User on the IP.Not sure how can we resolve this since i am unable to access the Instance itself.
Anyone faced this issue before?.
I have followed the Document: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Procedural.Importing.NonRDSRepl.html#MySQL.Procedural.Importing.Create.RDS.Database
mysql -h dandy-dbamazonaws.com[...] -u root -p
-h - put your endpoint
-u - username you set for your local mysql (root in my case). Don't confuse it with instance name
-p - after you hit 'enter' enter the password for your instance (the one you set up during instance creation)
hope it will work! that's how I resolved this issue
Maybe late but I had the same problem today.
Confirm the MasterUsername, with the AWS CLI running aws rds describe-db-instances or in the web console, showing the cluster details on the configuration tab.
Confirm the password, if you are using linux consoles (bash) some some characters may be problematic like # or !.
If you are using ssl connection you can't use --ssl-mode=DISABLED. You have to use --ssl-mode=VERIFY_CA (if you are connecting to endpoint) or --ssl-mode=VERIFY_IDENTITY (OR VERIFY_CA) if are connecting to server endpoint.
The goofy ones always get you: I experienced the same problem after changing the master password but let slip the important fact that by default changes don't take effect until the next maintenance window.
In my scenario I was connecting to an Aurora MYSQL serverless v2
Check you are connecting to the cluster writer instance endpoint
Modify the master password and apply changes immediately

Unable to connect to mysql remotely

I have a mysql database running on a VPS. I can ssh into the host and connect to mysql with no problems. I cannot connect to mysql remotely from my desktop. I have performed the following:
opened port 3306 on the firewall
added my local IP to the remote IPs accepted by mysql. This was done via CPanel
executed
GRANT ALL ON dbname.* TO username#'x.x.x.x' IDENTIFIED BY 'PASSWORD'
to tell mysql to let me connect from the specified address.
I execute the following from the command line on my desktop:
mysql -h x.x.x.x -u username -p
I get a password prompt which indicates I am past the firewall and mysql is responding. When I supply the password, it denies access:
ERROR 1045 (28000): Access denied for user 'username'#'x.x.x.x' (using password: YES)
Have I missed something?
The answer was given in the comments, so I will repeat it here to properly close the thread. alvits suspected that the remote user had not been created. It had been created but his comment prompted me to clean up the user table.
I deleted all remote users including loads that had been created by CPanel or migrated from another host. I then started from scratch doing create user and grant all and it works now.
Thanks!

Cannot connect MySQL when I specify users' host by FQDN

I'm runnning MySQL 5.6 on DB server and trying to conect from application server. (app1.example.org)
On DB server, user#app1.example.org is registered as user.
I logged in app1.example.org (CentOS 6), and tried to connect DB server.
[mylocalmachine]$ ssh phanect#app1.example.org
...
[app1.example.org]$ mysql -u user -p -h 123.456.789.012
Enter password:
ERROR 1045 (28000): Access denied for user 'user'#'111.222.333.444' (using password: YES)
111.222.333.444 is associated to app1.example.org in DNS.
When I add a user user#111.222.333.444 to MySQL and try above again, I can successfully connect to MySQL. But I don't want to do this.
IP address is a little bit hard to remember, and it sometimes changes because I'm using Google Compute Engine for app server.
I want to add only user(s) with host specified in FQDN. Is it possible?
I'm using Google Cloud SQL as DB server, BTW.
You can make it open ,and use it through username and password of your db,else you just make your compute engine IP static ,so that it won't change .

Problems connecting to remote MySQL database

When I try to connect to a remote mysql database I receive an error saying I was unable to log into my router's mysql database.
tom#main:~$ mysql -u appleton -p -h 85.17.xxx.xx
Enter password:
ERROR 1045 (28000): Access denied for user 'appleton'#'85.210.169.xxx' (using password: NO)
Even though I am specifying my IP (85.17.xxx.xx) in the argv the error message is showing my Router's external IP (85.210.169.xxx)
I discovered this whilst using DBI->connect in perl.
Am I missing something obvious?
'appleton'#'85.210.169.xxx' is supposed to show your host, not the database's host. It's your full identifier (username#host) for mysql to determine if you are allowed to connect. Do you have sufficient rights to connect to the database from your IP? Access can be granted to users so that they can only connect from localhost for example.
MySQL Docs on Users