如何在Nginx服务器上启动MariaDB服务?启动失败求助
Hey there, let’s work through this MariaDB startup issue together. Looking at your systemd logs, the key problem here is that the mariadb-wait-ready post-start process exited with status 1—even though mysqld_safe launched successfully. This usually means the MySQL daemon crashes right after starting, before the readiness check can complete. Here are actionable steps to diagnose and fix this:
Check the full MariaDB error log
The systemd logs only give a high-level overview—your/var/log/mariadb/mariadb.logwill have detailed, daemon-specific error messages. Run this command to view it:cat /var/log/mariadb/mariadb.logLook for lines starting with
[ERROR]—common issues include permission errors on data files, corrupted tables, or invalid configuration settings.Verify data directory permissions
MariaDB needs exclusive access to its data directory (/var/lib/mysql). Check the owner and permissions with:ls -ld /var/lib/mysqlThe directory should be owned by the
mysqluser and group. If not, fix it with:chown -R mysql:mysql /var/lib/mysql chmod 750 /var/lib/mysqlCheck for disk space issues
A full disk can prevent MariaDB from writing logs or creating temporary files. Verify your disk usage with:df -hMake sure the partition containing
/var(where logs and data live) has free space available.Test your MariaDB configuration
Invalid settings inmy.cnf(typically located at/etc/my.cnfor/etc/mysql/my.cnf) can cause the daemon to crash on startup. Try running the MySQL daemon directly to see immediate, detailed errors:/usr/bin/mysqld --basedir=/usrIf configuration errors show up, temporarily rename the config file to test with default settings:
mv /etc/my.cnf /etc/my.cnf.backup systemctl start mariadbIf it starts successfully, you’ll need to debug the old config file line by line to find the faulty setting.
Clean up stale PID files
Sometimes a leftover PID file can confuse systemd. Remove it and try starting the service again:rm -f /var/run/mariadb/mariadb.pid systemctl start mariadb
After trying these steps, check the service status again with systemctl status mariadb to see if it’s running. If you find specific error messages in the log, feel free to share them and we can narrow down the fix further!
内容的提问来源于stack exchange,提问作者Pushker Tiwari

