Determine if MySQL has been started with skip tables
1 answer
There doesn't seem to be a variable to determine this.
The following stored procedure might give you some ideas:
DELIMITER //
DROP PROCEDURE IF EXISTS `_`.`skip_grant_tables`//
CREATE PROCEDURE `_`.`skip_grant_tables`(OUT `skip_grant` BOOL)
BEGIN
DECLARE `skip_grant_text` TEXT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
BEGIN
GET DIAGNOSTICS CONDITION 1 `skip_grant_text` = MESSAGE_TEXT;
END;
SET `skip_grant` := 0;
GRANT SELECT ON *.* TO ''@'';
IF (`skip_grant_text` REGEXP '--skip-grant-tables option') THEN
SET `skip_grant` := 1;
END IF;
END//
DELIMITER ;
mysql> CALL `_`.`skip_grant_tables`(@`skip_grant_tables?`);
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT @`skip_grant_tables?`;
+-----------------------+
| @`skip_grant_tables?` |
+-----------------------+
| 1 |
+-----------------------+
1 row in set (0.00 sec)
+2
source to share