测试read_only的变量的用途。本以为设置为on以后不可以修改表的内容,创建数据库、表等,结果发现可以建数据库,建表,往表加一条记录.... 无 c:\documents and settings\administratormysql -u rootwelcome to the mysql monitor. commands end with ; or \g
测试read_only的变量的用途。本以为设置为on以后不可以修改表的内容,创建数据库、表等,结果发现可以建数据库,建表,往表加一条记录.... c:\documents and settings\administrator>mysql -u rootwelcome to the mysql monitor. commands end with ; or \g.your mysql connection id is 2server version: 5.6.11 mysql community server (gpl)copyright (c) 2000, 2013, oracle and/or its affiliates. all rights reserved.oracle is a registered trademark of oracle corporation and/or itsaffiliates. other names may be trademarks of their respectiveowners.type 'help;' or '\h' for help. type '\c' to clear the current input statement.mysql> show variables like 'read_only';+---------------+-------+| variable_name | value |+---------------+-------+| read_only | off |+---------------+-------+1 row in set (0.02 sec)mysql> set global read_only=on;query ok, 0 rows affected (0.00 sec)mysql> show variables like 'read_only';+---------------+-------+| variable_name | value |+---------------+-------+| read_only | on |+---------------+-------+1 row in set (0.00 sec)mysql> use testdatabase changedmysql> show tables;+----------------+| tables_in_test |+----------------+| y2k |+----------------+1 row in set (0.00 sec)mysql> select * from y2k;+------------+---------------------+---------------------+| date | date_time | time_stamp |+------------+---------------------+---------------------+| 1998-12-31 | 1998-12-31 23:59:59 | 1998-12-31 23:59:59 || 1999-01-01 | 1999-01-01 00:00:00 | 1999-01-01 00:00:00 || 1999-09-09 | 1999-09-09 23:59:59 | 1999-09-09 23:59:59 || 2000-01-01 | 2000-01-01 00:00:00 | 2000-01-01 00:00:00 || 2000-02-28 | 2000-02-28 00:00:00 | 2000-02-28 00:00:00 |+------------+---------------------+---------------------+5 rows in set (0.19 sec)mysql> insert into y2k values ('2000-02-29','2000-02-29 00:00:00',20000229000000);query ok, 1 row affected (0.22 sec)mysql> select * from y2k;+------------+---------------------+---------------------+| date | date_time | time_stamp |+------------+---------------------+---------------------+| 1998-12-31 | 1998-12-31 23:59:59 | 1998-12-31 23:59:59 || 1999-01-01 | 1999-01-01 00:00:00 | 1999-01-01 00:00:00 || 1999-09-09 | 1999-09-09 23:59:59 | 1999-09-09 23:59:59 || 2000-01-01 | 2000-01-01 00:00:00 | 2000-01-01 00:00:00 || 2000-02-28 | 2000-02-28 00:00:00 | 2000-02-28 00:00:00 || 2000-02-29 | 2000-02-29 00:00:00 | 2000-02-29 00:00:00 |+------------+---------------------+---------------------+6 rows in set (0.00 sec)mysql> show variables like 'read_only';+---------------+-------+| variable_name | value |+---------------+-------+| read_only | on |+---------------+-------+1 row in set (0.00 sec)mysql> create database new;query ok, 1 row affected (0.03 sec)mysql> use newdatabase changedmysql> create table y2k (date date, time time);query ok, 0 rows affected (0.80 sec)mysql> select database();+------------+| database() |+------------+| new |+------------+1 row in set (0.00 sec)mysql> insert into new.y2k values ('2013-5-25', '08:53:00');query ok, 1 row affected (0.27 sec)mysql> select * from new.y2k;+------------+----------+| date | time |+------------+----------+| 2013-05-25 | 08:53:00 |+------------+----------+1 row in set (0.00 sec)mysql>