MediaWiki & MySql installation: Pwned by Charset
Tue 08 January 2013It's some days i'm dealing with a beast: Upgrading some MediaWiki sites inexplicably hosted on a Winzoz platform.
The process is a pain and i'm spending hours to understand why, for example my Localsettings.php was not read from the stupid IIS server giving me odds messages in the PHP logs:
Fatal error: impossibile aprire file blabla blabla
I'm very noob at Windows and i'm unconfortable on checking privilages in graphical windows; turned out that copying the config files previously backupped, from a storage server, erased all the IIS user permissions from my MediaWiki folder...
This is not the funny part of the story while the fight on a Mysql database became a real nightmare!
I spent almost 4 hours in madness looking at the problem which was preventing me to make a fresh install of a new MediaWiki release.
The web installer was getting n error message during the db setup.
The Mysql server is running on a Linux machine and my user got a strong yet human randomized password (by me) full of beautiful leters, numbers and symbols; while others MediaWiki were using the same mechanisms, my newly created user was dull to any call of the web installation script. I tried everything:
-
Setting the right privileges to the user @ the right host: fail
-
Use the root user to perform the opeartion: it actually creates the DB but fail on the user creation (probably because the user root was already created)
-
i tried to dump a DB from another Wiki site and populating the new one with the already dumped data; i gave permission to the user i created and... you know waht: fail!!
I was very frustrated because everything seems good: good permissions on Mysql server, good permission on Wiki files and folders...
After some other tries I figured out was my stupid random password!
I wrote it with a shiny, undetectable £ symbols, that wasn't properly saved or parsed in the Mysql schema due to the Charset of the MySql.
I've lost a bunch of hours for a stupid symbol; remember: check the charset in use when you set a strong password; this time i had the root access and no problems, but guess what if I had set that password for the Root instead?
So, double check the charset and, to do so in the Mysql simply type status from mysql terminal should look like this:
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
I hope somebody fallen in my situation could find this infos useful, at least to avoid loosing 4 hours to install a MediaWiki site!