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
Leave a Reply