MYSQL的新手保护措施

如果使用不当 mysql程序有可能会造成很大破坏,如果在启动之前加入 –i-am-a-dummy这个命令以后,执行的UPDATE & DELETE等命令里如果没有关键字WHERE & LIMIT mysql会拒绝执行。从而起到保护作用。 i am a dummy=我是个新手。
woody@Woody:~/rails$ mysql -u root -p –i-am-a-dummy hello_test;
Enter password: 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 41
Server version: 5.0.75-0ubuntu10.2 (Ubuntu)
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> show tables;
+———————-+
| Tables_in_hello_test |
+———————-+
| posts                | 
| schema_migrations    | 
+———————-+
2 rows in set (0.00 sec)
mysql> delete from posts;
ERROR 1175 (HY000): You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column

评论

此博客中的热门博文

Kettle设计中 判断的基准和多数据流时的主键唯一性

9月的诚品书单[待修订]

引用 vista下.lnk快捷方式打开方式修复