在Ubuntu上进行MariaDB故障排查可以按照以下步骤进行:
dmesg 命令查看系统启动时的消息。/var/log/mysql/error.log,检查是否有错误信息。syslog 和 apache2 日志(如果使用了Apache作为Web服务器)。ping 命令测试网络连接。netstat -tulnp | grep 3306 检查MariaDB是否在监听3306端口。sudo iptables -L -n 检查。ps aux | grep mariadb 查看MariaDB进程是否在运行。sudo systemctl restart mariadb 重启服务。/etc/mysql/mariadb.conf.d/50-server.cnf。bind-address 是否设置为 0.0.0.0 以允许远程连接,port 是否设置为3306。df -h 检查磁盘空间是否充足。dpkg -l | grep mariadb 检查MariaDB软件包是否已正确安装。sudo apt-get update 和 sudo apt-get upgrade 更新软件包。Can't connect to local MySQL server through socket 错误,检查 /var/run/mysqld/mysqld.sock 文件是否存在,必要时创建符号链接。/etc/apparmor.d/usr.sbin.mysqld 文件中的 ProtectHome 设置为 false,然后重新加载systemd配置。/etc/mysql/my.cnf 或 /etc/mysql/mariadb.conf.d/*.cnf 文件,确保没有错误的配置。top, htop, mpstat, sar, vmstat, dstat 等。free, vmstat, smem, slabtop 等。iostat, iotop, df, du, lsblk 等。ifconfig / ip, netstat, ss, iftop, nload 等。ps, pstree, kill, strace 等。通过上述步骤和工具,可以系统地排查和解决Ubuntu系统上的MariaDB故障,并快速定位和解决问题。