Jump to content
metin2dev

Search the Community

Showing results for tags 'mariadb'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Community
    • Announcements
    • Feedback
  • Metin2
    • General
    • Questions and Answers
    • Guides & HowTo
    • Design
    • Private Servers
    • Services
    • Videos
  • Releases
    • General
    • Tools
    • Programming / Scripts
    • Quests
    • Binaries & Clients/Serverfiles
    • 3D Models
    • 2D Graphics
    • Operating Systems
  • Safe Zone
    • Offtopic
    • Games Talk
    • Music/Videos/Art

Categories

There are no results to display.

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


ICQ


Yahoo


Skype


Location

Found 3 results

  1. Hello, here's a tutorial on how to update your MySQL Connector C (i think it's not supported anymore thanks oracle @.@) into MariaDB Connector C extracted from my source. You must need MariaDB, if you use MySQL with this connector don't ask help because it's not ment to be compatible. With this edit you could use MariaDB Connector v3.x without any problem. 1) Makefile update Open your libsql, db and game makefile and on the CFLAGS/IFLAGS add this: -I<your Extern source>/include/mariadb (ie.: ../Extern/include/mariadb) Also, if you have a -I referencing mysql please delete it Then, add this to your libsql, db and game CFLAGS this -D__MARIADB__ Finally, change on your db and game LIBS this -lmysqlclient into -lmariadbclient -lssl -lcrypto NOTE: If you already link libssl and libcrypto you can skip them NOTE ON 64BIT ENVIRONMENT: 2) Source Update Edit this code from libsql/AsyncSQL.h: #include <mysql/mysql.h> #include <mysql/errmsg.h> #include <mysql/mysqld_error.h> into: #ifdef __MARIADB__ #include <mariadb/mysql.h> #include <mariadb/errmsg.h> #include <mariadb/mysqld_error.h> #else #include <mysql/mysql.h> #include <mysql/errmsg.h> #include <mysql/mysqld_error.h> #endif Edit this code on db/DBManager.h #include <mysql/mysql.h> into this: #ifdef __MARIADB__ #include <mariadb/mysql.h> #else #include <mysql/mysql.h> #endif Finally, edit this file on libsql/AsyncSQL.cpp fprintf(stdout, "AsyncSQL: connected to %s (reconnect %d)\n", m_stHost.c_str(), m_hDB.reconnect); into: #ifdef __MARIADB__ fprintf(stdout, "AsyncSQL: connected to %s\n", m_stHost.c_str()); #else fprintf(stdout, "AsyncSQL: connected to %s (reconnect %d)\n", m_stHost.c_str(), m_hDB.reconnect); #endif 3) Database Server Update Now we're gonna replace the name "window" because MariaDB introduce the window operator that conflict with the query name What we will basicly do is change any "window" in query into "windows" db/AuctionManager.cpp function LoadAuctionItem() Replace: FROM item WHERE window = 'AUCTION' To: FROM item WHERE windows = 'AUCTION' db/ClientManagerPlayer.cpp Replace: ///////////////////////////////////////////// // 2) 아이템이 DBCache 에 없음 : DB 에서 가져옴 ///////////////////////////////////////////// else { snprintf(szQuery, sizeof(szQuery), "SELECT id,window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6 " "FROM item%s WHERE owner_id=%d AND (window < %d or window = %d)", GetTablePostfix(), pTab->id, SAFEBOX, DRAGON_SOUL_INVENTORY); CDBManager::instance().ReturnQuery(szQuery, QID_ITEM, peer->GetHandle(), new ClientHandleInfo(dwHandle, pTab->id)); into: ///////////////////////////////////////////// // 2) 아이템이 DBCache 에 없음 : DB 에서 가져옴 ///////////////////////////////////////////// else { snprintf(szQuery, sizeof(szQuery), "SELECT id,windows+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6 " "FROM item%s WHERE owner_id=%d AND (windows < %d or windows = %d)", GetTablePostfix(), pTab->id, SAFEBOX, DRAGON_SOUL_INVENTORY); CDBManager::instance().ReturnQuery(szQuery, QID_ITEM, peer->GetHandle(), new ClientHandleInfo(dwHandle, pTab->id)); Also replace: ClientHandleInfo * pkInfo = new ClientHandleInfo(dwHandle, packet->player_id); pkInfo->account_id = packet->account_id; CDBManager::instance().ReturnQuery(queryStr, QID_PLAYER, peer->GetHandle(), pkInfo); //-------------------------------------------------------------- // 아이템 가져오기 //-------------------------------------------------------------- snprintf(queryStr, sizeof(queryStr), "SELECT id,window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6 " "FROM item%s WHERE owner_id=%d AND (window < %d or window = %d)", GetTablePostfix(), packet->player_id, SAFEBOX, DRAGON_SOUL_INVENTORY); CDBManager::instance().ReturnQuery(queryStr, QID_ITEM, peer->GetHandle(), new ClientHandleInfo(dwHandle, packet->player_id)); Into: ClientHandleInfo * pkInfo = new ClientHandleInfo(dwHandle, packet->player_id); pkInfo->account_id = packet->account_id; CDBManager::instance().ReturnQuery(queryStr, QID_PLAYER, peer->GetHandle(), pkInfo); //-------------------------------------------------------------- // 아이템 가져오기 //-------------------------------------------------------------- snprintf(queryStr, sizeof(queryStr), "SELECT id,windows+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6 " "FROM item%s WHERE owner_id=%d AND (windows < %d or windows = %d)", GetTablePostfix(), packet->player_id, SAFEBOX, DRAGON_SOUL_INVENTORY); CDBManager::instance().ReturnQuery(queryStr, QID_ITEM, peer->GetHandle(), new ClientHandleInfo(dwHandle, packet->player_id)); Finally replace: snprintf(queryStr, sizeof(queryStr), "DELETE FROM player%s WHERE id=%d", GetTablePostfix(), pi->player_id); delete CDBManager::instance().DirectQuery(queryStr); snprintf(queryStr, sizeof(queryStr), "DELETE FROM item%s WHERE owner_id=%d AND (window < %d or window = %d)", GetTablePostfix(), pi->player_id, SAFEBOX, DRAGON_SOUL_INVENTORY); delete CDBManager::instance().DirectQuery(queryStr); Into: snprintf(queryStr, sizeof(queryStr), "DELETE FROM player%s WHERE id=%d", GetTablePostfix(), pi->player_id); delete CDBManager::instance().DirectQuery(queryStr); snprintf(queryStr, sizeof(queryStr), "DELETE FROM item%s WHERE owner_id=%d AND (windows < %d or windows = %d)", GetTablePostfix(), pi->player_id, SAFEBOX, DRAGON_SOUL_INVENTORY); delete CDBManager::instance().DirectQuery(queryStr); 4) Query update Design your player.item table, and change "window" to "windows". We have update into the new connector (mariadb connector c 3.x safetly), if you would like to downgrade change -lmariadbclient into -lmysqlclient, remove -D__MARIADB__ and change the -I referencing mariadb into mysql. Thanks for reading UPDATE: I've found other place to edit "window" into "windows" Open ClientManager.cpp From: else sys_log(0, "SAFEBOX id[%d] size[%d]", pSafebox->dwID, pSafebox->bSize); } if (0 == pSafebox->dwID) pSafebox->dwID = pi->account_id; pi->pSafebox = pSafebox; m2char szQuery[512]; snprintf(szQuery, sizeof(szQuery), "SELECT id, window+0, pos, count, vnum, socket0, socket1, socket2, " "attrtype0, attrvalue0, " "attrtype1, attrvalue1, " "attrtype2, attrvalue2, " "attrtype3, attrvalue3, " "attrtype4, attrvalue4, " "attrtype5, attrvalue5, " "attrtype6, attrvalue6 " "FROM item%s WHERE owner_id=%d AND window='%s'", GetTablePostfix(), pi->account_id, pi->ip[0] == 0 ? "SAFEBOX" : "MALL"); To: else sys_log(0, "SAFEBOX id[%d] size[%d]", pSafebox->dwID, pSafebox->bSize); } if (0 == pSafebox->dwID) pSafebox->dwID = pi->account_id; pi->pSafebox = pSafebox; m2char szQuery[512]; snprintf(szQuery, sizeof(szQuery), "SELECT id, windows+0, pos, count, vnum, socket0, socket1, socket2, " "attrtype0, attrvalue0, " "attrtype1, attrvalue1, " "attrtype2, attrvalue2, " "attrtype3, attrvalue3, " "attrtype4, attrvalue4, " "attrtype5, attrvalue5, " "attrtype6, attrvalue6 " "FROM item%s WHERE owner_id=%d AND windows='%s'", GetTablePostfix(), pi->account_id, pi->ip[0] == 0 ? "SAFEBOX" : "MALL"); From: else pItemAward->dwSocket0 = item_table->aLimits[i].lValue; break; } } } snprintf(szQuery, sizeof(szQuery), "INSERT INTO item%s (id, owner_id, window, pos, vnum, count, socket0, socket1, socket2) " "VALUES(%u, %u, '%s', %d, %u, %u, %u, %u, %u)", GetTablePostfix(), GainItemID(), pi->account_id, pi->ip[0] == 0 ? "SAFEBOX" : "MALL", iPos, pItemAward->dwVnum, pItemAward->dwCount, pItemAward->dwSocket0, pItemAward->dwSocket1, dwSocket2); } To: else pItemAward->dwSocket0 = item_table->aLimits[i].lValue; break; } } } snprintf(szQuery, sizeof(szQuery), "INSERT INTO item%s (id, owner_id, windows, pos, vnum, count, socket0, socket1, socket2) " "VALUES(%u, %u, '%s', %d, %u, %u, %u, %u, %u)", GetTablePostfix(), GainItemID(), pi->account_id, pi->ip[0] == 0 ? "SAFEBOX" : "MALL", iPos, pItemAward->dwVnum, pItemAward->dwCount, pItemAward->dwSocket0, pItemAward->dwSocket1, dwSocket2); } From: m_map_itemCache.erase(p->id); delete c; } m2char szQuery[512]; snprintf(szQuery, sizeof(szQuery), "REPLACE INTO item%s (id, owner_id, window, pos, count, vnum, socket0, socket1, socket2, " "attrtype0, attrvalue0, " "attrtype1, attrvalue1, " "attrtype2, attrvalue2, " "attrtype3, attrvalue3, " "attrtype4, attrvalue4, " "attrtype5, attrvalue5, " "attrtype6, attrvalue6 " ") " "VALUES(%u, %u, %d, %d, %u, %u, %ld, %ld, %ld, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d" ")", GetTablePostfix(), p->id, p->owner, p->window, To: m_map_itemCache.erase(p->id); delete c; } m2char szQuery[512]; snprintf(szQuery, sizeof(szQuery), "REPLACE INTO item%s (id, owner_id, windows, pos, count, vnum, socket0, socket1, socket2, " "attrtype0, attrvalue0, " "attrtype1, attrvalue1, " "attrtype2, attrvalue2, " "attrtype3, attrvalue3, " "attrtype4, attrvalue4, " "attrtype5, attrvalue5, " "attrtype6, attrvalue6 " ") " "VALUES(%u, %u, %d, %d, %u, %u, %ld, %ld, %ld, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d" ")", GetTablePostfix(), p->id, p->owner, p->window, UPDATE2: Open db/Cache.cpp and find: if (memcmp(aAttr, p->aAttr, sizeof(TPlayerItemAttribute) * ITEM_ATTRIBUTE_MAX_NUM)) isAttr = true; char szColumns[QUERY_MAX_LEN]; char szValues[QUERY_MAX_LEN]; char szUpdate[QUERY_MAX_LEN]; int iLen = snprintf(szColumns, sizeof(szColumns), "id, owner_id, window, pos, count, vnum"); int iValueLen = snprintf(szValues, sizeof(szValues), "%u, %u, %d, %d, %u, %u", p->id, p->owner, p->window, p->pos, p->count, p->vnum); int iUpdateLen = snprintf(szUpdate, sizeof(szUpdate), "owner_id=%u, window=%d, pos=%d, count=%u, vnum=%u", p->owner, p->window, p->pos, p->count, p->vnum); Replace into: if (memcmp(aAttr, p->aAttr, sizeof(TPlayerItemAttribute) * ITEM_ATTRIBUTE_MAX_NUM)) isAttr = true; char szColumns[QUERY_MAX_LEN]; char szValues[QUERY_MAX_LEN]; char szUpdate[QUERY_MAX_LEN]; int iLen = snprintf(szColumns, sizeof(szColumns), "id, owner_id, windows, pos, count, vnum"); int iValueLen = snprintf(szValues, sizeof(szValues), "%u, %u, %d, %d, %u, %u", p->id, p->owner, p->window, p->pos, p->count, p->vnum); int iUpdateLen = snprintf(szUpdate, sizeof(szUpdate), "owner_id=%u, windows=%d, pos=%d, count=%u, vnum=%u", p->owner, p->window, p->pos, p->count, p->vnum);
  2. Denny2399

    open Mariadb install problem

    Hello guys, I have recently installed mariadb and mysql5.6 on my Freebsd and it merged(don't ask why I did this), then I couldn't start mysql again. I deleted every pkg about mysql, but when I try to install mariadb100-server again then I got error. Anyone who could help?
  3. In this topic I would like to teach you how to install MariaDB instead Oracle MySQL and why. Why prefer MariaDB instead MySQL? MariaDB it's a fork of MySQL and it is compatible with MySQL. Forecasts indicate that the MariaDB fork replace Oracle MySQL Server as rdbms. MariaDB have more features for performance and data integrity. One of this features is Aria storage engine. Aria is the upgrade of old MyISAM storage engine used on our Metin2 Private server. This old storage engine have some bugs and it isn't ACID like InnoDB. An upgrade of InnoDB is the fork XtraDB, used on MariaDB and Percona. So if you don't want/can't convert your metin2 tables from MyISAM to InnoDB or XtraDB (the best choice) you can use the similar storage engine: Aria. How to install MariaDB on FreeBSD. Administrate MariaDB it's like MySQL. The service is mysql-server and the path of MariaDB home directory is /var/db/mysql, like classical Oracle MySQL server. Remove old MySQL server installation. If you have mysql-server installed you need to deinstall it: Make a security's backup of your mysql data directory: cd /var/db && tar -cvJf mysql.tar.xz mysql Make a real backup of your applicative db (metin2, website etc.) with dump. You can use the CLI utility mysqldump or GUI with Navicat (right click on db name->Dump SQL file->Structure and data). Stop Mysql-server with: service mysql-server stop Remove mysql directory: rm -rf /var/db/mysql Find the mysql version: mysql --version Deinstall mysql from ports: cd /usr/ports/databases/mysqlxx-server && make deinstall clean && cd /usr/ports/databases/mysqlxx-client && make deinstall clean Where xx is the version find on previous step. Install MariaDB This thread was written when the lastest version of MariaDB was 10.1 update your ports tree: portsnap fetch update Install MariaDB: cd /usr/ports/databases/mariadb101-server && make install clean if not present, enable mysql service: echo "mysql_enable=YES" >> /etc/rc.conf start mysql server: service mysql-server start Import your application databases (metin2, website etc.) from dump. Do not import from datafile! If you use navicat, remember to create a new connection for MariaDB instead MySQL Convert MyISAM to new storage engine For better performance and security of your data you need to convert all of your table with a new storage engine. You can choose a different storage engine for each table. I suggest you to choose between Aria (new MyISAM) or XtraDB (new InnoDB). Choose Aria to read fastest and low write (example item_proto, mob_proto, shop, shop_item) or FULLTEXT index feature (to search fastest on text culomn). Choose XtraDB to critical table with hight write frequency (example player, item, account). To convert from one storage engine to another you have two ways: Via GUI like Navicat (one table at time). Right click on the table -> Design Table->Options->Engine. Change and save. Via query: ALTER TABLE <table_name> ENGINE=<engine>; This solution don't exclude the necessity of db backups. Please scedule frequently backup of your applicative dbs from dump. See mysqldump utility. For much safety, do also a datafile backup of entire mysql data directory (/var/db/mysql). It's for emergency restore of all mysql if dump import don't work. Use datafile restore only for whole mysql directory and only if there aren't another solution with dump.
×