A complementary note about CREATE TABLE .. TYPE=""
syntax in SQL dump files
TLDR: If you still get CREATE TABLE ... TYPE="..."
statements in SQL dump files generated by third party tools, it most certainly indicates that your server is configured to use a default sqlmode
of MYSQL40
or MYSQL323
.
Long story
As it was said by others, the TYPE
argument to CREATE TABLE
has been deprecated for a long time in MySQL. mysqldump
correctly uses the ENGINE
argument, unless you specifically ask it to generate a backward compatible dump (for example using --compatible=mysql40
in versions of mysqldump
up to 5.7).
However, many external SQL dump tools (for example, those integrated in MySQL clients such as phpmyadmin, Navicat and DBVisualizer, as well as those used by external automated backup services such as iControlWP) are not specifically aware of this change, and instead rely on the SHOW CREATE TABLE ...
command to provide table creation statements for each tables (and just to it make it clear: this is actually a good thing). However, the SHOW CREATE TABLE
will actually produce outdated syntax, including the TYPE
argument, if the sqlmode
variable is set to MYSQL40
or MYSQL323
.
Therefore, if you still get CREATE TABLE ... TYPE="..."
statements in SQL dump files generated by third party tools, it most certainly indicates that your server is configured to use a default sqlmode
of MYSQL40
or MYSQL323
.
These sqlmode
s basically configure MySQL to retain some backward compatible behaviours, and using them by default was largely recommended a few years ago. It is however highly improbable that you still have any code that wouldn't work correctly without these modes. Anyway, MYSQL40
, MYSQL323
and several other similar sqlmode
s have themselves been deprecated and are not supported in MySQL 8.0 and higher.
If your server is still configured with these sqlmode
s and you are worried that some legacy program might fail if you change these, then one possibility is to set the sqlmode
locally for that program, by executing SET SESSION sql_mode = 'MYSQL40';
immediately after connection. Note that this should only be considered as a temporary patch, and will not work in MySQL 8.0 and higher.
A more future-proof solution that do not involve rewriting your SQL queries would be to determine exactly which compatibility features need to be enable, and to enable only those, on a per-program basis (as described previously). The default sqlmode
(that is, in server's configuration) should ideally be left unset (which will use official MySQL defaults for your current version). The full list of sqlmode
(as of MySQL 5.7) is described here: https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html.