Mathias Maes
Mathias Maes

Reputation: 501

Cannot grant privileges to a user on a database

I'm baffled by the problem I'm having. I created a database, created a user, and want to grant the user all privileges on the database. One way or another, I'm having syntax errors, while I'm fairly sure there is no syntax error.

MariaDB [(none)]> SELECT User FROM mysql.user;
+------------+
| User       |
+------------+
| osticket   |
| phpmyadmin |
| root       |
+------------+
3 rows in set (0.00 sec)

MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| osticket           |
| performance_schema |
| phpmyadmin         |
+--------------------+
5 rows in set (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON 'osticket'.* TO 'osticket'@localhost;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''osticket'.* TO 'osticket'@localhost' at line 1
MariaDB [(none)]>

I also changed localhost to 'localhost' to be sure, no avail. What's going on here?

Upvotes: 2

Views: 2401

Answers (1)

Derviş Kayımbaşıoğlu
Derviş Kayımbaşıoğlu

Reputation: 30545

GRANT ALL PRIVILEGES ON `osticket`.* TO 'osticket'@localhost;

be aware of the quotations

`osticket`.*

Upvotes: 5

Related Questions