我在 Ubuntu 18.04
与 MySQL 5.7.24
我正在尝试启用 general_log
如本文所述。
所以在我的 /etc/mysql/my.cnf
我补充说:
general_log = on
general_log_file=/tmp/mysql.log
然后我停止并再次启动mysql,但我得到一个错误:
$ sudo service mysql stop
$ sudo service mysql start
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
所以我退房了 systemctl status mysql.service
```
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2019-01-04 17:50:31 CET; 45s ago
Process: 27206 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=0/SUCCESS)
Process: 27613 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
Main PID: 27208 (code=exited, status=0/SUCCESS)
Jan 04 17:50:31 librem systemd[1]: mysql.service: Failed with result 'exit-code'.
Jan 04 17:50:31 librem systemd[1]: Failed to start MySQL Community Server.
Jan 04 17:50:31 librem systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Jan 04 17:50:31 librem systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Jan 04 17:50:31 librem systemd[1]: Stopped MySQL Community Server.
Jan 04 17:50:31 librem systemd[1]: mysql.service: Start request repeated too quickly.
Jan 04 17:50:31 librem systemd[1]: mysql.service: Failed with result 'exit-code'.
Jan 04 17:50:31 librem systemd[1]: Failed to start MySQL Community Server.
在 `journalctl -xe` 我也差不多。
我尝试在中创建日志文件 `/tmp/mysql.log` 把它交给 `777` ,但在这样做之后,启动mysql失败,并出现相同的错误。
有人知道这里怎么了吗?
1条答案
按热度按时间gc0ot86w1#
最后我用这个技巧解决了这个问题。只需将其复制粘贴到此处,以供未来读者阅读:
无需重新启动。用户确实需要超级权限(
GRANT SUPER ON *.* TO user1@localhost
). 这适用于数据库上的现有连接和新连接,并且是全局设置,因此适用于所有数据库。它可以关闭与
无论如何,祝大家有个美好的一天!