Access denied for user in mariadb

6.9k views Asked by At

i have a user in MariaDB with name 'boto' and host '%'

Grants for boto@%
+-------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `boto`@`%` IDENTIFIED BY PASSWORD '*000000000000000000000000000' |
| GRANT ALL PRIVILEGES ON `test_db`.* TO `boto`@`%` 

but i can't connect...

mysql -u boto -p test_db
ERROR 1045 (28000): Access denied for user 'boto'@'localhost' (using password: YES)

what's wrong? where to look for an error?

when creating it, the following algorithm was used:

mysql -u root -p
CREATE DATABASE test_db
CREATE USER 'boto'@'%' IDENTIFIED BY 'k*********h';
GRANT ALL PRIVILEGES ON test_db.* TO 'boto’@‘%’ IDENTIFIED BY 'k*********h’;
FLUSH PRIVILEGES;

when i SELECT User, Host FROM mysql.user; under mysql -u root -p i see:

boto %
root localhost

when i SELECT user(),current_user(); under mysql -u boto -p i see:

boto@localhost boto@% 
1

There are 1 answers

1
epynic On

is the user boto or bot ? your permission query says GRANT USAGE ON . TO bot

User can use the below query to verify the permissions

SHOW GRANTS FOR 'boto'@localhost;   

# Creating user
CREATE USER 'boto' IDENTIFIED BY 'mypassword';
GRANT USAGE ON *.* TO 'boto'@'%' IDENTIFIED BY 'mypassword';
FLUSH PRIVILEGES;

Ref