Tuesday, January 5, 2021

mySQL: How NOT to edit your mysql.cnf

 When I edited my mysql.cnf recently, I forgot the [mysqld] section header, which produced this error on startup:

brad@alienware:/etc/mysql/mysql.conf.d$ 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 Sat 2020-12-19 19:46:23 EST; 2min 6s ago

    Process: 9336 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)


Dec 19 19:46:23 alienware systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.

Dec 19 19:46:23 alienware systemd[1]: Stopped MySQL Community Server.

Dec 19 19:46:23 alienware systemd[1]: mysql.service: Start request repeated too quickly.

Dec 19 19:46:23 alienware systemd[1]: mysql.service: Failed with result 'exit-code'.

Dec 19 19:46:23 alienware systemd[1]: Failed to start MySQL Community Server.


A quick check of the verbose help showed an immediately easy "well, duh" moment:

brad@alienware:/etc/mysql/mysql.conf.d$ mysqld --help --verbose

mysqld: [ERROR] Found option without preceding group in config file /etc/mysql/my.cnf at line 22.

mysqld: [ERROR] Fatal error in defaults handling. Program aborted!


Fixed that, and the server started. 

No comments:

Post a Comment