我有這個代碼:
[mysqld]
bind-address = 0.0.0.0
default-storage-engine = innodb
innodb file per table
collation-server = utf8 general ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8
這是針對較舊版本的 Ubuntu,現在我正在使用 Ubuntu 22.04,我正在努力使其工作。我試圖將它放在“/etc/mysql/conf.d”目錄中,但我不認為這是這個版本的 Ubuntu 中的位置。
我輸入了代碼,當我嘗試重新啟動服務時拋出錯誤:
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xeu mysql.service" 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 Mon 2023-06-12 14:07:46 UTC; 6s ago
Process: 19824 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
CPU: 34ms
Jun 12 14:07:46 controller systemd[1]: Failed to start MySQL Community Server.
Jun 12 14:07:46 controller systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Jun 12 14:07:46 controller systemd[1]: Stopped MySQL Community Server.
Jun 12 14:07:46 controller systemd[1]: mysql.service: Start request repeated too quickly.
Jun 12 14:07:46 controller systemd[1]: mysql.service: Failed with result 'exit-code'.
Jun 12 14:07:46 controller systemd[1]: Failed to start MySQL Community Server.
您有什麼建議嗎?
答案1
我發現錯誤是什麼,實際上是上面程式碼中的拼字錯誤,而不是這樣寫:
[mysqld]
bind-address = 0.0.0.0
default-storage-engine = innodb
innodb file per table
collation-server = utf8 general ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8
我應該寫:
[mysqld]
bind-address = 0.0.0.0
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8