• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Otserv Online Mysql Error

Indahouse

Member
Joined
May 13, 2015
Messages
79
Reaction score
10
Hello everyone,

Im trying to put online a server , for play with my 2 brothers,
I configure a No Ip , the config, and the config.php with my Ip and/or the hostname from No Ip
When i try lunch console the error appears ' Mysql Error Message: Can't connect to Mysql Server on ' lunera.servegame.com ' ( i try the Ip )
And when i try localhost i got the error ,

Error ID:
More info: CANNOT CONNECT TO DATABASE: SQLSTATE[HY000] [2002] No connection could be established because the target computer expressly refused it.

File: C:\UniformServerZ\UniServerZ\www\classes/database_mysql.php Line: 22
File: C:\UniformServerZ\UniServerZ\www\classes/database.php Line: 199
File: C:\UniformServerZ\UniServerZ\www\pages/latestnews.php Line: 18
File: C:\UniformServerZ\UniServerZ\www\system/load.page.php Line: 7
File: C:\UniformServerZ\UniServerZ\www/index.php Line: 42

Changing all to Localhost, the server works great, without problems, just i remember from 8.0 version changing only the 'localhost ' for the Hostname or my Ip ( obviously ports are oppened )

The config lua;

Lua:
-- Combat settings
-- NOTE: valid values for worldType are: "pvp", "no-pvp" and "pvp-enforced"
worldType = "pvp"
hotkeyAimbotEnabled = true
protectionLevel = 7
pzLocked = 60 * 10
removeChargesFromRunes = false
removeChargesFromPotions = false
removeWeaponAmmunition = false
removeWeaponCharges = false
timeToDecreaseFrags = 1 * 24 * 60 * 60
whiteSkullTime = 15 * 60 * 1000
stairJumpExhaustion = 2 * 1000
experienceByKillingPlayers = false
expFromPlayersLevelRange = 75
dayKillsToRedSkull = 3
weekKillsToRedSkull = 5
monthKillsToRedSkull = 10
redSkullDuration = 1
blackSkullDuration = 3
orangeSkullDuration = 7

onlyInvitedCanMoveHouseItems = true
cleanProtectionZones = false

-- Connection Config
-- NOTE: maxPlayers set to 0 means no limit
-- NOTE: MaxPacketsPerSeconds if you change you will be subject to bugs by WPE, keep the default value of 25
ip = "lunera.servegame.com"
bindOnlyGlobalAddress = false
loginProtocolPort = 7171
gameProtocolPort = 7172
statusProtocolPort = 7171
maxPlayers = 0
motd = "Welcome to Lunera!"
onePlayerOnlinePerAccount = true
allowClones = false
serverName = "Realmap"
statusTimeout = 5 * 1000
replaceKickOnLogin = true
maxPacketsPerSecond = 25
maxItem = 2000
maxContainer = 100

--- Version
clientVersion = 1260
clientVersionStr = "12.60"

-- Depot Limit
freeDepotLimit = 2000
premiumDepotLimit = 10000
depotBoxes = 18

-- GameStore
gamestoreByModules = true

-- NOTE: Access only for Premium Account
onlyPremiumAccount = false

-- Customs
weatherRain = false
thunderEffect = false
freeQuests = false

-- Deaths
-- NOTE: Leave deathLosePercent as -1 if you want to use the default
-- death penalty formula. For the old formula, set it to 10. For
-- no skill/experience loss, set it to 0.
deathLosePercent = -1

-- Houses
-- NOTE: set housePriceEachSQM to -1 to disable the ingame buy house functionality
-- Periods: daily/weekly/monthly/yearly/never
housePriceEachSQM = 1000
houseRentPeriod = "never"
houseOwnedByAccount = false

-- Item Usage
timeBetweenActions = 200
timeBetweenExActions = 1000

-- Push Delay
pushDelay = 1000
pushDistanceDelay = 1500

-- Map
-- NOTE: set mapName WITHOUT .otbm at the end
-- NOTE: unzip the map world.rar
mapName = "Otserv"
mapAuthor = "Otserv"

