|
[id='how-to-troubleshoot-issues-in-sql']
|
|
|
How To Troubleshoot Issues in SQL
|
|
|
Version:
|
|
|
dnf list installed | grep -i -e maria -e mysql -e galera
|
|
|
Check parameters in configuration file:
|
|
|
MySQL:
|
|
|
mysqld --print-defaults
|
|
|
MariaDB/MySQL Comunnity:
|
|
|
/usr/libexec/mysqld --print-defaults
|
|
|
Compatiblity between different version are not allowed Just install one of them.
|
|
|
How to Access SQL Error Logs
|
|
|
Oftentimes, the root cause of slowdowns, crashes, or other unexpected behavior in SQL can In many cases, the error logs are most easily read with the less program, a command line u
|
|
|
if SQL isn’t behaving as expected, you can obtain more information about the source of the
|
|
|
**systemctl status mysqld.service** doesn't start well, This information doesn’t explain well what is happening?, after this command you should type `journalctl -xe -u mariadb -u mysqld`.
|
|
|
Look at Log files, can be located in `/var/log/mysql/mysqld.log` for MySQL, and `/var/log/mariabd` for MariaDB.
|
|
|
How To Troubleshoot Socket Errors in SQL
|
|
|
SQL manages connections to the database server through the use of a socket file, a special kind of file that facilitates communications between different processes. The MySQL server’s socket file is named mysqld.sock and on Ubuntu systems it’s usually stored in the /var/run/mysqld/ directory. This file is created by the MySQL service automatically.
|
|
|
Sometimes, changes to your system or your SQL configuration can result in SQL being unable to read the socket file, preventing you from gaining access to your databases. The most common socket error looks like this:
|
|
|
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
|
|
|
There are a few reasons why this error may occur, and a few potential ways to resolve it. One common cause of this error is that the SQL service is stopped or did not start to begin with, meaning that it was unable to create the socket file in the first place. To find out if this is the reason you’re seeing this error, try starting the service with _systemctl_:
|
|