Oracle 5.0 Reference Manual page 301

Table of Contents

Advertisement

For beginners, a useful startup option is
which has the same effect). It is helpful for cases when you might have issued a
statement but forgotten the
tbl_name
the table. With
identify them. This helps prevent accidents.
When you use the
connects to the MySQL server:
SET sql_safe_updates=1, sql_select_limit=1000, sql_max_join_size=1000000;
See
Section 5.1.4, "Server System
The
statement has the following effects:
SET
• You are not permitted to execute an
constraint in the
UPDATE
tbl_name
UPDATE
tbl_name
• The server limits all large
clause.
• The server aborts multiple-table
1,000,000 row combinations.
To specify limits different from 1,000 and 1,000,000, you can override the defaults by using the
select_limit
shell>
mysql --safe-updates --select_limit=500 --max_join_size=10000
4.5.1.6.4. Disabling
If the
mysql
automatically tries to reconnect once to the server and send the statement again. However, even if
succeeds in reconnecting, your first connection has ended and all your previous session objects
mysql
and settings are lost: temporary tables, the autocommit mode, and user-defined and session variables.
Also, any current transaction rolls back. This behavior may be dangerous for you, as in the following
example where the server was shut down and restarted between the first and second statements
without you knowing it:
mysql>
SET @a=1;
Query OK, 0 rows affected (0.05 sec)
mysql>
INSERT INTO t VALUES(@a);
ERROR 2006: MySQL server has gone away
No connection. Trying to reconnect...
Connection id:
Current database: test
Query OK, 1 row affected (1.30 sec)
mysql>
SELECT * FROM t;
+------+
| a
|
+------+
| NULL |
+------+
1 row in set (0.05 sec)
The
user variable has been lost with the connection, and after the reconnection it is undefined. If it
@a
is important to have
client with the
mysql
— The MySQL Command-Line Tool
mysql
[269], you can delete rows only by specifying the key values that
--safe-updates
--safe-updates
clause or provide a
WHERE
SET
not_key_column=val
SET
not_key_column=val
SELECT
SELECT
and
--max_join_size
Auto-Reconnect
mysql
client loses its connection to the server while sending a statement, it immediately and
1
terminate with an error if the connection has been lost, you can start the
mysql
--skip-reconnect
--safe-updates
clause. Normally, such a statement deletes all rows from
WHERE
[269]
option,
mysql
Variables".
or
UPDATE
DELETE
clause (or both). For example:
LIMIT
WHERE key_column=val;
LIMIT 1;
results to 1,000 rows unless the statement includes a
statements that probably need to examine more than
options:
[269]
option.
281
[269]
(or
--i-am-a-dummy
DELETE FROM
issues the following statement when it
statement unless you specify a key
[269],
LIMIT
--

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents