1045 error when running mysqldump - mysql

When i am running mysqldump with user(lets say test) i am getting error message:
mysqldump: Got error: 1045: Access denied for user 'test'#'localhost' (using password: YES) when trying to connect
Although the database and user details are correct as i am able to login. Also when i use mysqldump without passing -p then it works fine and ask for user password.
mysqldump -u test -p dbtest > dbtest.sql
Enter password:
I tried to pass --port, -h 127.0.0.1 as mentioned in other threads but nothing works.

Related

Why is MySQL sometimes failing to connect to AWS RDS Aurora

I'm getting a bizarre behavior on an EC2 instance connecting to an AWS RDS cluster that I can't explain. With the exact same connection string, it works about 20% of the time. I at first thought it had to do with a Drupal installation issue, but I stepped back and tried directly connecting from the command line, and I'm getting the same thing. Here are some examples of the outcome:
[root#xxx]# mysql -u admin -h cluster-name-removed.us-east-1.rds.amazonaws.com -p
Enter password:
ERROR 1045 (28000): Access denied for user 'admin'#'10.1.18.15'
[root#xxx]# mysql -u admin -h cluster-name-removed.us-east-1.rds.amazonaws.com -p
Enter password:
ERROR 1045 (28000): Access denied for user 'admin'#'10.1.19.253'
[root#xxx]# mysql -u admin -h cluster-name-removed.us-east-1.rds.amazonaws.com -p
Enter password:
ERROR 1045 (28000): Access denied for user 'admin'#'10.1.18.15'
[root#xxx]# mysql -u admin -h cluster-name-removed.us-east-1.rds.amazonaws.com -p
Enter password:
ERROR 1045 (28000): Access denied for user 'admin'#'10.1.18.15'
[root#xxx]# ^C
[root#xxx]# mysql -u admin -h cluster-name-removed.us-east-1.rds.amazonaws.com -p
Enter password:
SUCCESS.
This also is similar to what I was seeing from Drupal: about a quarter of the time the pages loaded.
Those IP addresses are - I think private IP addresses that I've never seen in our network, so I don't know where they are coming from.
Any suggestions?
This isn't entirely an answer, but I've found two things that work. One might be a red herring.
If I use a connection string that contains the password in it - i.e. -pThePasswordHere - it would complain about a special character in the password, specifically a close parenthesis. When I connect normally, it would tell me Access Denied, but not complain about the parenthesis. Changing the password to not contain special characters made it work.
Creating a new user also made it work.
I didn't test making a new user with the old password with a close parenthesis though so can't say 100% which is the answer.

mysqlcheck return error message mysqlcheck: Got error: 1045: Access denied for user 'root'#'localhost' (using password: NO) when trying to connect

I am doing mysqlcheck command such as root#com-dev:/var/lib/mysql# mysqlcheck databasedirectory and you would think root will have access to any file system, but it returns this error message not sure what to do.
mysqlcheck: Got error: 1045: Access denied for user 'root'#'localhost'
(using password: NO) when trying to connect
How to overcome this error?
I could not find solution anywhere in the web, so I tried and found this solution: root#com-dev:/var/lib/mysql# mysqlcheck -u root -p databasedirectory You need to pass in username and password of db credentials as options and just as you run mysql command.

I have ubuntu installed with mysql .the below error keeps showing up

linux#ubuntu:~$ mysql
ERROR 1045 (28000): Access denied for user 'linux'#'localhost' (using password: NO)
linux#ubuntu:~$ mysql -u -p
ERROR 1045 (28000): Access denied for user '-p'#'localhost' (using password: NO)
linux#ubuntu:~$
I have ubuntu 14. installed with mysql on a virtual machine vmware .
The above error keeps showing up and I only see the solution everywhere on the internet as :
use "mysql -u -p" but still the error occurs.
It should have space, try this:
mysql -u {username} -p
if you didn't configure mysql(setting password for user), then use just
mysql -uroot, You should mention username.
You can set password for default user root by
mysqladmin -uroot password yourpassword
after setting password run
mysql -uroot -pyourpassword

MY SQL help - ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)

I am trying to copy an SQL database from the folder using this command:
sudo mysql -u root globe_bank
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
sudo mysql -u root -p globe_bank
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
I rang apple support and we changed the password of the root directory, they confirmed it was successful still getting this message. I have tried a few of the suggestions on similar threads, and mostly I get command not found.
When I type in mysql my connection ID is 19.
Any ideas or help is appreciated
I have faced the same issue on mysql Ver 15.1 on Amazon Linux 2 and the following worked for me:
Try entering the password on the same line.
I.e. instead of $mysql -u root -p, pressing Enter and then entering password after the prompt, do this:
$mysql -u root -p\<password>
Remember there is no "space" between -p and \<password>, I think you have got a space there!

error: 1045: Access denied for user 'user'#'123.10.123.123' (using password: NO) when trying to connect

I am trying to get a local snapshot of a database by running this command:
mysqldump --single-transaction --quick -u user -ppass -h somehost db_name | mysql -u user -ppass -h localhost db_name
Even though this has worked for me in the past, I am now getting this error back:
error: 1045: Access denied for user 'user'#'123.10.123.123' (using password: NO) when trying to connect
I can successfully log in with the username and password above:
mysql -u user -ppass -h localhost
and I have previously granted privileges to the user for the local database, e.g.
grant all on db_name.* to user;
I also find it strange that the error message is returning user#my_ip_address instead of user#localhost when I have specified localhost as the host. I'm also confused as to why it says using password: NO, as I've also provided a password.
It turns out that the remote host that I was attempting to download from had changed. Using the correct new hostname solved the problem.