Getting a better MySQL prompt
When you want to see which user you are and which database you’re working with, put this in .my.cnf: prompt=(\\u@\\h) [\\d]>\\_ Too bad mysql doesn’t support color. You can make it work with rlwrap,...
View ArticleConverting a MySQL database from latin1 to utf8
mysqldump dbname > dbname_bak_before_messing_with_it.sql mysqldump --default-character-set=latin1 --skip-set-charset dbname > dump.sql sed -r 's/latin1/utf8/g' dump.sql > dump_utf.sql mysql...
View ArticleListing MySQL table sizes
This query lists the sizes of all tables in MySQL: SELECT TABLE_SCHEMA, TABLE_NAME, CONCAT(ROUND(data_length / ( 1024 * 1024 ), 2), 'MB') DATA, CONCAT(ROUND(data_free / ( 1024 * 1024 ), 2), 'MB')FREE...
View ArticleConverting all tables in MySQL DB to InnoDB
#!/bin/bash exit 1 dbname="eorder" echo 'SHOW TABLES;' | mysql $dbname | awk '!/^Tables_in_/ {print "ALTER TABLE `"$0"` ENGINE = InnoDB;"}' | column -t echo 'SHOW TABLES;' | mysql $dbname | awk...
View ArticleShrinking/compressing a MediaWiki database
As of late, I haven’t had a lot of time to chase after spammers, so – despite of anti-spam captchas and everything – a couple of my wikis have been overgrowing with spam. One after the other I’ve been...
View ArticleTrying to reduce MySQL InnoDB disk usage after major reduction of data
So, two days ago, I tried to shrink my MediaWiki database and it almost worked, except the MySQL process wouldn’t shrink along with it. Of course I tried all the obvious things such as dropping the...
View ArticleDumping MySQL users and grants
MySQL stores its users and grants in a very annoying, non-clonable format. I found this post, describing how you can extra them. This bash function generates grants: mygrants() { mysql -B -N $@ -e...
View ArticleDecreasing shutdown time of MySQL with large transaction log file
If you need/have a large transaction log file, a shut down can take a while. This post lists how you can force a flush before you do so, decreasing shut down time. In short: mysql> set global...
View ArticleG.B.D. Calamari Joomla and phpBB upgrade
As the chairman of G.B.D. Calamari, a Dutch student diving association, it falls to me to upgrade an aging Joomla configuration that is a relict of the last time that the board was chaired by somebody...
View ArticleTaking control of the wpautop filter
WordPress does automatic paragraph formatting using the wpautop filter, some PHP code originally developed by Matt Mullenweg. For most of the time that this blog has existed, I’ve disabled the wpautop...
View Article
More Pages to Explore .....