Automatically detect READ_ONLY mode for MySQL/MariaDB