Control Web Panel

WebPanel => MySQL => Topic started by: ttrimbledsde on January 26, 2021, 05:22:01 PM

Title: Need to disable MySQL strict mode
Post by: ttrimbledsde 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
Title: Re: Need to disable MySQL strict mode
Post by: flexsocialbox 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
Title: Re: Need to disable MySQL strict mode
Post by: ttrimbledsde 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...
Title: Re: Need to disable MySQL strict mode
Post by: cinique 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.