mysql - 无法为 MySQL 创建 bugzilla 用户
问题描述
我正在尝试在 Ubuntu 20.04 上安装 Bugzilla 5.0.6。MySQL 版本为 8.0。
对于 MySQL 配置,Linux安装指南向我介绍了此页面,其中包含创建“错误”用户的说明:
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;
当我尝试这样做时,或者在各种元素周围使用不同的间距和单引号的变体时,我总是会遇到语法错误:
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
因此,我按照 Ubuntu 14.04快速入门指南的建议从命令行尝试了它:
mysql -u root -p -e "GRANT ALL PRIVILEGES ON bugs.* TO bugs@localhost IDENTIFIED BY '$db_pass'"
这给出了类似的错误:
$ 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
如何创建 Bugzilla 用户?
编辑根据此处的反馈,我将命令分开:
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
现在怎么了?
编辑 2 这已被标记为问题“如何在 MySQL 8.0 中向 root 用户授予所有权限”的重复项。我的问题源于尝试遵循 Bugzilla 的指示。没有指导,我无法知道这是 Bugzilla 指令的问题,我无法知道我应该问这个问题“如何在 MySQL 8.0 中向 root 用户授予所有权限?” 因此,该问题的存在并不能帮助我或我遇到的其他任何人,尽管事实证明那里的解决方案可以解决 Bugzilla 说明中给出的错误。
解决方案
推荐阅读
- r - 有没有办法在单个情节下绘制 2 个或更多 acfs
- android - 当我的用户访问我的博客时,如何将他们重定向到特定标签?
- nsis - 开始菜单应用程序列表中的卸载文件并不总是显示
- spring - 使用pring-data-r2dbc时如何解决spring TransactionSynchronizationManager.currentTransaction中的NoSuchMethodError
- r - 将列表列中的值分派到单独的列
- react-native - 为什么在 Android 模拟器上 Expo-Snack 上的应用程序行为不同?
- reactjs - 为什么会显示错误:错误:目标容器不是 DOM 元素,在创建 ReactDOM.createPortal() 并传递 const 变量时
- arrays - Excel VBA - 带有数组的每个循环的问题
- ruby-on-rails - Rails 控制台与模块
- javascript - Primefaces日历setDate无法正常工作