CREATE USER user1@localhost IDENTIFIED BY 'Password_123!';
SHOW GRANTS FOR user1@localhost;
+--------------------------------------------------------------------------------------------------------------+
| Grants for user1@localhost |
+--------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'user1'@'localhost' IDENTIFIED BY PASSWORD '*45C046113DAFA331183C338569DC015C53EE4B47' |
+--------------------------------------------------------------------------------------------------------------+
1 row in set (0.05 sec)
然后:
# mysql -u user1 -p'Password_123!'
SHOW VARIABLES LIKE 'sql_mode';
+---------------+--------------------------------------------+
| Variable_name | Value |
+---------------+--------------------------------------------+
| sql_mode | NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+---------------+--------------------------------------------+
1 row in set (0.03 sec)
SET sql_mode='';
SHOW VARIABLES LIKE 'sql_mode';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| sql_mode | |
+---------------+-------+
1 row in set (0.01 sec)
是的,这似乎是这种情况 - 您不需要任何特定内容
GRANT
即可修改您自己的会话变量:然后:
请注意,当然并非所有系统变量都可以在每个会话中修改,有些甚至不是动态的。