You are on page 1of 12

Syntax:

CREATE USER user_specification [, user_specification] ...

user_specification:
user [ identified_option ]

auth_option: {
IDENTIFIED BY 'auth_string'
| IDENTIFIED BY PASSWORD 'hash_string'
| IDENTIFIED WITH auth_plugin
| IDENTIFIED WITH auth_plugin AS 'hash_string'
}

The CREATE USER statement creates new MySQL accounts. An error occurs
if you try to create an account that already exists.

To use CREATE USER, you must have the global CREATE USER privilege or
the INSERT privilege for the mysql database. When the read_only system
variable is enabled, CREATE USER additionally requires the SUPER
privilege.

For each account, CREATE USER creates a new row in the mysql.user table
with no privileges and (as of MySQL 5.5.7) assigns the account an
authentication plugin. Depending on the syntax used, CREATE USER may
also assign the account a password.

Each user_specification clause consists of an account name and


information about how authentication occurs for clients that use the
account. This part of CREATE USER syntax is shared with GRANT, so the
description here applies to GRANT as well.

Each account name uses the format described in


http://dev.mysql.com/doc/refman/5.5/en/account-names.html. For example:

CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';

If you specify only the user name part of the account name, a host name
part of '%' is used.

The server assigns an authentication plugin and password to each


account as follows, depending on whether the user specification clause
includes IDENTIFIED WITH to specify a plugin or IDENTIFIED BY to
specify a password:

*Note*: IDENTIFIED WITH is available as of MySQL 5.5.7. Before 5.5.7,


authentication plugins are not used, so only the remarks about
IDENTIFIED BY apply.

o With IDENTIFIED WITH, the server assigns the specified plugin and the
account has no password. If the optional AS 'hash_string' clause is
also given, the string is stored as is in the authentication_string
column (it is assumed to be already hashed in the format required by
the plugin).

o With IDENTIFIED BY, the server assigns no plugin and assigns the
specified password.

o With neither IDENTIFIED WITH nor IDENTIFIED BY, the server assigns no
plugin and the account has no password.

If the account has no password, the Password column in the account's


mysql.user table row remains empty, which is insecure. To set the
password, use SET PASSWORD. See [HELP SET PASSWORD].
If the server assigns no plugin to the account, the plugin column in
the account's mysql.user table row remains empty.

For client connections that use a given account, the server invokes the
authentication plugin assigned to the account and the client must
provide credentials as required by the authentication method that the
plugin implements. If the server cannot find the plugin, either at
account-creation time or connect time, an error occurs.

If an account's mysql.user table row has a nonempty plugin column:

o The server authenticates client connection attempts using the named


plugin.

o Changes to the account password using SET PASSWORD with PASSWORD()


must be made with the old_passwords system variable set to the value
required by the authentication plugin, so that PASSWORD() uses the
appropriate password hashing method. If the plugin is
mysql_old_password, the password can also be changed using SET
PASSWORD with OLD_PASSWORD(), which uses pre-4.1 password hashing
regardless of the value of old_passwords.

If an account's mysql.user table row has an empty plugin column:

o The server authenticates client connection attempts using the


mysql_native_password or mysql_old_password authentication plugin,
depending on the hash format of the password stored in the Password
column.

o Changes to the account password using SET PASSWORD can be made with
PASSWORD(), with old_passwords set to 0 or 1 for 4.1 or pre-4.1
password hashing, respectively, or with OLD_PASSWORD(), which uses
pre-4.1 password hashing regardless of the value of old_passwords.

CREATE USER examples:

o To specify an authentication plugin for an account, use IDENTIFIED


WITH auth_plugin. The plugin name can be a quoted string literal or
an unquoted name. 'auth_string' is an optional quoted string literal
to pass to the plugin. The plugin interprets the meaning of the
string, so its format is plugin specific and it is stored in the
authentication_string column as given. (This value is meaningful only
for plugins that use that column.) Consult the documentation for a
given plugin for information about the authentication string values
it accepts, if any.

CREATE USER 'jeffrey'@'localhost' IDENTIFIED WITH mysql_native_password;

