How to fix MariaDB Error 1045 - Access denied for user

12 March,2021 by Jack Vamvas

Question: I'm trying to logon to MariaDB via command line  and getting  the Error 1045 - Access Denied error on MariaDB running on RHEL. How can I troubleshoot & fix this error message?

 

mysql --user=my_user --password=my_pw --port=1601 --host=myhost

 

ERROR 1045 (28000): Access denied for user 'my_user'@'myserver' (using password: YES)

 

Answer:  As a first step check the logs to see if there are any other error messages

To find the location of the MariaDB error log file, go to the MariaDB cmd line:

SHOW VARIABLES LIKE 'log_error';

To tail the error log file, use the location obtained from the above command output :

$ tail -f /mypath/myserver.err

 

There are a number of reason this error can occur , here is a sample:

1) Incorrect host - check you can ping the host

2) User doesn't exist - check the user exists - 

3)User exists but no connect permissions exist - SELECT Host, User FROM mysql.user WHERE User='myuser'

4)Password is wrong  - Doublecheck password or you may even need to reset the password with the SET PASSWORD command

5) Bash converting special characters - Wrap password in single quotes to block bash converting the characters

 

 

 


Author: Jack Vamvas (http://www.dba-ninja.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on How to fix MariaDB Error 1045 - Access denied for user


dba-ninja.com