MediaWiki Setup fails on Debian with a ‚Couldn’t connect to database‘ error

This year MediaWiki found it’s way into Debian. So last night I thought I could set up this nice piece of software on my home machine.

Installing the package is no problem. But setting up the wiki fails with a ‚Couldn’t connect to
database‘. Unfortunately you don’t see the errors (that would be „Client does not support authentication protocol requested by server; consider upgrading MySQL client“ as I found out later) reported by MySQL.

The cause of this problem is, that MediaWiki (or in fact this is probably the MySQL extention in PHP) does not support the new authentication protocol in MySQL 4.1 and above and thus fails to connect. If you are running MySQL out of Sarge you should not be affected by this problem. However, testing and unstable hold 4.1.X at the moment of writing.

The problem is described at (curiously on a Mac OS X related page) further down the page, marked in red, and a solution can be found in the MySQL Reference manual at „A.2.3. Client does not support authentication protocol„.

I chose the third approach described in

  1. I changed the password for the DB root.
  2. I ran the wiki install with the DB root password given. This creates the database and sets up the database user before it fails when the database user tries to access that database.
  3. Now I also changed the password of the newly created database user and ran the setup again. Giving a root password is not necessary any more. This time the setup runs thru smoothly and the wiki is set up and reachable.