Site icon New Generation Enterprise Linux

Solved: ERROR 1045 (28000): Access denied for user ‘dbuser’@’localhost’.

Today we will see one of the most common error message and its solution.

I. Error Message

[root@ngelinux001 oracledb]# mysql -D oracledb -u dbuser -pHello@123123
ERROR 1045 (28000): Access denied for user 'dbuser'@'localhost' (using password: YES)

 

II. Solution
Lets see how to grant the user permissions and solve this issue.

a. Login into mysql with root user.

[root@ngelinux001 objects]# mysql -h localhost -u root -pHello@123
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 6365205
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> connect oracledb

MariaDB [oracledb]> grant all privileges on oracledb.* to 'dbuser'@'localhost' identified by 'Hello@123123';
Query OK, 0 rows affected (0.00 sec)

MariaDB [oracledb]>

 

III. Test after granting permissions.

[root@ngelinux001 oracledb]# mysql -D oracledb -u dbuser -pHello@123123
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 6365540
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [oracledb]>

MariaDB [(none)]> quit
Bye
[root@vlis-oracledb ~]#

As we can see now the user can access the database and can now login into it.

0 0 votes
Article Rating
Exit mobile version