• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Question Change Strict SQL Mode

KiamOe

Basic Pleskian
New
Hi I hope you can help me out here..

After upgrading from Mysql 5.5.56 to Mariadb 10.2.17 I have a problem with on old php application. It reports "Error: [PDOException] SQLSTATE[HY000]: General error: 1364 Field 'deleted' doesn't have a default value" and from looking around I understand the problem is related to "Strict SQL Mode". I have read thread here but I can't seem to solve it. I have put sql_mode="" into /etc/my.cnf restarted mysql but I still get the same result:

mysql -uadmin -p`cat /etc/psa/.psa.shadow` -e "SELECT @@sql_mode;"
+-------------------------------------------------------------------------------------------+
| @@sql_mode |
+-------------------------------------------------------------------------------------------+
| STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------+

This is my files:

locate my.cnf
/my.cnf
/etc/my.cnf
/etc/my.cnf.d
/etc/my.cnf.rpmnew
/etc/my.cnf.d/enable_encryption.preset
/etc/my.cnf.d/mysql-clients.cnf
/etc/my.cnf.d/server.cnf
/etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf

I get no result searching for files with sql_mode set (grep -rnw '/etc' -e "sql_mode")

How can I fix this? What config file should I update? Or better do it via sql in phpmyadmin?

Thanks!
 
An update to my question:
I did manage to change the sql mode in db via phpMyAdmin / Variables where I found "sql mode" and cleared out the content. Now my php app works fine (it seems).
Was this a safe way of doing it?
 
Was this a safe way of doing it?
I suppose it is safe. On default Plesk installation I see:

Code:
[root@ppu17-8 ~]# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -e "SELECT @@sql_mode"
+------------+
| @@sql_mode |
+------------+
|            |
+------------+
 
No, it is not really the correct way. The problem is that version 10.2 of MariaDB comes with the default as follows in /etc/my.cnf:
Code:
[mysqld]
sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO'
This needs to be changed to
Code:
[mysqld]
sql_mode=''
to make sure that the settings stay in place correctly after reboots and restarts of the service.

However, 10.2 is not yet officially supported by Plesk anyway. We are running one of our hosts on 10.2 with approx. 1,000 customer domains on it, and it does work, but still hoping that 10.2 will be supported and the minor issues with some date fields will be overcome. If you have a choice and you are installing a new server, my suggestion is to downgrade to 10.1 as soon as possible to avoid future issues once the system is in production.
 
Thanks for the feedback Peter.. BUT my my.conf did not have any entry at all related to sql_mode.
Apart from my old php application.. things seem to work wind with MariaDB 10.2.. I have a dozen sites on it so not a huge thing. But if we move to another server I'll consider going down a version. I guess I was a bit fast upgrading there. Live and learn...
 
I still suggest to add the sql_mode='', because the other string given is the default, meaning that if you don't clear the setting, the default settings apply, even if they are not expressly set in the configuration file.
 
Back
Top