The message “Can’t log to error log and syslog at the same time” means mysqld_safe was given two mutually exclusive logging destinations: --log-error=file_name for a file and --syslog for the operating system logger. Remove one destination, restart MySQL through its normal service manager, and verify the destination you kept.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
For a file, configure log-error=/path/to/error.log and disable syslog with --skip-syslog or by removing --syslog. For system logging, remove the file destination and use MySQL’s native syslog support where available. On current MySQL 8.4, mysqld_safe’s syslog switches are deprecated, and systemd installations often start mysqld directly without mysqld_safe.
As an Amazon Associate I earn from qualifying purchases.
What causes the conflict?
mysqld_safe is a wrapper that starts and supervises the MySQL server. When it handles startup, it tries to send its own notices and errors, along with messages from mysqld, to one logging destination. The --log-error option names a file; --syslog selects the Unix-like system logger. Supplying both leaves mysqld_safe without a single destination, so startup reports the conflict instead of choosing one silently.
The error is a destination collision, not evidence that the error-log file is corrupt. The same collision can be created in several places: an option file, a systemd unit, a wrapper script, an environment-provided command line, or a package’s default startup definition. Removing only the line you happen to notice may not fix the problem if another configuration layer adds the other option.
#1 Best Overall
MySQL 8.4 documents --skip-syslog as the explicit way to suppress mysqld_safe syslog output. With that setting, messages go to the default error-log file or to the file named by --log-error. If neither syslog switch is supplied, the documented default is --skip-syslog. The --syslog and --skip-syslog mysqld_safe controls are deprecated; new deployments should prefer the server’s native logging and the service manager’s logging facilities.
First determine how MySQL is started
The correct fix depends on whether mysqld_safe is actually involved. Many current Linux packages use systemd to launch mysqld directly. In that arrangement, editing a [mysqld_safe] section may have no effect, and some packages do not install mysqld_safe at all.
Inspect the service unit
- Find the service name used by the host. Common names are
mysqldandmysql; use the name that exists on your system. - Display the unit and its drop-in files with
systemctl cat mysqld.service(substitutemysql.servicewhen appropriate). - Check the command systemd will run:
systemctl show -p ExecStart mysqld.service. - Review the current state and recent startup messages with
systemctl status mysqld.service.
If ExecStart points directly to mysqld, configure the server’s option group and the systemd unit rather than relying on mysqld_safe options. If it calls a mysqld_safe script, continue auditing that script and its option files.
Check the running process
A process listing shows whether a wrapper is present and whether a logging switch was added on the command line:
ps -ef | grep '[m]ysqld'
Look for mysqld_safe as a parent process and for --syslog, --skip-syslog, or --log-error in the arguments. A service can be configured one way and still be started manually another way, so perform this check after every change and restart.
Rank #2
Find every setting that selects a destination
Before changing anything, search all option files used by the installation. Package layouts differ, but common locations include /etc/my.cnf, /etc/mysql/my.cnf, and files under /etc/my.cnf.d/ or /etc/mysql/conf.d/. Search for all three relevant names rather than only the exact error message:
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsgrep -RInE '(^|[[:space:]])(syslog|skip-syslog|log-error)'
/etc/my.cnf /etc/mysql /etc/my.cnf.d /etc/mysql/conf.d 2>/dev/null
Also inspect systemd drop-ins, startup scripts, container entrypoints, and configuration-management templates if the options do not appear in the standard files. Command-line options normally override or supplement option-file values, so inspect ExecStart and any wrapper script for a second copy.
Option-file section names matter. Settings intended for mysqld belong in the server’s [mysqld] group. Settings intended for mysqld_safe traditionally belong in [mysqld_safe] (or the older [safe_mysqld] name), but systemd-managed installations may ignore those groups or behave unexpectedly. Do not assume that a line is active merely because it is present in a file.
Choose one logging destination
| Decision point | File logging | System logging |
|---|---|---|
| Destination | An error-log file, either the default host_name.err in the data directory or the path named by log-error. |
The operating system’s logger, such as the system journal or a traditional syslog service. |
| Configuration owner | The mysqld server option group and, when used, mysqld_safe’s file destination. | Prefer MySQL’s native server syslog support together with the service’s logging configuration; mysqld_safe switches are deprecated. |
| Operational visibility | Inspect directly with tools such as tail or an editor, subject to file permissions. |
Use the service journal or the host’s syslog viewer and filtering tools. |
| Rotation and retention | You must provide or verify a file rotation and retention policy appropriate to the chosen path. | Retention, forwarding, and rotation are normally managed by the journal or syslog service. |
| Systemd compatibility | Works when mysqld is configured to write a file that the service account can access; mysqld_safe-specific sections may not be read. | Fits systemd packaging when the service and MySQL native logging are configured for the journal or syslog destination. |
Fix A: keep an error-log file
1. Remove the syslog selection
Delete --syslog from the mysqld_safe command line, its option-file group, or the wrapper that launches MySQL. If you want the intent to be explicit, use --skip-syslog in the place where your installation accepts mysqld_safe options. Do not leave both switches enabled in different files; the effective configuration must select file logging only.
2. Set the file in the server group
In the option file read by mysqld, put the file destination in the [mysqld] group:
Recommended Free Tools
[mysqld]
log-error=/path/to/error.log
Use an absolute path that matches your distribution’s directory layout. If you omit log-error, MySQL uses the default host_name.err file in the data directory. The directory and file must be writable by the account running mysqld; a path that exists but cannot be opened will create a different startup failure.
3. Restart with the same manager
If systemd owns the service, restart it with systemd rather than launching mysqld_safe by hand:
sudo systemctl restart mysqld.service
sudo systemctl status mysqld.service
Replace the unit name if your host uses mysql.service. A manual start can test a different set of options and make the next diagnosis misleading.
4. Verify the file destination
Check the configured path after startup:
sudo tail -n 50 /path/to/error.log
If you rely on the default, identify the server’s data directory and look for its host_name.err file. Confirm that new startup or shutdown messages have a current timestamp. Seeing a message in the journal does not prove that file logging is active; systemd can capture standard error from a process that is also writing, or instead of writing, to a file.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Fix B: keep system logging
1. Remove the file destination
Delete --log-error=file_name and any log-error=... entry that is being passed to mysqld_safe for this startup path. Leaving a file destination alongside --syslog recreates the collision.
2. Use native server support where possible
MySQL documents native error logging to syslog on Unix-like systems. Configure that server-level facility according to the exact MySQL version and package in use, rather than depending on the deprecated mysqld_safe syslog switches. Native support keeps the logging decision with mysqld, which is the process producing the server diagnostics, and avoids relying on a wrapper that may not be installed under systemd.
If your existing service still invokes mysqld_safe and requires its switch, retain only --syslog for that legacy path. Do not add --skip-syslog as well, and do not set a file destination in another included option file.
3. Restart and inspect the system logger
Restart through the service manager, then query the service journal:
sudo systemctl restart mysqld.service
sudo journalctl -u mysqld.service -b --no-pager
The exact journal or syslog command varies by operating system. Filter for the unit name, mysqld, and the startup time. If the host uses a traditional syslog daemon, inspect the destination configured by that daemon instead of expecting an .err file in the data directory.
Where is the error log when syslog is enabled?
When syslog is the selected destination, there may be no MySQL error-log file containing the messages you expect. Look in the system journal for the service or in the host’s configured syslog files. With systemd, journalctl -u mysqld.service is the first place to check; use the actual unit name if it differs.
Best Value
When file logging is selected instead, check the path from log-error. If no path was supplied, MySQL’s default is the host_name.err file in the data directory. A startup failure caused by the destination collision can occur before normal server logging is established, so also inspect the service status output and the wrapper’s standard error.
Troubleshoot a conflict that keeps returning
Both options are in different files
Included files are a frequent cause. Repeat the recursive search after editing and inspect every matching line, including files loaded indirectly by a main configuration file. Remove or comment out the unwanted destination rather than assuming the last file read will always win; duplicate switches can be rejected by the wrapper before precedence matters.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchThe service unit adds a command-line option
A drop-in under the systemd unit directory can append --syslog or --log-error even after the option file is corrected. Run systemctl cat again and inspect every ExecStart override. After changing a unit, reload systemd’s configuration, then restart the service through systemd:
sudo systemctl daemon-reload
sudo systemctl restart mysqld.service
You edited mysqld_safe, but systemd starts mysqld
If the process list and ExecStart show mysqld directly, mysqld_safe settings are not the control point. Move the chosen destination into the server’s supported configuration and use the service unit’s journal handling. This also explains why a change in [mysqld_safe] appears to have no effect.
A manual test and the production service differ
Starting mysqld_safe in a shell can read a different option-file set, environment, working directory, or data directory than the packaged service. Stop the service before a controlled manual test, record the exact command, and restore service-managed startup afterward. For normal operation, make one configuration change and restart using the same manager that runs the production instance.
The server starts, but messages seem to be missing
Check both the selected destination and the stream carrying the message. MySQL 8.4 states that notices go to the selected destination and standard output, while errors go to the destination and standard error. A service manager may capture standard output and standard error in the journal even when the selected destination is a file. Verify timestamps in the file or journal rather than inferring the destination from a single line.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Version and platform considerations
The behavior described here is specific to the mysqld_safe startup path and to MySQL’s documented options. MySQL 8.4 uses --skip-syslog as the default when no destination option is supplied and labels mysqld_safe logging control deprecated. Future packages may remove or bypass the wrapper entirely.
Systemd changes more than the command name: it also determines where standard output and standard error are collected, which account starts the server, and which configuration files are included. Consequently, a solution copied from an older init-script installation can be ineffective or produce unexpected results on a systemd host. Always establish the actual startup path first, select exactly one destination, and verify that destination after a service-managed restart.
Quick Recap
A concise checklist
- Capture the exact startup error and identify whether mysqld_safe is running.
- Inspect the systemd unit, drop-ins, process arguments, option files, and wrapper scripts.
- Search for every occurrence of
syslog,skip-syslog, andlog-error. - Choose file logging or system logging; do not configure both for the same mysqld_safe invocation.
- For a file, keep
log-error(or the defaulthost_name.err) and remove--syslog. - For system logging, remove the file destination and use MySQL’s native syslog support or the service’s supported logging path.
- Restart through the same service manager used in production.
- Verify new messages in the selected file or with the journal/syslog tools, and check permissions and retention policies.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




