- Open php MyAdmin
- Run Query :
- Select @@sql_mode;
- The result will be somthing lik:
- ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
- Run the query :
- SET global sql_mode=(SELECT REPLACE(@@sql_mode, ‘ONLY_FULL_GROUP_BY’, ”));
- Run Query :
- Select @@sql_mode;
- The result will be somthing lik:
- STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
- Now we need to add a sql_mode value to [mysqld] to prevent sql_mode value retuned to previous default ;
Now we need to add a sql_mode value to [mysqld] to prevent sql_mode value retuned to previous default
- Open Terminal
- Type :
- cat /etc/my.cnf
- You will see the my.cnf content
- Type:
- nano /etc/my.cnf
- Add following line to end of the fileunder [mysqld] :
- sql_mode = “STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”
- Enter Ctrl + O to “WriteOut” or save the settings.
- Press Enter
Now you need to restart MySQL service
- Restart MySQL from cPanel
- Or from Terminal :
- sudo service mysql stop
- sudo service mysql start
- To check if everything is fine just check mysql variables set correctly
- from cpanel
- Or from Terminal type:
- mysqladmin variables