MySQL Session sql_mode vs Global sql_mode @@SESSION.sql_mode and @@GLOBAL.sql_mode is showing different options.

@@SESSION.sql_mode  

STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION


@@GLOBAL.sql_mode

NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION


It seems like GLOBAL.sql_mode is taking precedence, is that right?

Why wouldn't a session setting overwrite a global setting?

Query ran:

SELECT @@GLOBAL.sql_mode, @@SESSION.sql_mode;


Result:
"Session" variables apply to the connection.  (Usually, there is exactly one connection per client.)  Two different clients (or different connections in one client) may have different values in the variables.

"Global" variables are defaults that are copied into "session" when you connect.  Then you, or your client code, or the 3rd party application, or whatever, could change the variables.

Note:  Some global variables are really global -- the "session" value always tracks the global copy.

If you display the session value from the same connection, then that is what the connection is using.  If you make a separate connection to read the value, then what you see may not be what is in effect.

There are hundreds of 3rd party packages out there; who knows what each of them does.  Furthermore, things change from version to version of that package.

sql_mode can be changed in a session.

In your example, something in the connection added STRICT_TRANS_TABLES to SQL_MODE.  And it should be in effect for the connection until it is changed again.