Хостинг серверов Minecraft playvds.com
  1. Вы находитесь в русском сообществе Bukkit. Мы - администраторы серверов Minecraft, разрабатываем собственные плагины и переводим на русский язык плагины наших собратьев из других стран.
    Скрыть объявление

Помогите WorldGuard + MySQL

Тема в разделе "[Архив] Помощь", создана пользователем artem-s86, 22 сен 2012.

  1. Автор темы
    artem-s86

    artem-s86 Участник

    Баллы:
    28
    Все говорят что WG на мускуле полный отстой. Сам еще не пробовал, так как делаем вайп есть мысль переставить на мускул (чтоб удалять скриптом регионы неактивных игроков)
    Есть ли смысл WG на мускуле, если нет то почему? Может знаете как предыдущую задумку реализовать по другому?
     
  2. Хостинг MineCraft
    <
  3. Aleks_Ku

    Aleks_Ku Активный участник Пользователь

    Баллы:
    78
    Skype:
    gm_aleks_ku
    Имя в Minecraft:
    Aleks_Ku
    artem-s86 нравится это.
  4. Автор темы
    artem-s86

    artem-s86 Участник

    Баллы:
    28
    ух ееее
    Спасибо огромное!
     
    Vedroyder и slavik123123123 нравится это.
  5. Aleks_Ku

    Aleks_Ku Активный участник Пользователь

    Баллы:
    78
    Skype:
    gm_aleks_ku
    Имя в Minecraft:
    Aleks_Ku
    ;) не за что. Пользуйтесь на здоровье.
     
  6. Gfdtk

    Gfdtk Активный участник

    Баллы:
    88
    Skype:
    igbuby
    use: true
    dsn: jdbc:mysql://176.9.123.113:3306/u5641_WG
    username: u5641_WG
    password: пароль

    правильно ля я записал? а то плюется....
     
  7. Aleks_Ku

    Aleks_Ku Активный участник Пользователь

    Баллы:
    78
    Skype:
    gm_aleks_ku
    Имя в Minecraft:
    Aleks_Ku
    Немного теории:
    use: false на true поменять
    localhost - ip ДБ
    worldguard - база данных
    username - юзернэйм для ДБ
    password - пароль для ДБ

    Код:
    sql:
            use: false
            dsn: jdbc:mysql://localhost/worldguard
            username: worldguard
            password: worldguard

    В Вашем примере u5641_WG - имя БД и Юзернейма и DSN нужно прописывать jdbc:mysql://localhost/u5641_WG


    SQL-запрос


    Код:
    SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;[/FONT]
    [FONT=monospace]SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;[/FONT]
    [FONT=monospace]SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';[/FONT]
    [LIST=1]
    [*][B] 
    -- -----------------------------------------------------
    -- Table `user`
    -- -----------------------------------------------------
    CREATE  TABLE IF NOT EXISTS `user` (
      `id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
      `name` VARCHAR(64) NOT NULL UNIQUE,
      PRIMARY KEY (`id`))
    ENGINE = InnoDB;
     
     
    -- -----------------------------------------------------
    -- Table `group`
    -- -----------------------------------------------------
    CREATE  TABLE IF NOT EXISTS `group` (
      `id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
      `name` VARCHAR(64) NOT NULL UNIQUE,
      PRIMARY KEY (`id`))
    ENGINE = InnoDB;
     
     
    -- -----------------------------------------------------
    -- Table `world`
    -- -----------------------------------------------------
    CREATE  TABLE IF NOT EXISTS `world` (
      `id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
      `name` VARCHAR(128) NOT NULL UNIQUE,
      PRIMARY KEY (`id`))
    ENGINE = InnoDB;
     
     
    -- -----------------------------------------------------
    -- Table `region`
    -- -----------------------------------------------------
    CREATE  TABLE IF NOT EXISTS `region` (
      `id` VARCHAR(128) NOT NULL ,
      `world_id` INT UNSIGNED NOT NULL ,
      `type` ENUM('cuboid','poly2d','global') NOT NULL ,
      `priority` SMALLINT NOT NULL DEFAULT 0 ,
      `parent` VARCHAR(128) NULL ,
      PRIMARY KEY (`id`, `world_id`) ,
      INDEX `parent` (`parent` ASC) ,
      INDEX `fk_region_world` (`world_id` ASC) ,
      CONSTRAINT `parent`
        FOREIGN KEY (`parent` )
        REFERENCES `region` (`id` )
        ON DELETE SET NULL
        ON UPDATE CASCADE,
      CONSTRAINT `fk_region_world1`
        FOREIGN KEY (`world_id` )
        REFERENCES `world` (`id` )
        ON DELETE CASCADE
        ON UPDATE CASCADE)
    ENGINE = InnoDB;
     
     
    -- -----------------------------------------------------
    -- Table `region_flag`
    -- -----------------------------------------------------
    CREATE  TABLE IF NOT EXISTS `region_flag` (
      `id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
      `region_id` VARCHAR(128) NOT NULL ,
      `flag` VARCHAR(64) NOT NULL ,
      `value` VARCHAR(256) NOT NULL ,
      INDEX `fk_flags_region` (`region_id` ASC) ,
      PRIMARY KEY (`id`) ,
      CONSTRAINT `fk_flags_region1`
        FOREIGN KEY (`region_id` )
        REFERENCES `region` (`id` )
        ON DELETE CASCADE
        ON UPDATE CASCADE)
    ENGINE = InnoDB;
     
     
    -- -----------------------------------------------------
    -- Table `region_cuboid`
    -- -----------------------------------------------------
    CREATE  TABLE IF NOT EXISTS `region_cuboid` (
      `region_id` VARCHAR(128) NOT NULL ,
      `min_z` BIGINT NOT NULL ,
      `min_y` BIGINT NOT NULL ,
      `min_x` BIGINT NOT NULL ,
      `max_z` BIGINT NOT NULL ,
      `max_y` BIGINT NOT NULL ,
      `max_x` BIGINT NOT NULL ,
      PRIMARY KEY (`region_id`) ,
      INDEX `fk_region_cuboid_region` (`region_id` ASC) ,
      CONSTRAINT `fk_region_cuboid_region`
        FOREIGN KEY (`region_id` )
        REFERENCES `region` (`id` )
        ON DELETE CASCADE
        ON UPDATE CASCADE)
    ENGINE = InnoDB;
     
     
    -- -----------------------------------------------------
    -- Table `region_poly2d`
    -- -----------------------------------------------------
    CREATE  TABLE IF NOT EXISTS `region_poly2d` (
      `region_id` VARCHAR(128) NOT NULL ,
      `max_y` INT NOT NULL ,
      `min_y` INT NOT NULL ,
      PRIMARY KEY (`region_id`) ,
      INDEX `fk_region_poly2d_region` (`region_id` ASC) ,
      CONSTRAINT `fk_region_poly2d_region`
        FOREIGN KEY (`region_id` )
        REFERENCES `region` (`id` )
        ON DELETE CASCADE
        ON UPDATE CASCADE)
    ENGINE = InnoDB;
     
     
    -- -----------------------------------------------------
    -- Table `region_players`
    -- -----------------------------------------------------
    CREATE  TABLE IF NOT EXISTS `region_players` (
      `region_id` VARCHAR(128) NOT NULL ,
      `user_id` INT UNSIGNED NOT NULL ,
      `owner` TINYINT(1)  NOT NULL ,
      PRIMARY KEY (`region_id`, `user_id`) ,
      INDEX `fk_region_players_region` (`region_id` ASC) ,
      INDEX `fk_region_players_user` (`user_id` ASC) ,
      CONSTRAINT `fk_region_players_region`
        FOREIGN KEY (`region_id` )
        REFERENCES `region` (`id` )
        ON DELETE CASCADE
        ON UPDATE CASCADE,
      CONSTRAINT `fk_region_players_user`
        FOREIGN KEY (`user_id` )
        REFERENCES `user` (`id` )
        ON DELETE CASCADE
        ON UPDATE CASCADE)
    ENGINE = InnoDB;
     
     
    -- -----------------------------------------------------
    -- Table `region_groups`
    -- -----------------------------------------------------
    CREATE  TABLE IF NOT EXISTS `region_groups` (
      `region_id` VARCHAR(128) NOT NULL ,
      `group_id` INT UNSIGNED NOT NULL ,
      `owner` TINYINT(1)  NOT NULL ,
      PRIMARY KEY (`region_id`, `group_id`) ,
      INDEX `fk_region_groups_region` (`region_id` ASC) ,
      INDEX `fk_region_groups_group` (`group_id` ASC) ,
      CONSTRAINT `fk_region_groups_region`
        FOREIGN KEY (`region_id` )
        REFERENCES `region` (`id` )
        ON DELETE CASCADE
        ON UPDATE CASCADE,
      CONSTRAINT `fk_region_groups_group`
        FOREIGN KEY (`group_id` )
        REFERENCES `group` (`id` )
        ON DELETE CASCADE
        ON UPDATE CASCADE)
    ENGINE = InnoDB;
     
     
    -- -----------------------------------------------------
    -- Table `region_poly2d_point`
    -- -----------------------------------------------------
    CREATE  TABLE IF NOT EXISTS `region_poly2d_point` (
      `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT ,
      `region_id` VARCHAR(128) NOT NULL ,
      `z` BIGINT NOT NULL ,
      `x` BIGINT NOT NULL ,
      PRIMARY KEY (`id`) ,
      INDEX `fk_region_poly2d_point_region_poly2d` (`region_id` ASC) ,
      CONSTRAINT `fk_region_poly2d_point_region_poly2d`
        FOREIGN KEY (`region_id` )
        REFERENCES `region_poly2d` (`region_id` )
        ON DELETE CASCADE
        ON UPDATE CASCADE)
    ENGINE = InnoDB;
     
     
     
    SET SQL_MODE=@OLD_SQL_MODE;
    SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
    SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
    [/B]
    [/LIST]



      1. ;
    [/code]
     
    ВремяПриключений нравится это.
  8. Gfdtk

    Gfdtk Активный участник

    Баллы:
    88
    Skype:
    igbuby
    Все равно такая же хрень...
    [WorldGuard] Access denied for user 'u5641_WG'@'127.0.0.1' (using password: YES)
    java.sql.SQLException: Access denied for user 'u5641_WG'@'127.0.0.1' (using password: YES)

    [WorldGuard] Failed to load regions from SQL Database <jdbc:mysql://localhost/u5641_WG> : java.sql.SQLException: Access denied for user 'u5641_WG'@'127.0.0.1' (using password: YES)
    com.sk89q.worldguard.protection.databases.ProtectionDatabaseException: java.sql.SQLException: Access denied for user 'u5641_WG'@'127.0.0.1' (using password: YES)

    [WorldGuard] Access denied for user 'u5641_WG'@'127.0.0.1' (using password: YES)
    java.sql.SQLException: Access denied for user 'u5641_WG'@'127.0.0.1' (using password: YES)

    [WorldGuard] Failed to load regions from SQL Database <jdbc:mysql://localhost/u5641_WG> : java.sql.SQLException: Access denied for user 'u5641_WG'@'127.0.0.1' (using password: YES)
    com.sk89q.worldguard.protection.databases.ProtectionDatabaseException: java.sql.SQLException: Access denied for user 'u5641_WG'@'127.0.0.1' (using password: YES)

    [WorldGuard] Access denied for user 'u5641_WG'@'127.0.0.1' (using password: YES)
    java.sql.SQLException: Access denied for user 'u5641_WG'@'127.0.0.1' (using password: YES)

    [WorldGuard] Failed to load regions from SQL Database <jdbc:mysql://localhost/u5641_WG> : java.sql.SQLException: Access denied for user 'u5641_WG'@'127.0.0.1' (using password: YES)
    com.sk89q.worldguard.protection.databases.ProtectionDatabaseException: java.sql.SQLException: Access denied for user 'u5641_WG'@'127.0.0.1' (using password: YES)
     
  9. Aleks_Ku

    Aleks_Ku Активный участник Пользователь

    Баллы:
    78
    Skype:
    gm_aleks_ku
    Имя в Minecraft:
    Aleks_Ku
    в БД вообще существует данный пользователь?, и разрешение для данного пользователя пользоваться БД?
    Вообще данные ошибки говорят об отсутствии доступа к БД для данного пользователя.
     
    slavik123123123 нравится это.
  10. Gfdtk

    Gfdtk Активный участник

    Баллы:
    88
    Skype:
    igbuby
    Все решилось, пересозданием таблиц в БД, код был просто неверен, или WorldGuard версии 5.5.2. Вот для этой версии правильная БД:

    SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
    SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
    SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
    -- -----------------------------------------------------
    -- Table `group`
    -- -----------------------------------------------------
    CREATE TABLE IF NOT EXISTS `group` (
    `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
    `name` VARCHAR(64) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
    PRIMARY KEY (`id`) ,
    UNIQUE INDEX `name` (`name` ASC) )
    ENGINE = InnoDB
    AUTO_INCREMENT = 5
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_bin;
    -- -----------------------------------------------------
    -- Table `world`
    -- -----------------------------------------------------
    CREATE TABLE IF NOT EXISTS `world` (
    `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
    `name` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
    PRIMARY KEY (`id`) ,
    UNIQUE INDEX `name` (`name` ASC) )
    ENGINE = InnoDB
    AUTO_INCREMENT = 9
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_bin;
    -- -----------------------------------------------------
    -- Table `region`
    -- -----------------------------------------------------
    CREATE TABLE IF NOT EXISTS `region` (
    `id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
    `world_id` INT(10) UNSIGNED NOT NULL ,
    `type` ENUM('cuboid','poly2d','global') CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
    `priority` SMALLINT(6) NOT NULL DEFAULT '0' ,
    `parent` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NULL DEFAULT NULL ,
    PRIMARY KEY (`id`, `world_id`) ,
    INDEX `fk_region_world` (`world_id` ASC) ,
    INDEX `parent` (`parent` ASC) ,
    CONSTRAINT `fk_region_world1`
    FOREIGN KEY (`world_id` )
    REFERENCES `world` (`id` )
    ON DELETE CASCADE
    ON UPDATE CASCADE,
    CONSTRAINT `parent`
    FOREIGN KEY (`parent` )
    REFERENCES `region` (`id` )
    ON DELETE SET NULL
    ON UPDATE CASCADE)
    ENGINE = InnoDB
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_bin;
    -- -----------------------------------------------------
    -- Table `region_cuboid`
    -- -----------------------------------------------------
    CREATE TABLE IF NOT EXISTS `region_cuboid` (
    `region_id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
    `world_id` INT(10) UNSIGNED NOT NULL ,
    `min_x` BIGINT(20) NOT NULL ,
    `min_y` BIGINT(20) NOT NULL ,
    `min_z` BIGINT(20) NOT NULL ,
    `max_x` BIGINT(20) NOT NULL ,
    `max_y` BIGINT(20) NOT NULL ,
    `max_z` BIGINT(20) NOT NULL ,
    PRIMARY KEY (`region_id`, `world_id`) ,
    INDEX `fk_region_cuboid_region` (`region_id` ASC) ,
    CONSTRAINT `fk_region_cuboid_region`
    FOREIGN KEY (`region_id` , `world_id` )
    REFERENCES `region` (`id` , `world_id` )
    ON DELETE CASCADE
    ON UPDATE CASCADE)
    ENGINE = InnoDB
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_bin;
    -- -----------------------------------------------------
    -- Table `region_flag`
    -- -----------------------------------------------------
    CREATE TABLE IF NOT EXISTS `region_flag` (
    `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
    `region_id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
    `world_id` INT(10) UNSIGNED NOT NULL ,
    `flag` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
    `value` VARCHAR(256) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
    PRIMARY KEY (`id`) ,
    INDEX `fk_flags_region` (`region_id` ASC, `world_id` ASC) ,
    CONSTRAINT `fk_flags_region`
    FOREIGN KEY (`region_id` , `world_id` )
    REFERENCES `region` (`id` , `world_id` )
    ON DELETE CASCADE
    ON UPDATE CASCADE)
    ENGINE = InnoDB
    AUTO_INCREMENT = 3246
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_bin;
    -- -----------------------------------------------------
    -- Table `region_groups`
    -- -----------------------------------------------------
    CREATE TABLE IF NOT EXISTS `region_groups` (
    `region_id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
    `world_id` INT(10) UNSIGNED NOT NULL ,
    `group_id` INT(10) UNSIGNED NOT NULL ,
    `owner` TINYINT(1) NOT NULL ,
    PRIMARY KEY (`region_id`, `world_id`, `group_id`) ,
    INDEX `fk_region_groups_region` (`region_id` ASC) ,
    INDEX `fk_region_groups_group` (`group_id` ASC) ,
    CONSTRAINT `fk_region_groups_group`
    FOREIGN KEY (`group_id` )
    REFERENCES `group` (`id` )
    ON DELETE CASCADE
    ON UPDATE CASCADE,
    CONSTRAINT `fk_region_groups_region`
    FOREIGN KEY (`region_id` , `world_id` )
    REFERENCES `region` (`id` , `world_id` )
    ON DELETE CASCADE
    ON UPDATE CASCADE)
    ENGINE = InnoDB
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_bin;
    -- -----------------------------------------------------
    -- Table `user`
    -- -----------------------------------------------------
    CREATE TABLE IF NOT EXISTS `user` (
    `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
    `name` VARCHAR(64) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
    PRIMARY KEY (`id`) ,
    UNIQUE INDEX `name` (`name` ASC) )
    ENGINE = InnoDB
    AUTO_INCREMENT = 82
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_bin;
    -- -----------------------------------------------------
    -- Table `region_players`
    -- -----------------------------------------------------
    CREATE TABLE IF NOT EXISTS `region_players` (
    `region_id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
    `world_id` INT(10) UNSIGNED NOT NULL ,
    `user_id` INT(10) UNSIGNED NOT NULL ,
    `owner` TINYINT(1) NOT NULL ,
    PRIMARY KEY (`region_id`, `world_id`, `user_id`) ,
    INDEX `fk_region_players_region` (`region_id` ASC) ,
    INDEX `fk_region_users_user` (`user_id` ASC) ,
    CONSTRAINT `fk_region_users_region`
    FOREIGN KEY (`region_id` , `world_id` )
    REFERENCES `region` (`id` , `world_id` )
    ON DELETE CASCADE
    ON UPDATE CASCADE,
    CONSTRAINT `fk_region_users_user`
    FOREIGN KEY (`user_id` )
    REFERENCES `user` (`id` )
    ON DELETE CASCADE
    ON UPDATE CASCADE)
    ENGINE = InnoDB
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_bin;
    -- -----------------------------------------------------
    -- Table `region_poly2d`
    -- -----------------------------------------------------
    CREATE TABLE IF NOT EXISTS `region_poly2d` (
    `region_id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
    `world_id` INT(10) UNSIGNED NOT NULL ,
    `min_y` INT(11) NOT NULL ,
    `max_y` INT(11) NOT NULL ,
    PRIMARY KEY (`region_id`, `world_id`) ,
    INDEX `fk_region_poly2d_region` (`region_id` ASC) ,
    CONSTRAINT `fk_region_poly2d_region`
    FOREIGN KEY (`region_id` , `world_id` )
    REFERENCES `region` (`id` , `world_id` )
    ON DELETE CASCADE
    ON UPDATE CASCADE)
    ENGINE = InnoDB
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_bin;
    -- -----------------------------------------------------
    -- Table `region_poly2d_point`
    -- -----------------------------------------------------
    CREATE TABLE IF NOT EXISTS `region_poly2d_point` (
    `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT ,
    `region_id` VARCHAR(128) CHARACTER SET 'utf8' COLLATE 'utf8_bin' NOT NULL ,
    `world_id` INT(10) UNSIGNED NOT NULL ,
    `x` BIGINT(20) NOT NULL ,
    `z` BIGINT(20) NOT NULL ,
    PRIMARY KEY (`id`) ,
    INDEX `fk_region_poly2d_point_region_poly2d` (`region_id` ASC, `world_id` ASC) ,
    CONSTRAINT `fk_region_poly2d_point_region_poly2d`
    FOREIGN KEY (`region_id` , `world_id` )
    REFERENCES `region_poly2d` (`region_id` , `world_id` )
    ON DELETE CASCADE
    ON UPDATE CASCADE)
    ENGINE = InnoDB
    AUTO_INCREMENT = 15
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_bin;
    SET SQL_MODE=@OLD_SQL_MODE;
    SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
    SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

    Надеюсь, кому то поможет)
     
  11. Gfdtk

    Gfdtk Активный участник

    Баллы:
    88
    Skype:
    igbuby
    Хм. решилось только на локальном сервере. а вот на основном нет...
     

Поделиться этой страницей