The server assigns the given authentication plugin to the account but
no password. Clients must provide no password when they connect.
However, an account with no password is insecure. To ensure that an
account uses a specific authentication plugin and has a password with
the corresponding hash format, specify the plugin explicitly with
IDENTIFIED WITH, then use SET PASSWORD to set the password:

CREATE USER 'jeffrey'@'localhost' IDENTIFIED WITH mysql_native_password;


SET old_passwords = 0;
SET PASSWORD FOR 'jeffrey'@'localhost' = PASSWORD('mypass');

Changes to the account password using SET PASSWORD with PASSWORD()


must be made with the old_passwords system variable set to the value
required by the account's authentication plugin, so that PASSWORD()
uses the appropriate password hashing method. Therefore, to use the
mysql_old_password plugin instead, name that plugin in the CREATE
USER statement and set old_passwords to 1 before using SET PASSWORD.

o To specify a password for an account at account-creation time, use


IDENTIFIED BY with the literal cleartext password value:

CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';

The server assigns the given password to the account but no


authentication plugin. Clients must provide the password when they
connect.

o To avoid specifying the cleartext password if you know its hash value
(the value that PASSWORD() would return for the password), specify
the hash value preceded by the keyword PASSWORD:

CREATE USER 'jeffrey'@'localhost'


IDENTIFIED BY PASSWORD '*90E462C37378CED12064BB3388827D2BA3A9B689';

The server assigns the given password to the account but no


authentication plugin. Clients must provide the password when they
connect.

o To enable the user to connect with no password, include no IDENTIFIED


BY clause:

CREATE USER 'jeffrey'@'localhost';

The server assigns no authentication plugin or password to the


account. Clients must provide no password when they connect. However,
an account with no password is insecure. To avoid this, use SET
PASSWORD to set the account password.

For additional information about setting passwords and authentication


plugins, see
http://dev.mysql.com/doc/refman/5.5/en/assigning-passwords.html, and
http://dev.mysql.com/doc/refman/5.5/en/pluggable-authentication.html.

URL: http://dev.mysql.com/doc/refman/5.5/en/create-user.html

Syntax:
GRANT
priv_type [(column_list)]
[, priv_type [(column_list)]] ...
ON [object_type] priv_level
TO user_specification [, user_specification] ...
[REQUIRE {NONE | tsl_option [[AND] tsl_option] ...}]
[WITH {GRANT OPTION | resource_option} ...]

GRANT PROXY ON user_specification


TO user_specification [, user_specification] ...
[WITH GRANT OPTION]

object_type: {
TABLE
| FUNCTION
| PROCEDURE
}

priv_level: {
*
| *.*
| db_name.*
| db_name.tbl_name
| tbl_name
| db_name.routine_name
}

user_specification:
user [ auth_option ]

auth_option: {
IDENTIFIED BY 'auth_string'
| IDENTIFIED BY PASSWORD 'hash_string'
| IDENTIFIED WITH auth_plugin
| IDENTIFIED WITH auth_plugin AS 'hash_string'
}

tsl_option: {
SSL
| X509
| CIPHER 'cipher'
| ISSUER 'issuer'
| SUBJECT 'subject'
}

resource_option: {
| MAX_QUERIES_PER_HOUR count
| MAX_UPDATES_PER_HOUR count
| MAX_CONNECTIONS_PER_HOUR count
| MAX_USER_CONNECTIONS count
}

The GRANT statement grants privileges to MySQL user accounts. GRANT


also serves to specify other account characteristics such as use of
secure connections and limits on access to server resources.

To use GRANT, you must have the GRANT OPTION privilege, and you must
have the privileges that you are granting. When the read_only system
variable is enabled, GRANT additionally requires the SUPER privilege.

The REVOKE statement is related to GRANT and enables administrators to


remove account privileges. See [HELP REVOKE].

Normally, a database administrator first uses CREATE USER to create an


account, then GRANT to define its privileges and characteristics. For
example:

CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';


GRANT ALL ON db1.* TO 'jeffrey'@'localhost';
GRANT SELECT ON db2.invoice TO 'jeffrey'@'localhost';
GRANT USAGE ON *.* TO 'jeffrey'@'localhost' WITH MAX_QUERIES_PER_HOUR 90;

*Note*: Examples shown here include no IDENTIFIED clause. It is assumed


that you establish passwords with CREATE USER at account-creation time
to avoid creating insecure accounts.

