[MediaWiki-l] Help! Cannot connect to database!

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[MediaWiki-l] Help! Cannot connect to database!

Jan Steinman-2
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.

I used phpMyAdmin to re-set the login credentials to those in LocalSettings.php, thinking perhaps they hadn't been restored correctly. No luck there. The various other database clients can still get in using those same MediaWiki login credentials.

I've taken to grepping through the .php files, looking for where the login credentials are used, trying in vain to figure out why they no longer work, when they did just 24 hours ago!

I've also crawled through the MediaWiki online documentation, with no particular insight.

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!

Jan


_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Help! Cannot connect to database!

Marcin Cieslak-3
On 2015-12-19, Jan Steinman <[hidden email]> 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


_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Help! Cannot connect to database!

Agnese Camellini
Well i don't know if this is your case but i had a similar problem
installing mediawiki 1.25.3 AND my problem was with the server permissions.
The server didn't had the permission to access the db on the same machine.
Considering it has taken to me a long time to understand the problem i
advice you to run journalctl (or a similar command in your OS i don't know,
i use fedora. I had to fix a coupple of things but it was all written in
that file so i just add to copy and paste.. (well the command was actually:

 # grep httpd /var/log/audit/audit.log | audit2allow
 # semodule -i mypol.pp

so it was a problem with selinux).

Considering it took me 3 weeks to work this out i would be more than happy
to save you some time but maybe that's not the same problem..

my 2 cents

On 29 December 2015 at 21:47, Marcin Cieslak <[hidden email]> wrote:

> On 2015-12-19, Jan Steinman <[hidden email]> 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
>
>
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l