-- Market
marketOfferDuration = 30 * 24 * 60 * 60
premiumToCreateMarketOffer = true
checkExpiredMarketOffersEachMinutes = 60
maxMarketOffersAtATimePerPlayer = 100

-- MySQL
mysqlHost = "lunera.servegame.com"
mysqlUser = "root"
mysqlPass = "123456"
mysqlDatabase = "realmap"
mysqlPort = 3306
mysqlSock = ""
passwordType = "sha1"

-- Misc.
allowChangeOutfit = true
freePremium = false
kickIdlePlayerAfterMinutes = 15
maxMessageBuffer = 4
emoteSpells = false
classicEquipmentSlots = false
allowWalkthrough = true
coinPacketSize = 25
coinImagesURL = "http://127.0.0.1/images/store/"
classicAttackSpeed = false
showScriptsLogInConsole = false

-- Server Save
-- NOTE: serverSaveNotifyDuration in minutes
serverSaveNotifyMessage = true
serverSaveNotifyDuration = 5
serverSaveCleanMap = false
serverSaveClose = false
serverSaveShutdown = true

-- Rates
-- NOTE: rateExp, rateSkill and rateMagic is used as a fallback only
-- To configure rates see file data/stages.lua
rateExp = 50
rateSkill = 80
rateLoot = 4
rateMagic = 55
rateSpawn = 1

-- Monster rates
rateMonsterHealth = 1.0
rateMonsterAttack = 1.0
rateMonsterDefense = 1.0

-- Monsters
deSpawnRange = 2
deSpawnRadius = 50

-- Stamina
staminaSystem = false

-- Scripts
warnUnsafeScripts = true
convertUnsafeScripts = true

-- Startup
-- NOTE: defaultPriority only works on Windows and sets process
-- priority, valid values are: "normal", "above-normal", "high"
defaultPriority = "high"
startupDatabaseOptimization = true

-- Status server information
ownerName = ""
ownerEmail = ""
url = ""
location = "Spain"

The config.php