If an account named in a GRANT statement does not already exist, GRANT


may create it under the conditions described later in the discussion of
the NO_AUTO_CREATE_USER SQL mode.

From the mysql program, GRANT responds with Query OK, 0 rows affected
when executed successfully. To determine what privileges result from
the operation, use SHOW GRANTS. See [HELP SHOW GRANTS].

URL: http://dev.mysql.com/doc/refman/5.5/en/grant.html
Syntax:
SET PASSWORD [FOR user] = password_option

password_option: {
PASSWORD('auth_string')
| OLD_PASSWORD('auth_string')
| 'hash_string'
}

The SET PASSWORD statement assigns a password to a MySQL user account,


specified as either a cleartext (unencrypted) or encrypted value:

o 'auth_string' represents a cleartext password.

o 'hash_string' represents an encrypted password.

SET PASSWORD can be used with or without an explicitly named user


account:

o With a FOR user clause, the statement sets the password for the named
account, which must exist:

SET PASSWORD FOR 'jeffrey'@'localhost' = password_option;

In this case, you must have the UPDATE privilege for the mysql
database.

o With no FOR user clause, the statement sets the password for the
current user:

SET PASSWORD = password_option;

Any client who connects to the server using a nonanonymous account


can change the password for that account. To see which account the
server authenticated you as, invoke the CURRENT_USER() function:

SELECT CURRENT_USER();

When the read_only system variable is enabled, SET PASSWORD requires


the SUPER privilege in addition to any other required privileges.

If a FOR user clause is given, the account name uses the format
described in http://dev.mysql.com/doc/refman/5.5/en/account-names.html.
The user value should be given as 'user_name'@'host_name', where
'user_name' and 'host_name' are exactly as listed in the User and Host
columns of the account's mysql.user table row. If you specify only a
user name, a host name of '%' is used. For example, to set the password
for an account with User and Host column values of 'bob' and
'%.example.org', write the statement like this:

SET PASSWORD FOR 'bob'@'%.example.org' = PASSWORD('auth_string');

The password can be specified in these ways:

o Using the PASSWORD() function

The 'auth_string' function argument is the cleartext (unencrypted)


password. PASSWORD() hashes the password and returns the encrypted
password string for storage in the mysql.user account row.

The PASSWORD() function hashes the password using the hashing method
determined by the value of the old_passwords system variable value.
It should be set to a value compatible with the hash format required
by the account authentication plugin. For example, if the account
uses the mysql_native_password authentication plugin, old_passwords
should be 0 for PASSWORD() to produce a hash value in the correct
format. For mysql_old_password, old_passwords should be 1.

o Using the OLD_PASSWORD() function:

The 'auth_string' function argument is the cleartext (unencrypted)


password. OLD_PASSWORD() hashes the password using pre-4.1 hashing
and returns the encrypted password string for storage in the
mysql.user account row. This hashing method is appropriate only for
accounts that use the mysql_old_password authentication plugin.

o Using an already encrypted password string

The password is specified as a string literal. It must represent the


already encrypted password value, in the hash format required by the
authentication method used for the account.

URL: http://dev.mysql.com/doc/refman/5.5/en/set-password.html

Syntax:
mysql> help search_string

If you provide an argument to the help command, mysql uses it as a


