Author Topic: Need to disable MySQL strict mode  (Read 943 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Need to disable MySQL strict mode
« on: January 26, 2021, 05:22:01 PM »
Can anyone tell me where to find the config file for MySQL server.  I have looked in /etc/my.cnf and there is no server commands in that file.  I also checked /root/.my.cnf and found no lines saying "sql_mode=STRICT_TRANS_TABLES"

I need to find the file that contains this line so i can disable it...

Running:
CWP Pro
Cent OS 8

Offline
*
Re: Need to disable MySQL strict mode
« Reply #1 on: January 26, 2021, 05:27:05 PM »
filemanager find etc/my.cnf
add text under [mysqld]


#
# This group is read both by the client and the server
# use it for options that affect everything
#
[client-server]
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION
#
# include *.cnf from the config directory
#
!includedir /etc/my.cnf.d


and after restart in panel MySQL Database Server or SHH systemctl restart mysqld
« Last Edit: January 26, 2021, 05:31:04 PM by flexsocialbox »

Offline
*
Re: Need to disable MySQL strict mode
« Reply #2 on: January 26, 2021, 06:22:45 PM »
Thank you for your reply and you are correct, but since I wanted to maintain some restrictions I added the line:

sql_mode=ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

and it seems to be working fine, although I do wish there was a way to remove strict mode for only one user...

Re: Need to disable MySQL strict mode
« Reply #3 on: January 26, 2021, 07:26:06 PM »
.. although I do wish there was a way to remove strict mode for only one user...
If you know what you are doing, then perhaps there is a way.. per Session/Local and hence user account/database
https://mariadb.com/kb/en/sql-mode/#strict-mode
http://www.sqlines.com/mysql/sql_mode

Quote
The session value only affects the current client, and can be changed by the client when required. To set the global value, the SUPER privilege is required, and the change affects any clients that connect from that point on.
« Last Edit: January 26, 2021, 07:27:54 PM by cynique »