Useful MySQL commands

# Set the auto_increment value (e.g. `id`) to one more the highest `id` value currently alter table `foo` auto_increment=1 # Show how MySQL will parse this query, including key (indices) used and any additional parameters explain select * from `foo`; # Show indices for the given table show keys from `foo`;

Read More Useful MySQL commands

Separate MySQL databases environments

Now this may be common practice for some of you all, but not all. I’d recommend the (security) practice of having separate databases for your different environments; e.g. development, testing and production. Say for a given user ‘kzhiwei’, I should have up to three databases available for use: kzhiwei_development kzhiwei_production kzhiwei_testing PHPMyAdmin provides excellent support […]

Read More Separate MySQL databases environments

Using enum where sensible

On database design here. Having been schooled in the merits of normalization previously, I had always thought it sensible to use separate tables for dictionary fields. 2NF, 3NF, yes? Now I have a [members] table where they have some title (Dr, Mr, Mrs, ..). I used to put those in a separate table, so when […]

Read More Using enum where sensible

PHP5 on Fedora Core 6 (64-bit)

# gunzip -dc php-5.2.1.tar.gz | tar -xof – # cd php-5.2.1 # ./configure –with-apxs2=/usr/local/apache2/bin/apxs \ –with-mysql \ –with-libdir=lib64 . . . checking for MySQL support… yes checking for specified location of the MySQL UNIX socket… no checking for MySQL UNIX socket location… no configure: error: Cannot find MySQL header files under yes. Note that the […]

Read More PHP5 on Fedora Core 6 (64-bit)

Connection refused

I was recently put in-charge of overseeing the database server migration — from Oracle to MySQL. We had all worked really hard, making sure we stick to the schedule as prescribed. Until two days before the final migration, I realised that the web server couldn’t connect to the database server. “Connection refused” it said. “It […]

Read More Connection refused