[TYPO3-english] Typo3 and MySQL strict mode

Typoq typoq at krautcomputing.eu
Mon Aug 2 18:13:27 CEST 2010


Hi,

since a lot of people seem to have problems with MySQL strict mode and 
Typo3 I thought I'll just post a solution that works for me.

The solutions I have seen so far suggest that you disable strict mode in 
your MySQL configuration file. The problem with that approach is that your 
database server runs in "non strict mode" by default. This is probably not 
really what you want if there are other databases running on it.
Since it is possible to set different sql modes for different connections I 
modified the typo3/init.php file where the connection statements are issued:

// ************************
// Connect to the database
// ************************
if ($TYPO3_DB->sql_pconnect(TYPO3_db_host, TYPO3_db_username, 
TYPO3_db_password)
)
    {
// INSERT THE FOLLOWING LINE
$sqlmode="set sql_mode := ''"; mysql_query($sqlmode);
// END INSERTION
    if (!TYPO3_db)  {
...

This works very well for me. No more hassles.


Rob



More information about the TYPO3-english mailing list