Major crisis: some databases not readable

Two days ago i was just about to reinstall the whole server (web, db, mail and fileserver). The reason was, that mysql was apparently not able to open most databases. The files were still there (under /var/lib/mysql), but only two databases which belonged to two gregarius-installations were accessible. I had just installed the aggregator at solidworks.toomuchcookies.net and had instructed the installer to create the database needed. I gave him root-access and also told him to access that database after that as root.

And that was the problem: The installation procedure involved creating the database and granting the user (in this case root himself) on localhost only rights to that database - not on all databases. After that the mysql.users table had a line which granted root/password/localhost only access to two databases and another line which granted root/password/bigcook root access to all privileges. The second line came first and was therefor ignored. I even wasn't able to access the mysql-database, which hods information about the user privileges..

To solve the problem (after an hour and a half of desperate searching and trying to 'recover' the data) i had to start mysql with the "--skip-grant-tables" parameter.

CODE:
  1. /etc/init.d/mysql stop
  2. mysqld --skip-grant-tables &

This is a rather dangerous mode and should be handled with care, since it instructs mysql to ignore the privilege table and allow all users access. I used this mode to verify that the databases were still there and then moved on to see the mess created in the mysql.users table. By removing the second grant line, the server was finally able to read all the databases. Phew!

Don't forget to stop the server and restart as daemon:

CODE:
  1. killall mysqld
  2. /etc/init.d/mysql start

Postfix: sender_bcc_maps

For an email account for a group project, we needed the ability to see what was being sent via a specific email account. The reason was, that we're going to handle the account data very liberally and therefor to avoid misuse of the account, we needed an automatic forward of all emails that were sent from this account to some screening account.

I thought i would need to script some piping instructions but actually it was much easier: Using the command sender_bcc_maps i could simply define that any email sent by x@x.com would be bcced to the same account. Now, that account has an automatic forward to some aliases. So anytime someone sends an email from x@x.com all the aliases (outside emails) would get a notice.

To setup sender_bcc_maps, i needed to setup a hashtable that looked like this:

CODE:
  1. bcc_maps
  2. x@x.com   x@x.com

After "postmap bcc_maps" i had to include the command in main.cf, that looks like

CODE:
  1. sender_bcc_maps = hash:\etc\postfix\bcc_maps

That did the trick. Thanks to miniGeek, Linox.BE and of course the Postfix team.

Pingbacks and Trackbacks work again in WordPress

For quite some time, i had a problem getting pingbacks and trackbacks working. Receiving them wasn't a problem, but i couldn't send any. It seems, i'm not alone and no where were any answers to be found..

I think i found the problem: the function spawn_cron (/wp-includes/cron.php, 153) opens a socket to then wp-cron.php file after adding a new scheduled item. For that reason it runs the function wp_remote_post which also accepts a timeout parameter. That parameter is set to 0.01 by default. I guess these are seconds (which means these are 10 milliseconds!) and for some webservers this value is simply too small. Change that to something bigger (i'm using 0.1 or 1) and pingbacks and trackbacks should work again..

Now what about the old trackbacks and pingbacks that didn't get sent? Actually you'll simply need to write a new post and all the old unsent pings should be scheduled for sending. If you don't want to do that, you could install the plugin Wp-Crontrol where you can specify a hook to be scheduled to a specific time. Schedule the hook "do_pings" to be triggered any time soon (parameter should be empty = "[]") and it should take care of the old pingsbacks.

Finally wordpress 2.7 final

The final version of wordpress 2.7 "Coltrane" has been released. I've kept this blog up to date and switched from trunk to 2.7-branch now for fear that the stability held up until now won't be kept up. I've also updated my main blog. The only thing that is bugging me is the notice at the top of the blog telling me to upgrade to please WordPress 2.7, even though the blog is long updated.. A last-minute bug?

It's really funny at the dashboard, where it literally says "You have version 2.7. Would you like to upgrade to version 2.7?"

upgrade27

upgrade27

Anyway, the team of Automattic has again done a great job with this version. I'm totally happy with it. Thanks guys.