The Information Systems and Computer Applications examination covers material that is usually taught in an introductory college-level business information systems course.

CREATE TABLE en MySQL 5.6

CREATE TABLE en MySQL 5.6

En versiones anteriores a MySQL 5.6 podíamos crear tablas sin especificar el storage engine:

mysql> create table lol(id int);
Query OK, 0 rows affected (0.11 sec)

A partir de MySQL 5.6, por defecto, se quejará de error de sintaxis:

mysql> create table lol(int id);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'int id)' at line 1

Si miramos el sql_mode que tenemos por defecto en MySQL 5.6 veremos que tenemos:

mysql> show variables like 'sql_mode';
+---------------+--------------------------------------------+
| Variable_name | Value                                      |
+---------------+--------------------------------------------+
| sql_mode      | STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION |
+---------------+--------------------------------------------+
1 row in set (0.01 sec)

Mediante NO_ENGINE_SUBSTITUTION indicamos que queremos forzar al usuario a que especifique el engine que quiere usar, en lugar de usar el por defecto (InnoDB en este caso).

No me parece mal el nuevo comportamiento, pero siempre podemos quitar dicha opción del sql_mode para volver al comportamiento anterior:

mysql> set global sql_mode="STRICT_TRANS_TABLES";
Query OK, 0 rows affected (0.00 sec)

Y añadir la opción en el my.cnf para hacerlo permanente.

Tags:

Visit Website