我试着改变 sql_mode
根用户使用的全局变量 perfomance_schema.global_variables
table。
我试着用 SET GLOBAL sql_mode='???'
;
但它不起作用。
当我出示我的根授权时,我认为我有正确的权利:
libertalia@labuse:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.23 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show grants;
+---------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+
2 rows in set (0,00 sec)
下一步,我尝试更改sql\u mode全局变量:
mysql> use performance_schema
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> describe global_variables;
+----------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+---------------+------+-----+---------+-------+
| VARIABLE_NAME | varchar(64) | NO | | NULL | |
| VARIABLE_VALUE | varchar(1024) | YES | | NULL | |
+----------------+---------------+------+-----+---------+-------+
2 rows in set (0,01 sec)
mysql> SELECT * FROM global_variables WHERE VARIABLE_NAME = 'sql_mode';
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| VARIABLE_NAME | VARIABLE_VALUE |
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------+
| sql_mode | 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 |
+---------------+-------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0,01 sec)
mysql> UPDATE global_variables SET VARIABLE_VALUE = 'ONLY_FULL_GROUP_BY,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' WHERE VARIABLE_NAME = 'sql_mode';
ERROR 1142 (42000): UPDATE command denied to user 'root'@'localhost' for table 'global_variables'
我不明白为什么我的超级根用户不能更新这个表?“root”是否具有正确的权限?mysql是否保护系统表?
改变现状 sql_mode
我是否需要超级权限而不是所有权限?这就是为什么设置全局 sql_mode
也没用?
1条答案
按热度按时间k4aesqcs1#
信息模式通常是只读的视图。
information\u schema是每个mysql示例中的一个数据库,存储mysql服务器维护的所有其他数据库的信息。信息模式数据库包含几个只读表。它们实际上是视图,而不是基表,因此没有与它们关联的文件,并且不能对它们设置触发器。而且,没有具有该名称的数据库目录。
尽管可以使用use语句选择information\u schema作为默认数据库,但只能读取表的内容,不能对其执行insert、update或delete操作。