(mysql.info.gz) safe-updates
Info Catalog
(mysql.info.gz) Vertical query results
(mysql.info.gz) mysql Tips
(mysql.info.gz) mysql reconnect
8.3.3.2 Using the `--safe-updates' Option
.........................................
For beginners, a useful startup option is `--safe-updates' (or
`--i-am-a-dummy', which has the same effect). This option was
introduced in MySQL 3.23.11. It is helpful for cases when you might
have issued a `DELETE FROM TBL_NAME' statement but forgotten the
`WHERE' clause. Normally, such a statement will delete all rows from the
table. With `--safe-updates', you can delete rows only by specifying
the key values that identify them. This helps prevent accidents.
When you use the `--safe-updates' option, `mysql' issues the following
statement when it connects to the MySQL server:
SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=1000, SQL_MAX_JOIN_SIZE=1000000;
`SET' SET OPTION.
The `SET' statement has the following effects:
* You are not allowed to execute an `UPDATE' or `DELETE' statement
unless you specify a key constraint in the `WHERE' clause or
provide a `LIMIT' clause (or both). For example:
UPDATE TBL_NAME SET NOT_KEY_COLUMN=# WHERE KEY_COLUMN=#;
UPDATE TBL_NAME SET NOT_KEY_COLUMN=# LIMIT 1;
* All large `SELECT' results are automatically limited to 1,000 rows
unless the statement includes a `LIMIT' clause.
* Multiple-table `SELECT' statements that will probably need to
examine more than 1,000,000 row combinations are aborted.
To specify limits other than 1,000 and 1,000,000, you can override the
defaults by using `--select_limit' and `--max_join_size' options:
shell> mysql --safe-updates --select_limit=500 --max_join_size=10000
Info Catalog
(mysql.info.gz) Vertical query results
(mysql.info.gz) mysql Tips
(mysql.info.gz) mysql reconnect
automatically generated byinfo2html