Description:
mysql> SET @@GLOBAL.storage_engine="InnoDB";
Query OK, 0 rows affected (0.00 sec)
mysql> SET @@SESSION.storage_engine="InnoDB";
Query OK, 0 rows affected (0.00 sec)
mysql> SHOW GLOBAL VARIABLES LIKE 'storage_engine';
+----------------+--------+
| Variable_name | Value |
+----------------+--------+
| storage_engine | InnoDB |
+----------------+--------+
1 row in set (0.00 sec)
mysql> SHOW SESSION VARIABLES LIKE 'storage_engine';
+----------------+--------+
| Variable_name | Value |
+----------------+--------+
| storage_engine | InnoDB |
+----------------+--------+
1 row in set (0.00 sec)
mysql> DELIMITER //
mysql> DROP PROCEDURE IF EXISTS testse//
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE PROCEDURE testse()
-> BEGIN
-> DROP TABLE IF EXISTS a;
-> SET @@GLOBAL.storage_engine="MyISAM";
-> SET @@SESSION.storage_engine="MyISAM";
-> SHOW GLOBAL VARIABLES LIKE 'storage_engine';
-> SHOW SESSION VARIABLES LIKE 'storage_engine';
-> CREATE TABLE a (id int);
-> SHOW CREATE TABLE a;
-> END;
-> //
Query OK, 0 rows affected (0.00 sec)
mysql> DELIMITER ;
mysql> CALL testse;
+----------------+--------+
| Variable_name | Value |
+----------------+--------+
| storage_engine | MyISAM |
+----------------+--------+
1 row in set (0.04 sec)
+----------------+--------+
| Variable_name | Value |
+----------------+--------+
| storage_engine | MyISAM |
+----------------+--------+
1 row in set (0.26 sec)
+-------+---------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+---------------------------------------------------------------------------------------+
| a | CREATE TABLE `a` (
`id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+---------------------------------------------------------------------------------------+
1 row in set (0.48 sec)
Query OK, 0 rows affected (0.78 sec)
mysql> SHOW GLOBAL VARIABLES LIKE 'storage_engine';
+----------------+--------+
| Variable_name | Value |
+----------------+--------+
| storage_engine | MyISAM |
+----------------+--------+
1 row in set (0.00 sec)
mysql> SHOW SESSION VARIABLES LIKE 'storage_engine';
+----------------+--------+
| Variable_name | Value |
+----------------+--------+
| storage_engine | MyISAM |
+----------------+--------+
1 row in set (0.00 sec)
How to repeat:
SET @@GLOBAL.storage_engine="InnoDB";
SET @@SESSION.storage_engine="InnoDB";
SHOW GLOBAL VARIABLES LIKE 'storage_engine';
SHOW SESSION VARIABLES LIKE 'storage_engine';
DELIMITER //
DROP PROCEDURE IF EXISTS testse//
CREATE PROCEDURE testse()
BEGIN
DROP TABLE IF EXISTS a;
SET @@GLOBAL.storage_engine="MyISAM";
SET @@SESSION.storage_engine="MyISAM";
SHOW GLOBAL VARIABLES LIKE 'storage_engine';
SHOW SESSION VARIABLES LIKE 'storage_engine';
CREATE TABLE a (id int);
SHOW CREATE TABLE a;
END;
//
DELIMITER ;
CALL testse;
SHOW GLOBAL VARIABLES LIKE 'storage_engine';
SHOW SESSION VARIABLES LIKE 'storage_engine';