After doing an upgrade on the server (CentOS 7.5) to update all packages, Moodle is unable to connect to the database even though the mysqld service is running.
PHP is 7.2.10
MySQL is 8.0.12
Server is CentOS 7.5
config.php contents:
<?php // Moodle configuration file
unset($CFG);
global $CFG;
$CFG = new stdClass();
$CFG->dbtype = 'mysqli';
$CFG->dblibrary = 'native';
$CFG->dbhost = 'localhost';
$CFG->dbname = 'moodle';
$CFG->dbuser = 'root';
$CFG->dbpass = '<redacted>';
$CFG->prefix = 'mdl_';
$CFG->debug = E_ALL;
$CFG->debugdisplay = 1;
$CFG->dboptions = array (
'dbpersist' => false,
'dbcollation' => 'utf8mb4_unicode_ci',
);
$CFG->wwwroot = 'https://moodle.isd15.org';
$CFG->dataroot = '/opt/moodledata';
$CFG->admin = 'admin';
$CFG->directorypermissions = 0777;
$CFG->passwordsaltmain = '<redacted>';
require_once(dirname(__FILE__) . '/lib/setup.php');
// There is no php closing tag in this file,
// it is intentional because it prevents trailing whitespace problems!
/etc/my.cnf contents:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
#symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
#innodb_file_format = Barracuda
innodb_file_per_table = 1
#innodb_large_prefix
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
skip-character-set-client-handshake
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
The symbolic-links and two inno-db lines in my.cnf are commented out now as MySQL will not start with them uncommented after the system upgrades. The CFG->debug and CFG->debugdisplay lines in moodle/config.php are only there to try to get whatever information I possibly can to try to figure out what's causing the problem.
Doing a service mysqld status says that it is active (running). I can run MySQL queries/commands from the command line with no problem. The moodle database is there and the data seems to be intact.
Going to our Moodle homepage gives the Error: Unable to connect to database error.
Anyone have any brilliant ideas?