1

[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                                  |
+-------------------------------------------------------------------------------------------------------------+

2 Answers 2

1

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.
1
  • Did this answer solve your problem ??? Jul 20, 2020 at 20:13
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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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