search string to access server-side help from the contents of the MySQL
Reference Manual. The proper operation of this command requires that
the help tables in the mysql database be initialized with help topic
information (see
http://dev.mysql.com/doc/refman/5.5/en/server-side-help-support.html).

If there is no match for the search string, the search fails:

mysql> help me

Nothing found
Please try to run 'help contents' for a list of all accessible topics

Use help contents to see a list of the help categories:

mysql> help contents


You asked for help about help category: "Contents"
For more information, type 'help <item>', where <item> is one of the
following categories:
Account Management
Administration
Data Definition
Data Manipulation
Data Types
Functions
Functions and Modifiers for Use with GROUP BY
Geographic Features
Language Structure
Plugins
Storage Engines
Stored Routines
Table Maintenance
Transactions
Triggers

If the search string matches multiple items, mysql shows a list of


matching topics:

mysql> help logs


Many help items for your request exist.
To make a more specific request, please type 'help <item>',
where <item> is one of the following topics:
SHOW
SHOW BINARY LOGS
SHOW ENGINE
SHOW LOGS

Use a topic as the search string to see the help entry for that topic:

mysql> help show binary logs


Name: 'SHOW BINARY LOGS'
Description:
Syntax:
SHOW BINARY LOGS
SHOW MASTER LOGS

Lists the binary log files on the server. This statement is used as
part of the procedure described in [purge-binary-logs], that shows how
to determine which logs can be purged.

mysql> SHOW BINARY LOGS;


+---------------+-----------+
| Log_name | File_size |
+---------------+-----------+
| binlog.000015 | 724935 |
| binlog.000016 | 733481 |
+---------------+-----------+

The search string can contain the wildcard characters "%" and "_".
These have the same meaning as for pattern-matching operations
performed with the LIKE operator. For example, HELP rep% returns a list
of topics that begin with rep:

mysql> HELP rep%


Many help items for your request exist.
To make a more specific request, please type 'help <item>',
where <item> is one of the following
topics:
REPAIR TABLE
REPEAT FUNCTION
REPEAT LOOP
REPLACE
REPLACE FUNCTION

URL: http://dev.mysql.com/doc/refman/5.5/en/mysql-server-side-help.html

Syntax:
KILL [CONNECTION | QUERY] processlist_id

Each connection to mysqld runs in a separate thread. You can kill a


thread with the KILL processlist_id statement.

Thread processlist identifiers can be determined from the ID column of


the INFORMATION_SCHEMA.PROCESSLIST table, the Id column of SHOW
PROCESSLIST output, and the PROCESSLIST_ID column of the Performance
Schema threads table. The value for the current thread is returned by
the CONNECTION_ID() function.

KILL permits an optional CONNECTION or QUERY modifier:

o KILL CONNECTION is the same as KILL with no modifier: It terminates


the connection associated with the given processlist_id, after
terminating any statement the connection is executing.

o KILL QUERY terminates the statement the connection is currently


executing, but leaves the connection itself intact.

If you have the PROCESS privilege, you can see all threads. If you have
the SUPER privilege, you can kill all threads and statements.
Otherwise, you can see and kill only your own threads and statements.

You can also use the mysqladmin processlist and mysqladmin kill
commands to examine and kill threads.

*Note*: You cannot use KILL with the Embedded MySQL Server library
because the embedded server merely runs inside the threads of the host
application. It does not create any connection threads of its own.

URL: http://dev.mysql.com/doc/refman/5.5/en/kill.html

SHOW has many forms that provide information about databases, tables,
columns, or status information about the server. This section describes
those following:

SHOW AUTHORS
SHOW {BINARY | MASTER} LOGS
SHOW BINLOG EVENTS [IN 'log_name'] [FROM pos] [LIMIT [offset,] row_count]
SHOW CHARACTER SET [like_or_where]
SHOW COLLATION [like_or_where]
SHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [like_or_where]
SHOW CONTRIBUTORS
SHOW CREATE DATABASE db_name
SHOW CREATE EVENT event_name
SHOW CREATE FUNCTION func_name
SHOW CREATE PROCEDURE proc_name
SHOW CREATE TABLE tbl_name
SHOW CREATE TRIGGER trigger_name
SHOW CREATE VIEW view_name
SHOW DATABASES [like_or_where]
SHOW ENGINE engine_name {STATUS | MUTEX}
SHOW [STORAGE] ENGINES
SHOW ERRORS [LIMIT [offset,] row_count]
SHOW EVENTS
SHOW FUNCTION CODE func_name
SHOW FUNCTION STATUS [like_or_where]
SHOW GRANTS FOR user
SHOW INDEX FROM tbl_name [FROM db_name]
SHOW MASTER STATUS
SHOW OPEN TABLES [FROM db_name] [like_or_where]
SHOW PLUGINS
SHOW PROCEDURE CODE proc_name
SHOW PROCEDURE STATUS [like_or_where]
SHOW PRIVILEGES
SHOW [FULL] PROCESSLIST
SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
SHOW PROFILES
SHOW RELAYLOG EVENTS [IN 'log_name'] [FROM pos] [LIMIT [offset,] row_count]
SHOW SLAVE HOSTS
SHOW SLAVE STATUS
SHOW [GLOBAL | SESSION] STATUS [like_or_where]
SHOW TABLE STATUS [FROM db_name] [like_or_where]
SHOW [FULL] TABLES [FROM db_name] [like_or_where]
SHOW TRIGGERS [FROM db_name] [like_or_where]
SHOW [GLOBAL | SESSION] VARIABLES [like_or_where]
SHOW WARNINGS [LIMIT [offset,] row_count]
like_or_where:
LIKE 'pattern'
| WHERE expr

If the syntax for a given SHOW statement includes a LIKE 'pattern'


part, 'pattern' is a string that can contain the SQL "%" and "_"
wildcard characters. The pattern is useful for restricting statement
output to matching values.

Several SHOW statements also accept a WHERE clause that provides more
flexibility in specifying which rows to display. See
http://dev.mysql.com/doc/refman/5.5/en/extended-show.html.

URL: http://dev.mysql.com/doc/refman/5.5/en/show.html

Syntax:
SIGNAL condition_value
[SET signal_information_item
[, signal_information_item] ...]

condition_value:
SQLSTATE [VALUE] sqlstate_value
| condition_name

signal_information_item:
condition_information_item_name = simple_value_specification

condition_information_item_name:
CLASS_ORIGIN
| SUBCLASS_ORIGIN
| MESSAGE_TEXT
| MYSQL_ERRNO
| CONSTRAINT_CATALOG
| CONSTRAINT_SCHEMA
| CONSTRAINT_NAME
| CATALOG_NAME
| SCHEMA_NAME
| TABLE_NAME
| COLUMN_NAME
| CURSOR_NAME

condition_name, simple_value_specification:
(see following discussion)

SIGNAL is the way to "return" an error. SIGNAL provides error


information to a handler, to an outer portion of the application, or to
the client. Also, it provides control over the error's characteristics
(error number, SQLSTATE value, message). Without SIGNAL, it is
necessary to resort to workarounds such as deliberately referring to a
nonexistent table to cause a routine to return an error.

No special privileges are required to execute the SIGNAL statement.

The condition_value in a SIGNAL statement indicates the error value to


be returned. It can be an SQLSTATE value (a 5-character string literal)
or a condition_name that refers to a named condition previously defined
with DECLARE ... CONDITION (see [HELP DECLARE CONDITION]).

An SQLSTATE value can indicate errors, warnings, or "not found." The


first two characters of the value indicate its error class, as
discussed in
http://dev.mysql.com/doc/refman/5.5/en/signal.html#signal-condition-inf
ormation-items. Some signal values cause statement termination; see
http://dev.mysql.com/doc/refman/5.5/en/signal.html#signal-effects.

The SQLSTATE value for a SIGNAL statement should not start with '00'
because such values indicate success and are not valid for signaling an
error. This is true whether the SQLSTATE value is specified directly in
the SIGNAL statement or in a named condition referred to in the
statement. If the value is invalid, a Bad SQLSTATE error occurs.

To signal a generic SQLSTATE value, use '45000', which means "unhandled


user-defined exception."

The SIGNAL statement optionally includes a SET clause that contains


multiple signal items, in a comma-separated list of
condition_information_item_name = simple_value_specification
assignments.

Each condition_information_item_name may be specified only once in the


SET clause. Otherwise, a Duplicate condition information item error
occurs.

Valid simple_value_specification designators can be specified using


stored procedure or function parameters, stored program local variables
declared with DECLARE, user-defined variables, system variables, or
literals. A character literal may include a _charset introducer.

For information about permissible condition_information_item_name


values, see
http://dev.mysql.com/doc/refman/5.5/en/signal.html#signal-condition-inf
ormation-items.

URL: http://dev.mysql.com/doc/refman/5.5/en/signal.html

Syntax:
ALTER {DATABASE | SCHEMA} [db_name]
alter_specification ...
ALTER {DATABASE | SCHEMA} db_name
UPGRADE DATA DIRECTORY NAME

alter_specification:
[DEFAULT] CHARACTER SET [=] charset_name
| [DEFAULT] COLLATE [=] collation_name

ALTER DATABASE enables you to change the overall characteristics of a


database. These characteristics are stored in the db.opt file in the
database directory. To use ALTER DATABASE, you need the ALTER privilege
on the database. ALTER SCHEMA is a synonym for ALTER DATABASE.

The database name can be omitted from the first syntax, in which case
the statement applies to the default database.

National Language Characteristics

The CHARACTER SET clause changes the default database character set.
The COLLATE clause changes the default database collation.
http://dev.mysql.com/doc/refman/5.5/en/charset.html, discusses
character set and collation names.

You can see what character sets and collations are available using,
respectively, the SHOW CHARACTER SET and SHOW COLLATION statements. See
[HELP SHOW CHARACTER SET], and [HELP SHOW COLLATION], for more
information.
If you change the default character set or collation for a database,
stored routines that use the database defaults must be dropped and
recreated so that they use the new defaults. (In a stored routine,
variables with character data types use the database defaults if the
character set or collation are not specified explicitly. See [HELP
CREATE PROCEDURE].)

Upgrading from Versions Older than MySQL 5.1

The syntax that includes the UPGRADE DATA DIRECTORY NAME clause updates
the name of the directory associated with the database to use the
encoding implemented in MySQL 5.1 for mapping database names to
database directory names (see
http://dev.mysql.com/doc/refman/5.5/en/identifier-mapping.html). This
clause is for use under these conditions:

o It is intended when upgrading MySQL to 5.1 or later from older


versions.

o It is intended to update a database directory name to the current


encoding format if the name contains special characters that need
encoding.

o The statement is used by mysqlcheck (as invoked by mysql_upgrade).

For example, if a database in MySQL 5.0 has the name a-b-c, the name
contains instances of the - (dash) character. In MySQL 5.0, the
database directory is also named a-b-c, which is not necessarily safe
for all file systems. In MySQL 5.1 and later, the same database name is
encoded as a@002db@002dc to produce a file system-neutral directory
name.

When a MySQL installation is upgraded to MySQL 5.1 or later from an


older version,the server displays a name such as a-b-c (which is in the
old format) as #mysql50#a-b-c, and you must refer to the name using the
#mysql50# prefix. Use UPGRADE DATA DIRECTORY NAME in this case to
explicitly tell the server to re-encode the database directory name to
the current encoding format:

ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;

After executing this statement, you can refer to the database as a-b-c
without the special #mysql50# prefix.

URL: http://dev.mysql.com/doc/refman/5.5/en/alter-database.html

Syntax:
TRUNCATE [TABLE] tbl_name

TRUNCATE TABLE empties a table completely. It requires the DROP


privilege.

Logically, TRUNCATE TABLE is similar to a DELETE statement that deletes


all rows, or a sequence of DROP TABLE and CREATE TABLE statements. To
achieve high performance, it bypasses the DML method of deleting data.
Thus, it cannot be rolled back, it does not cause ON DELETE triggers to
fire, and it cannot be performed for InnoDB tables with parent-child
foreign key relationships.

Although TRUNCATE TABLE is similar to DELETE, it is classified as a DDL


statement rather than a DML statement. It differs from DELETE in the
following ways in MySQL 5.5:
o Truncate operations drop and re-create the table, which is much
faster than deleting rows one by one, particularly for large tables.

o Truncate operations cause an implicit commit, and so cannot be rolled


back.

o Truncation operations cannot be performed if the session holds an


active table lock.

o TRUNCATE TABLE fails for an InnoDB table if there are any FOREIGN KEY
constraints from other tables that reference the table. Foreign key
constraints between columns of the same table are permitted.

o Truncation operations do not return a meaningful value for the number


of deleted rows. The usual result is "0 rows affected," which should
be interpreted as "no information."

o As long as the table format file tbl_name.frm is valid, the table can
be re-created as an empty table with TRUNCATE TABLE, even if the data
or index files have become corrupted.

o Any AUTO_INCREMENT value is reset to its start value. This is true


even for MyISAM and InnoDB, which normally do not reuse sequence
values.

o When used with partitioned tables, TRUNCATE TABLE preserves the


partitioning; that is, the data and index files are dropped and
re-created, while the partition definitions (.par) file is
unaffected.

o The TRUNCATE TABLE statement does not invoke ON DELETE triggers.

URL: http://dev.mysql.com/doc/refman/5.5/en/truncate-table.html

You might also like