Fixing Database Unavailable For Textpattern

A Bit Of History Catching Up With Me?

In my previous article called First Quick Look I mention that my ellfin.org site was displaying a Database unavailable message, and so was some of the sites linked to from the initial Welcome to your Site! article. I have just taken a look at this problem and fixed it.

When I first started to mess around with Textpattern it was at a time when Linux and all it stood for was new to me. If truth be told it still is, but I’m slowly learning more and more. At that time I created my textpattern user as follows:

GRANT ALL ON database.* TO 'username' IDENTIFIED BY 'password';

When I installed version 4.2.0 of Textpattern I created a user as follows:

GRANT ALL ON database.* TO 'username'@'localhost' IDENTIFIED BY 'new password';

So this latest user was more specific as the hostname was specified and my older Textpattern site at ellfin.org was failing because it was authenticating with a different user now. Now I see what is happening, I know it is bad practice to not specify the hostname for users in MySQL. Without further ado this is what I did to fix it.

1. Granted access to my old database (called txp) to my new ’username’@’localhost’ user in MySQL.

GRANT ALL ON txp.* TO 'username'@'localhost';

2. Removed the old user ’user’@’%’ from the MySQL database because I think it’s a bit of a security risk.

DROP USER 'username'@'%';

3. Edited the config.php file for ellfin.org and made sure the lines specifying the username and password were correct for the new user as follows:

$txpcfg['user'] = 'textpattern';
$txpcfg['pass'] = 'password';
Posted on 30 Nov 2009 by Barrie Callender
blog comments powered by Disqus