0

[mariaDB on RedHat 7.7]

I just want to create a new database, but found "access denied":

create database lamp_k;

ERROR 1044 (42000): Access denied for user 'lamp'@'localhost' to database 'lamp_k'

These are my privileges:

+-------------------------------------------------------------------------------------------------------------+
| Grants for lamp@localhost                                                                                   |
+-------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'lamp'@'localhost' IDENTIFIED BY PASSWORD '*F90C7030DCB590F7C8E0ED955DA6222DE699A9E8' |
| GRANT ALL PRIVILEGES ON `lamp_*`.* TO 'lamp'@'localhost' WITH GRANT OPTION                                  |
+-------------------------------------------------------------------------------------------------------------+
| improve this question | | | | |
0

Before the changes actually take action, you need to run

FLUSH PRIVILEGES

EDIT: Just saw that you tried to grant Privileges on a database which doesn't exists. You need to give them global privileges to create databases.

| improve this answer | | | | |
  • Permissions were assigned by the administrator days ago, no need to flush – anthony Sep 26 '19 at 12:33
  • @anthony Does you want to say that server reboots during this days? If no - flush, it is safe. – Akina Sep 26 '19 at 12:48
  • i did it. it doesn't work. – anthony Sep 26 '19 at 12:51
  • Solved. Thanks! – anthony Sep 27 '19 at 12:59
0

Your problem is very simple.

  • You have grants to do things in any existing database that starts with lamp_.
  • You do not have permission to create a new database even if it starts with lamp_.
  • You would need at least GRANT CREATE ON *.* to create databases.
| improve this answer | | | | |
  • Solved. Thanks! – anthony Sep 27 '19 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.