On 2015-12-19, Jan Steinman Jan@EcoReality.org wrote:
This is on MediaWiki 1.16 (yea, I know), MariaDB 10.1.8, and MacOS X 10.6.8.
I had a database problem, and reinitialized and restored my database from a recent logical (SQL source) backup. There were no changes to any MediaWiki PHP files. The character set (UTF8) did not change.
Now, I get the infamous "[Sitename] has a problem… Can't contact the database server: Permission denied (localhost)."
The host/database/user/password info in LocalSettings.php has not changed. I can use those same credentials to access the database from various tools, such as mysql CLI client, phpMyAdmin, and Sequel Pro. And yet, MediaWiki is still unwilling to connect. I even tried tagging "?action=purge" onto the URL to rule out caching problems.
How exactly did you restore the backup? How did you re-create the users? Did you "mysqladmin reload" after re-loading the "mysql" database?
Can you see the actual data after connecting with:
mysql -uuser -ppasswd mediawikidatabase
select * from revision limit 10;
I'm leaning toward a MySQL User permissions problem, but I think I've ruled that out by getting in using the same credentials with other tools.
Any insight? Please show me something simple and stupid that I've been overlooking!
Also you might need to login as the database supervisor (sometimes called "root") and talk to the "mysql" database and examine entries in the "user" and "db" tables (and maybe "host").
Maybe that didn't get restored as it was before.
The best way to re-create the user needed is this:
GRANT INDEX, CREATE, SELECT, INSERT, UPDATE, DELETE, DROP, ALTER, LOCK TABLES ON mediawikidatbase.* to 'wikiuser'@'localhost' IDENTIFIED BY 'password';
Please keep in mind that 'wikiuser'@'%' and 'wikiuser'@'localhost' are different users from the MySQL point of view, with their own passwords and permissions.
Saper