I'm attempting to install Bugzilla 5.0.6 on Ubuntu 20.04. MySQL version is 8.0.
For MySQL configuration, the Linux installation guide refers me to this page with instructions to create a 'bugs' user:
GRANT SELECT, INSERT,
UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES,
CREATE TEMPORARY TABLES, DROP, REFERENCES ON bugs.*
TO bugs@localhost IDENTIFIED BY '$DB_PASS';
FLUSH PRIVILEGES;
When I try that, or variations using different spacing and single quotes around various elements, I always get a syntax error:
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES, CREATE TEMPORARY TABLES, DROP, REFERENCES ON bugs.* TO bugs@localhost IDENTIFIED BY '***';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY '***'' at line 1
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,LOCK TABLES,CREATE TEMPORARY TABLES,DROP,REFERENCES ON bugs.* TO bugs@localhost IDENTIFIED BY '***';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY '***'' at line 1
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES, CREATE TEMPORARY TABLES, DROP, REFERENCES ON 'bugs'.'*' TO 'bugs'@'localhost' IDENTIFIED BY '***';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''bugs'.'*' TO 'bugs'@'localhost' IDENTIFIED BY '***'' at line 1
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,LOCK TABLES,CREATE TEMPORARY TABLES,DROP,REFERENCES ON 'bugs'.'*' TO 'bugs'@'localhost' IDENTIFIED BY '***';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''bugs'.'*' TO 'bugs'@'localhost' IDENTIFIED BY '***'' at line 1
So, I tried it from the command line as suggested by the Ubuntu 14.04 Quick Start Guide:
mysql -u root -p -e "GRANT ALL PRIVILEGES ON bugs.* TO bugs@localhost IDENTIFIED BY '$db_pass'"
which gave similar errors:
$ sudo mysql -e "GRANT ALL PRIVILEGES ON bugs.* TO bugs@localhost IDENTIFIED BY '***'"
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY '***'' at line 1
$ sudo mysql -e "GRANT ALL PRIVILEGES ON 'bugs'.'*' TO 'bugs'@'localhost' IDENTIFIED BY '***'"
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''bugs'.'*' TO 'bugs'@'localhost' IDENTIFIED BY '***'' at line 1
How do I create the Bugzilla user?
Edit Based on feedback here, I've separated the commands:
mysql> CREATE USER 'bugs'@'localhost' IDENTIFIED BY '***';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL ON 'bugs'.'*' TO 'bugs'@'localhost';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''bugs'.'*' TO 'bugs'@'localhost'' at line 1
mysql> GRANT ALL PRIVILEGES ON 'bugs'.'*' TO 'bugs'@'localhost';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''bugs'.'*' TO 'bugs'@'localhost'' at line 1
Now what's wrong?
Edit 2 This has been marked as a duplicate for the question "How to grant all privileges to root user in MySQL 8.0". My question derives from attempting to follow Bugzilla's instructions. Without guidance, I have no way of knowing that that's the problem with Bugzilla's instructions, and I have no way of knowing that I should be asking the question "How do I grant all privileges to root user in MySQL 8.0?" The existence of that question therefore doesn't help me or anyone else in my situation, despite the fact that the solution there turns out to solve the error given in Bugzilla's instructions.