PHP:
<?PHP
if ( ! function_exists('is_https'))
{
    function is_https()
    {
        if ( ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off')
        {
            return TRUE;
        }
        elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https')
        {
            return TRUE;
        }
        elseif ( ! empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off')
        {
            return TRUE;
        }

        return FALSE;
    }
}

$is_https = is_https();

if ($is_https) {
    $base_url = "https://" . $_SERVER['HTTP_HOST'];
    $base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']);
} else {
    $base_url = "http://" . $_SERVER['HTTP_HOST'];
    $base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']);
}

$config['base_url'] = $base_url;
$config['site']['base_url'] = $base_url;

# Info Bar Config
$config['site']['info_bar_active'] = true;

# Using Ajax Field Validation, this is important if you want to use ajax check in your create account.
$config['site']['sqlHost'] = "lunera.servegame.com";
$config['site']['sqlUser'] = "root";
$config['site']['sqlPass'] = "123456";
$config['site']['sqlBD'] = "realmap";

# Config Shop
$outfits_list = array();
$loyalty_title = array(
    50 => 'Scout',
    100 => 'Sentinel',
    200 => 'Steward',
    400 => 'Warden',
    1000 => 'Squire',
    2000 => 'Warrior',
    3000 => 'Keeper',
    4000 => 'Guardian',
    5000 => 'Sage
');
$config['shop']['newitemdays'] = 1;

# Configure your active payment method with this
$config['paymentsMethods'] = [
    'pagseguro' => true,
    'paypal' => false,
    'transfer' => false
];

# Pagseguro configs
$config['pagseguro']['testing'] = true;
$config['pagseguro']['lightbox'] = true;
$config['pagseguro']['tokentest'] = "";

$config['pagseguro']['email'] = "";
$config['pagseguro']['token'] = "";
$config['pagseguro']['produtoNome'] = 'Tibia Coins';
$config['pagseguro']['urlRedirect'] =  $config['base_url'];
$config['pagseguro']['urlNotification'] = $config['base_url'].'retpagseguro.php';
$config['donate']['offers'] = [
    500=>50,
    800=>125,
    1500=>250,
    2800=>500,
    4900=>1000
];

# Bank transfer data
$config['banktransfer']['bank'] = "Caixa Econômica";
$config['banktransfer']['agency'] = "";
$config['banktransfer']['account'] = "";
$config['banktransfer']['name'] = "";
$config['banktransfer']['operation'] = 003;

# PayPal configs
$config['paypal']['email'] = "";

# Social Networks
$config['social']['facebook'] = "https://www.facebook.com/tibia";
$config['social']['discord'] = "";

# Character Former name, time in days to show the former names
$config['site']['formerNames'] = 10;
$config['site']['formerNames_amount'] = 10;

# PAGE: characters.php
$config['site']['quests'] = array(
    "Demon Helmet" => 2213,
    "In Service of Yalahar" => 12279,
    "Pits Of Inferno" => 10544,
    "The Ancient Tombs" => 50220,
    "The Annihilator" => 2215,
    "The Demon Oak" => 1010,
    "Wrath Of The Emperor" => 12374
);

# PAGE: whoisonline.php
$config['site']['private-servlist.com_server_id'] = 0;

# Account Maker Config
$config['site']['serverPath'] = "C:/Users/inda/Desktop/Otserv/";
$config['site']['encryptionType'] = 'sha1';
$config['site']['useServerConfigCache'] = false;
$towns_list = array(
    1 => 'Venore',
    2 => 'Thais',
    3 => 'Kazordoon',
    4 => 'Carlin',
    5 => 'Ab\'Dendriel',
    6 => 'Rookgaard',
    7 => 'Liberty Bay',
    8 => 'Port Hope',
    9 => 'Ankrahmun',
    10 => 'Darashia',
    11 => 'Edron',
    12 => 'Svargrond',
    13 => 'Yalahar',
    14 => 'Farmine',
    28 => 'Gray Beach',
    29 => 'Roshamuul',
    33 => 'Rathleton',
    34 => 'Krailos',
    51 => 'Dawnport',
    52 => 'Feyrist'
);

# Create Account Options
$config['site']['one_email'] = true;
$config['site']['create_account_verify_mail'] = false;
$config['site']['verify_code'] = true;
$config['site']['email_days_to_change'] = 3;
$config['site']['newaccount_premdays'] = 360;
$config['site']['send_register_email'] = true;
$config['site']['flash_client_enabled'] = false;

# Create Character Options
$config['site']['newchar_vocations'] = array(0 => 'Rook Sample');
$config['site']['newchar_towns'] = array(1);
$config['site']['max_players_per_account'] = 7;

# Emails Config
$config['site']['send_emails'] = true;
$config['site']['mail_address'] = "";
$config['site']['mail_senderName'] = "";
$config['site']['smtp_enabled'] = true;
$config['site']['smtp_host'] = "ssl://smtp.gmail.com";
$config['site']['smtp_port'] = 465;
$config['site']['smtp_auth'] = true;
$config['site']['smtp_user'] = "";
$config['site']['smtp_pass'] = "";
$config['site']['smtp_secure'] = true;

# PAGE: accountmanagement.php
$config['site']['send_mail_when_change_password'] = true;
$config['site']['send_mail_when_generate_reckey'] = true;
$config['site']['email_time_change'] = 7;
$config['site']['daystodelete'] = 7;

# PAGE: guilds.php
$config['site']['guild_need_level'] = 150;
$config['site']['guild_need_pacc'] = false;
$config['site']['guild_image_size_kb'] = 50;
$config['site']['guild_description_chars_limit'] = 2000;
$config['site']['guild_description_lines_limit'] = 6;
$config['site']['guild_motd_chars_limit'] = 250;

# PAGE: adminpanel.php
$config['site']['access_admin_panel'] = 6;

# PAGE: latestnews.php
$config['site']['news_limit'] = 6;

# PAGE: killstatistics.php
$config['site']['last_deaths_limit'] = 40;

# PAGE: team.php
$config['site']['groups_support'] = array(2, 3, 4, 5);

# PAGE: highscores.php
$config['site']['groups_hidden'] = array(3, 4, 5);
$config['site']['accounts_hidden'] = array(1);

# PAGE: lostaccount.php
$config['site']['email_lai_sec_interval'] = 180;

# Layout Config
$config['site']['layout'] = 'tibiacom';
$config['site']['vdarkborder'] = '#505050';
$config['site']['darkborder'] = '#D4C0A1';
$config['site']['lightborder'] = '#F1E0C6';

Maybe im wrong, i dont remember exactly, i check a numerous posts on forum about the error but nothing working
Thanks for your help and time
 

Merrok

Magic Tomato
Joined
Jun 18, 2009
Messages
176
Solutions
7
Reaction score
200
So where is the problem now exactly? You said yourself it works using localhost.
I assume you are running the database on the same machine the server is running on. So it SHOULD be localhost (or a private subnet ip like 192.168.x.x).
So just set it to localhost or 127.0.0.1
There is no reason to connect to the database using the domain or a public ip.
Also: MySQL user root is not accessible from any other source than localhost. It is also not accessible if the user trying to access it, is not root on the machine itself. On that note: don't use user root for... anything... anywhere... (as a general rule, of course when you're more experienced, that changes a bit)
Make sure the database is running as well...
Oh and don't open port 3306 for the public.
And as always with those kind of questions:
This might help you in the future.
 
Last edited:
OP
I

Indahouse

Member
Joined
May 13, 2015
Messages
79
Reaction score
10
Hello,

Yes , just the problem my brothers dont lives with me, they live in Lyon, and me on Etampes ( near Paris ) So the only whay i think it's put server online and we can play together.
I want just put online the server but i dont remember exactly about the ip's
 

aqubjukr

Well-Known Member
Joined
Mar 13, 2013
Messages
193
Solutions
16
Reaction score
72
Location
Paraná, Brazil
Change in config.php:
Lua:
$config['site']['sqlHost'] = "lunera.servegame.com";


To:
Code:
$config['site']['sqlHost'] = "127.0.0.1";

Config.lua doesn't need modifications.
 

Merrok

Magic Tomato
Joined
Jun 18, 2009
Messages
176
Solutions
7
Reaction score
200
Hello,

Yes , just the problem my brothers dont lives with me, they live in Lyon, and me on Etampes ( near Paris ) So the only whay i think it's put server online and we can play together.
Using localhost or 127 they can't join me right , or using the 192.168.1.27 ( my number ) they can join me via the no ip host like a server?
Well, there is a reason for separate options of database-IP and game-IP.
They don't need to be the same. In fact, they should not be the same.
So just set the database IP to localhost and the game IP to your domain.
Same with the website. The webserver and of the webserver should be set to your domain, but the website creating accounts config and so on requires the database IP (localhost). Which should be in a file only readable by the webserver (the one you posted).

Edit: So yeah as our fellow user above stated. But this needs to be adjusted in the config.lua as well in the MySQL section.
To be fair, it was a reasonable question this time, considering the fact that you don't know how this stuff works and google won't help you here :D
 
Last edited:
OP
I

Indahouse

Member
Joined
May 13, 2015
Messages
79
Reaction score
10
Ah now i understand, obviously, the server is on my computer.. So The Mysql on config on my localhost and gesior also on localhost, the ip of the game, like whatismyip, and tadam, server is running.. My god, 4 years since a 8.0 we don't touch tibia, today with my 28 years old, im nostalgic to go back play on this game i like it so much.
Well now is running, im going to contact my ethernet company, because this morning ports stay opened 7171 / 7172 and now again are closed and they can't join me.
Thanks @Merrock for your reply, i was looking for the error on ethernet since 2 days ago and finally a similar post i found today here but no solution about this, and was a simple change. Thanks you so much.
 
OP
I

Indahouse

Member
Joined
May 13, 2015
Messages
79
Reaction score
10
Is all working fine, this night my brother call me to try play with me, the only problem got, i am the only one can play, so i try edit The client 12 with Notepad, i have changed the Rsa Key correctly and add to loginWebService=http:// lunera. servegame. com ( without spaces )
Added 26 NULL ( the line of securetibia.. is 53 , but says Login Failed. Tibia might currently be down, if i put /login.php at final i got ' Connection Refused )
Maybe on config lua i need remplace localhost for the Ipv4 192.168.xxx adress , or something ?
 
Top