If you upgrade your MySQL server to MariaDB 1.2 or later, you may notice that some of your application pages break.

You may receive errors like this:
SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column .....

There are a few code issues that can cause this, but that is outside the scope of this article. I would recommend trying to fix the real cause of this error, but you may be short in time or you're in an emergency time restraint situation when your website is not functioning due to this upgrade.

The main reason you started to experience this error now after the upgrade is because the updated MariaDB installation passing version 1.2 will enable strict mode, this means MariaDB treats an issue that used to be considered a warning and allowed, now considered error and aborted under the strict mode.

The first time I came across this error, it was weird, I was using MEDIUMBLOB for a column type and I was using PHP's serialize() function to serialize the data; even though my data size was perfectly fit the MEDIUMBLOB type column, MariaDB, under the strict mode did not like it so I had to disable MariaDB's strict mode until I can find out why MariaDB considers serialized data as an issue.

To disable the strict mode in MariaDB, edit the MariaDB configuration file that is located in a different path based on your installation, it can be under /etc/my.cnf or /etc/my.cnf.d/mariadb-server.cnf or other location based on your OS type.

Add the following line to the config file (in the latest MariaDB install, /my.cnf.d/mariadb-server.cnf, I added under the [server]:

sql_mode=NO_ENGINE_SUBSTITUTION

Then restart MariaDB:

systemctl restart mariadb

This should fix the errors caused by MariaDB strict mode