-1

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@% 
Inksis
  • 15
  • 1
  • 6
  • @Progman how can I check this? I thought I only created a user - user@% and did not create a user@localhost. when I go to mysql-u boot-p and enter user(),current_user(); I get user() - bot@localhost and current_user() - bot@% – Inksis Aug 29 '21 at 09:00
  • Please [edit] your question to include the SQL statements on how you have created the user, set the password for that user, how you have created the `test_db` database and how you have assigned the permissions. – Progman Aug 29 '21 at 09:54
  • @Progman I added a description of how I did it to the question... please take a look. – Inksis Aug 29 '21 at 10:02
  • So, you actual CAN login with `mysql -u boto -p` and get the result from `SELECT user(), current_user()` as "boto@localhost boto@%"? Then what seems to be the problem? I tried your SQL statements which create the new user (with fixing minor issues in them) and was able to login with that user as well. – Progman Aug 29 '21 at 11:11

1 Answers1

0

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

epynic
  • 1,124
  • 2
  • 14
  • 26