Password character encoding error access denied occurred for the user in MariaDB
When trying to connect with DBeaver to the MariaDB with username and password, an error occurred:
Access denied for user 'hr'@'localhost' (using password: YES) Current charset is windows-1251. If password has been set using other charset, consider using option 'passwordCharacterEncoding'
The following commands are used to create an “HR” user in MariaDB:
create user 'hr'@localhost identified by 'abcdef!$39';
select user from mysql.user;
grant all privileges on *.* to 'hr'@localhost identified by 'abcdef!$39';
flush privileges;
show grants for 'hr'@localhost;
Solution:
- Try to set the UTF-8 Character Encoding in DBeaver while making a new connection. Start by creating a new connection for MariaDB in DBeaver.
Go to Database --> Select New Database Connection --> Select MariaDB --> Press Next --> Go to Driver Properties --> search for the property "PasswordCharacterEncoding" --? Update its value to "UTF-8" --> Test the connection or Finish

2. Solution(not sure): I tried to create the user “HR” again. I used localhost in earlier command but replacing ‘localhost’ with ‘%’ will fix my similar issue:
-- earlier commands:
create user 'hr'@localhost identified by 'abcdef!$39';
grant all privileges on *.* to 'hr'@localhost identified by 'abcdef!$39';
flush privileges;
--- Convert localhost to %:
create user 'hr'@'%' identified by 'abcdef!$39';
grant all privileges on *.* to 'hr'@'%' identified by 'abcdef!$39';
flush privileges;