--i-am-a-dummy option for safe updates - Mysql Views : 412
Tagged in : Mysql
Send mail vote down 0 vote down 0
It's an option for beginners that has the same effect as --safe-updates. The --i-am-a-dummy option is very helpful because it prevents accidents. If you execute the SQL statement:

DELETE FROM table_name


what happens? You delete all rows from the table. With the --i-am-a-dummy option:

# You cannot delete or update rows without specifying the key values that identify them or providing a LIMIT clause
# All large select are automatically limited to 1,000 rows unless the statement includes a LIMIT clause.
# Multiple-table SELECT statements that probably need to examine more than 1,000,000 row combinations are aborted.

Example:

mysql --i-am-a-dummy -uuser_name -puser_password


Replace the user_name and user_password with your MySQL user name and password

mysql> delete from table_name;
ERROR 1175: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column
By - Rekha, On - 2009-11-13




    Login to add Comments .