public boolean connect(Plugin plugin) {
        Logging.info("Connecting to MySQL database.");
        db = new MySQL(
                Logging.getLog(),
                Logging.getNameVersion(),
                Config.getHost(),
                Config.getPort(),
                Config.getDatabase(),
                Config.getUsername(),
                Config.getPassword());

        try {
            db.open();
            if (!db.checkConnection()) return false;
        } catch (Exception e) {
            Logging.severe("Connection to MySQL database failed.");
            return false;
        }

        try {
            checkTables();
        } catch (Exception e) {
            Logging.severe("Could not access MySQL tables.");
            return false;
        }
        Logging.info("Connected to MySQL database and verified tables.");
        return true;
    }