MAMP / MAMP Pro: Disable MySQL Strict Mode

Discussion for guides including MAMP official & unofficial documentation. User submitted guides can be moved here by moderators.
Post Reply
mampsupportmod
Site Admin
Posts: 101
Joined: Wed Jan 20, 2021 3:06 am

MAMP / MAMP Pro: Disable MySQL Strict Mode

Post by mampsupportmod »

MySQL 'Strict Mode' is a new feature in 5.7.

Strict mode controls how MySQL handles invalid or missing values in data-change statements such as INSERT or UPDATE. A value can be invalid for several reasons. For example, it might have the wrong data type for the column, or it might be out of range. A value is missing when a new row to be inserted does not contain a value for a non-NULL column that has no explicit DEFAULT clause in its definition. (For a NULL column, NULL is inserted if the value is missing.) Strict mode also affects DDL statements such as CREATE TABLE.


Disable MySQL Strict Mode MAMP PRO

1. In MAMP Pro, go to File -> Edit Template -> MySQL (my.cnf) -> (your version)

2. Find

Code: Select all

[mysqld]
3. Add the following line immediately below [mysqld]:

Code: Select all

sql_mode=""
4. Save your my.cnf file and restart MySQL.


Disable MySQL Strict Mode MAMP (Free)

1. Quit MAMP.

2. Run following command in the Terminal:

Code: Select all

touch /Applications/MAMP/conf/my.cnf && open -t /Applications/MAMP/conf/my.cnf
3. When this file is empty, then add the following below. If the file is not empty, then simply add the line sql_mode="" right after the line [mysqld]

Code: Select all

[mysqld]
sql_mode=""
4. Save the config file and close the text editor; restart MAMP and start the servers.
te3d
Posts: 1
Joined: Mon Mar 01, 2021 10:41 pm

Re: MAMP / MAMP Pro: Disable MySQL Strict Mode

Post by te3d »

Thanks - I was just hired to upgrade an old ExpressionEngine 2 site and ran into this error when trying to get my local development environment set up in MAMP. This got me up and running quickly. Much appreciated.

Te3d
Post Reply