如果它处于只读模式,我无法插入到MySQL 5.6中的临时表中。用log_bin打开。如果log_bin关闭,它可以正常工作。我可以看到5.5的旧版错误报告,但据说固定为5.6。我无法找到任何有这个问题的人,所以我认为我必须配置错误的东西。
当服务器处于只读模式(因为它是奴隶)并且登录了log_bin时,能够插入临时表的正确方法是什么?
要重现(从授权中可以看出,此用户不是超级用户)
add
vi /etc/my.cnf
log_bin=mysql-bin
log_slave_updates=1
mysql -utest_user -p singapore
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 23
Server version: 5.6.27 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, 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 FOR 'test_user'@'----';
Grants for test_user@----
GRANT CREATE TEMPORARY TABLES ON *.* TO 'test_user'@'----' IDENTIFIED BY
PASSWORD '----'
GRANT ALL PRIVILEGES ON `test_user`.* TO 'test_user'@'----'
mysql> CREATE TEMPORARY TABLE table2 AS (SELECT * FROM view limit 1);
Query OK, 1 row affected (0.02 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> insert into table2 (session, date) value ('test', now());
ERROR 1290 (HY000): The MySQL server is running with the --read-only option
so it cannot execute this statement
mysql> exit
再见