How to determine the log_error for MariaDB in cPanel?
So this query works great on both Windows and Linux:
SHOW GLOBAL VARIABLES LIKE 'log_error';
Unfortunately, for reasons (likely compatibility) the mysql.error.log file is empty and there are obvious iterations of the log file (mysql.error.log-20250713, mysql.error.log-20250714, etc).
I'm using PHP so I use shell_exec() to call the UAPI (or other APIs). What is the command I need to run to know what the latest MariaDB error log file is please?
For clarification, I explicitly do not want to set a static file name and determine the date. If I do, then that means I'll have to update this bit of code every time I migrate servers (which has been much more common than one might think).
-
Hey hey! I can't say I've seen daily logs like that before for the MySQL service. What do you see for the "log-error" value inside /etc/my.cnf? The default looks like this:
log-error=/var/log/mysqld.log
0 -
Hi Rex, I figured it out:
<?php$row1 = mysqli_fetch_assoc($result1);$file = $row1['Value'];$dir = explode_right('/', $file,2)[0];$file = explode_right('/', $file,2)[1];chdir($dir.'/');$files_command = 'find . -type f -name "*'.$file.'*" | sort -k1';$files = shell_exec($files_command);?>0 -
Where was that located?
0 -
I presume you mean the MariaDB error log file at /var/log/mysqld.log. I had to change the directory in PHP using chdir().
On the other thread I'm simply waiting for tomorrow to see if the change I made will resolve the 640 to 644 issue.
0
Please sign in to leave a comment.
Comments
4 comments