Buddy Gardner Buddy Gardner - 23 days ago 5x
MySQL Question

admin username changed, now can't access website

im in no way a coder, and have inherited a cPanel server, with many sites on it... one of our sites, is constantly needing stuff done, but we have had no documentation at all to work from. We don't even have the admin creds to log into the site. So in cPanel, there is 1 database, and 1 user. So it was thought, that the database user was the admin user. So the password was changed, and as soon as that was done, no access to the site anymore, we get an error now when launching the URL

Warning: mysqli::close(): Couldn't fetch mysqli in /home/pheamlam/public_html/lib/dml/mysqli_native_moodle_database.php on line 336


At this point, I'm not interested in spending hours and hours learning php or MySQL, but would like to overcome this issue.

Any ideas or suggestions? Feel free to let me know of some options, I'm just not sure where to go or what to do to resolve this and move on....

Thanks, and have a great day!


Go to cpanel, open the file manager

Go to this directory /home/pheamlam/public_html/

Open this file config.php

These are the database details

$CFG->dbuser    = 'databaseuser';
$CFG->dbname    = 'databasebame';
$CFG->dbpass    = 'xxxxxxxx';


There will probably be a username called admin, you can change the password using SQL.

So go to the cpanel, go to phpmyadmin, click on the moodle database, click on the SQL tab.

Then enter the following to change the password for the admin user.

UPDATE mdl_user
SET password = md5('newpassword')
WHERE username = 'admin'

Then you can login as admin and the newpassword.