Access denied for user MariaDB error password Character Encoding

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:

  1. 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;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.