Running MySQL 5 as MySQL 4

I use MySQL 5 as the default database for the work that I usually do.

Today I came across a situation where I needed to test some MySQL 4 functionality.

An option was to install MySQL 4 on another port (not the standard 3306).

However, an easier option is to simply switch the MySQL mode.

/* show the current sql mode */

SELECT @@GLOBAL.sql_mode;

/* change the settings to mysql 4 mode */

/* the 'GLOBAL' keyword changes the mode for all clients  that connect from that time on */

SET GLOBAL sql_mode = 'NO_FIELD_OPTIONS,HIGH_NOT_PRECEDENCE';

More information can be found at: http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html

2 thoughts on “Running MySQL 5 as MySQL 4”

Comment on this blog post...