How to Disable Strict SQL Mode in MySQL 5.7 and Ubuntu 16.04
If your app was written for older versions of MySQL and is not compatible with strict SQL mode in MySQL 5.7, you can disable strict SQL mode. For example, apps such as WHMCS 6 and Craft 2 do not support strict SQL mode.
To disable strict SQL mode, SSH in to your server as root and create this file:
Open the file and enter these two lines:
Restart MySQL with this command:
sudo service mysql restart
This change disables two SQL mode settings, STRICT_TRANS_TABLES and ONLY_FULL_GROUP_BY, that were added in MySQL 5.7 and cause problems for some older applications.
Confirming Strict SQL Mode Is Disabled
You can confirm strict SQL mode is disabled by running this command as root:
sudo mysql -i -BN -e 'SELECT @@sql_mode' | grep -E 'ONLY_FULL_GROUP_BY|STRICT_TRANS_TABLES'
If strict mode is disabled, you won't see any output from that command.
If disabling strict mode causes any problems for you, you can re-enable it by deleting that file and restarting MySQL again.
What Strict SQL Mode Errors Look Like
If your app isn't compatible with strict SQL mode, you'll often see SQL errors such as:
SQLSTATE: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'yourdbname.tblannouncements.date' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
- The Best RSS Readers for Ubuntu
- How to install Letsencrypt certificates with certbot in ubuntu 16.04
- How to Set up a Fully Functional Mail Server on Ubuntu 16.04 with iRedMail
- GIMP 2.10 released: Features 32-bit support, new UI and A Ton Of Improvements
- Setting Up SFTP on Ubuntu 16.04
- MYSQL: How to create a new user and give it full access only to 1 database
- Install Java in Ubuntu 16.04
- ArangoDB, install and configure the popular Database in ubuntu 16.04
- How JSON data types work in mysql
- How to Choose a Laptop for Web Design and Development
- The Best Lightweight Linux Distributions For Older PC's
- How to write real client IP address in error Log with Varnish 4 and Apache 2.4 in Ubuntu 16.04