Jump to content
  • 0

Mysql56 to Mysql8


ZumbaCafew

Question

Hello, 

I hope that you and your loved ones are doing well in this complicated health crisis as well.

I wanted to know if it was possible to run my Metin2 server which is currently running Mysql56 part Mysql8? 

Thanks in advance

Link to post

Recommended Posts

  • 0
1 hour ago, ZumbaCafew said:

Hello, 

I hope that you and your loved ones are doing well in this complicated health crisis as well.

I wanted to know if it was possible to run my Metin2 server which is currently running Mysql56 part Mysql8? 

Thanks in advance

I have tried running in mysql8. No chance what so ever. 

I have tried for more than a month and with other's help and still nothing. 

You can try but it is a dead end.

Go with freebsd 12.1, gcc8, vs2019 and stay with mysql 5.6. There is no harm. Change your mysql ports from 3306 to something else and you're good to go.

Have a good night.

Link to post
  • 0
  • Administrator

MySQL 8.0 works:

  • You must compile your "db" and your "game" with the MySQL 8.0 includes.
  • Change the password encryption method or imitate the PASSWORD() function (it has been removed)
  • Some columns must be wrapped (in the cpp file) ("window", "rank" for example...)

 

  • Love 2

logo.pngmiaw-network.png
 

Link to post
  • 0
2 minutes ago, ASIKOO said:

MySQL 8.0 works:

  • You must compile your "db" and your "game" with the MySQL 8.0 includes.
  • Change the password encryption method or imitate the PASSWORD() function (it has been removed)
  • Some columns must be wrapped (in the cpp file) ("window", "rank" for example...)

 

My question is: Is it worth it?

Link to post
  • 0
  • Administrator

I think we can have a small improvement (related to MySQL 8), for Metin2 it must be little?

Personally, I upgraded my server to MySQL 8, to be up to date.

  • Love 1

logo.pngmiaw-network.png
 

Link to post
  • 0

Also since mysql 5.6 you cannot use 0000-00-00 00:00:00 as default date

If you want use InnoDB as default storage engine at all databases and tables you need to rewrite libsql connector to something that suport transactions and of course rest of code due data in innodb can have few states such as commited and uncommited.

Of course is worth.

Edited by IceShiva (see edit history)
Link to post
  • 0
1 hour ago, Shahin said:

I have tried running in mysql8. No chance what so ever. 

I have tried for more than a month and with other's help and still nothing. 

You can try but it is a dead end.

Go with freebsd 12.1, gcc8, vs2019 and stay with mysql 5.6. There is no harm. Change your mysql ports from 3306 to something else and you're good to go.

Have a good night.

drop me a private message I'll help you with the issues gladly. Mysql 8 is possible. It's not too much of a hassle to upgrade to it.

  • Love 2

We are the tortured.
We're not your friends.
As long as we're not visible.
We are unfixable.

Link to post
  • 0

I've been running my server very smoothly with MySQL8 for a long time already and as Asikoo said, it doesn't requiere this much. You just need to wrap `window` like I shown, because it became "protected" in MySQL8. He explained the rest of the guide accurately.

 

  • Love 1
Link to post
  • 0

Hello everyone,

 

Would it be possible to know what I need to modify in the db sources to use mysql80?

 

Just an example if you like so I understand and change everything else on my side

 

Also, where do I find the mysql8 includes and then put them or in my sources?

 

I was using mysql56 and when I launch the server I have this :

 

# mysql_real_connect: Client does not support authentication protocol requested by server; consider upgrading MySQL client

 

Thank you

Edited by ZumbaCafew (see edit history)
Link to post
  • 0
  • Administrator

File: ClientManager.cpp

Description: It's necessary to wrap the names of the columns which are protected since MySQL 8.0, the two names that I know: window, rank.

 

This must be done in all the files where these names are present. In my example, I preferred to wrap all the columns, I'm fine now!

 

Example:

snprintf(szQuery, sizeof(szQuery), "SELECT `id`, `window`+0, `pos`, `count`, `vnum`, `bind`, `socket0`, `socket1`, `socket2`, `attrtype0`, `attrvalue0`, `attrtype1`, `attrvalue1`, `attrtype2`, `attrvalue2`, `attrtype3`, `attrvalue3`, `attrtype4`, `attrvalue4`, `attrtype5`, `attrvalue5`, `attrtype6`, `attrvalue6`, `applytype0`, `applyvalue0`, `applytype1`, `applyvalue1`, `applytype2`, `applyvalue2`, `applytype3`, `applyvalue3`, `applytype4`, `applyvalue4`, `applytype5`, `applyvalue5`, `applytype6`, `applyvalue6`, `applytype7`, `applyvalue7` FROM item WHERE `owner_id` = %d AND `window` = '%s'", pi->account_id, pi->ip[0] == 0 ? "SAFEBOX" : "MALL");

 

-----------------------

 

To simply imitate the PASSWORD() function, it was deleted...

 

File: input_auth.cpp

Description: You have to replace part of the code by: UPPER(CONCAT('*', SHA1(UNHEX(SHA1('%s'))))).

 

Example:

DBManager::instance().ReturnQuery(QID_AUTH_LOGIN, dwKey, p,
	"SELECT UPPER(CONCAT('*', SHA1(UNHEX(SHA1('%s'))))), `password`, `securitycode`, `social_id`, `id`, `status`, availDt - NOW() > 0,"
	"UNIX_TIMESTAMP(silver_expire),"
	"UNIX_TIMESTAMP(gold_expire),"
	"UNIX_TIMESTAMP(safebox_expire),"
	"UNIX_TIMESTAMP(autoloot_expire),"
	"UNIX_TIMESTAMP(fish_mind_expire),"
	"UNIX_TIMESTAMP(marriage_fast_expire),"
	"UNIX_TIMESTAMP(money_drop_rate_expire),"
	"UNIX_TIMESTAMP(create_time)"
	" FROM `account` WHERE `login` = '%s'",
szPasswd, szLogin);

 

  • Love 1

logo.pngmiaw-network.png
 

Link to post
  • 0

Hello, after changing the includes path to "../../mysql_8_0_20", I get an error when compiling the db  and game source:

 

 

linking ../db_r40414_64....
ld: error: unable to find library -lmysqlclient
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)
gmake: *** [Makefile:56: ../db_r40414_64] Error 1

 

linking ../game_r44214_64....
ld: error: unable to find library -lmysqlclient
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)
gmake: *** [Makefile:127: ../game_r44214_64] Error 1
 

 

Does anyone know how to do this?

 

thank you
 

Edited by ZumbaCafew (see edit history)
Link to post
  • 0

Hello, would it be possible to have some help please? Thank you

 

Makefile db:

CC = clang++90

INCDIR =
LIBDIR =
BINDIR = ..
OBJDIR = .obj

PLATFORM = $(shell file /bin/ls | cut -d' ' -f3 | cut -d'-' -f1)
GCC_VERSION = $(shell $(CC) --version 2>&1 | grep "(GCC)" | cut -d' ' -f3 | cut -d'.' -f1)
BSD_VERSION = $(shell uname -v 2>&1 | cut -d' ' -f2 | cut -d'.' -f1)
VERSION = $(shell cat ../REVISION)
REVISION = $(shell echo $$(($(VERSION)+1)))

$(shell if [ ! -d $(OBJDIR) ]; then mkdir $(OBJDIR); fi)

CFLAGS = -m32 -w -g -Wall -O2 -pipe -fno-rtti -fno-exceptions -Wno-long-long -pthread -D_THREAD_SAFE

# MySQL
# INCDIR += -I/usr/local/include/mysql
# LIBDIR += -L/usr/local/lib/mysql

ifeq ($(BSD_VERSION), 7)
INCDIR += -I../../libmysql/7.x-5.1.35
LIBDIR += -L../../libmysql/7.x-5.1.35
else
INCDIR += -I../../libmysql/mysql_8_0_20
LIBDIR += -L../../libmysql/mysql_8_0_20
endif

# Project Libraries
INCDIR += -I../../../Extern/include
LIBDIR += -I../../../Extern/lib

INCDIR += -I/usr/local/include
LIBDIR += -I/usr/local/lib

LIBDIR += -L../../libthecore/lib -L../../libsql -L../../libpoly -L../../libgame/lib

LIBS = -lthecore -lmysqlclient -lsql -lpoly -lgame -lm -lz

TARGET = $(BINDIR)/db_r$(REVISION)_$(PLATFORM)

SRCS = Config.cpp NetBase.cpp Peer.cpp PeerBase.cpp Main.cpp Lock.cpp DBManager.cpp \
	Cache.cpp LoginData.cpp ClientManager.cpp ClientManagerPlayer.cpp ClientManagerLogin.cpp \
	ClientManagerBoot.cpp ClientManagerParty.cpp ClientManagerGuild.cpp GuildManager.cpp HB.cpp \
	PrivManager.cpp MoneyLog.cpp ItemAwardManager.cpp ClientManagerEventFlag.cpp Marriage.cpp \
	Monarch.cpp BlockCountry.cpp ItemIDRangeManager.cpp ClientManagerHorseName.cpp version.cpp \
	ProtoReader.cpp CsvReader.cpp

OBJS = $(SRCS:%.cpp=$(OBJDIR)/%.o)

default: $(TARGET)

$(TARGET): $(OBJS)
	@echo linking $(TARGET)....
	@$(CC) $(FLAGS) $(LIBDIR) $(OBJS) $(LIBS) -o $(TARGET)
	@expr $(REVISION) > ../REVISION

$(OBJDIR)/%.o: %.cpp
	@echo compiling $<
	@$(CC) $(CFLAGS) $(INCDIR) -c $< -o [email protected]

$(OBJDIR)/version.o: version.cpp
	@$(CC) $(CFLAGS) -D__VERSION__=\"$(REVISION)\" -c $< -o [email protected]
	@echo compiling $<

$(OBJDIR):
	@mkdir $(OBJDIR)

clean:
	@rm -f $(OBJS) $(BINDIR)/db_r*

dep:
	@touch Depend
	makedepend -f Depend $(INCDIR) -I/usr/include/c++/3.3 -I/usr/include/c++/4.2 -p$(OBJDIR)/ $(SRCS) 2> /dev/null

sinclude Depend

 

 

Makefile game:

MAKE = gmake
CC = clang++90

INCDIR =
LIBDIR =
BINDIR = ..
OBJDIR = .obj

PLATFORM = $(shell file /bin/ls | cut -d' ' -f3 | cut -d'-' -f1)
GCC_VERSION = $(shell $(CC) --version 2>&1 | grep "(GCC)" | cut -d' ' -f3 | cut -d'.' -f1)
BSD_VERSION = $(shell uname -v 2>&1 | cut -d' ' -f2 | cut -d'.' -f1)
VERSION = $(shell cat ../REVISION)
REVISION = $(shell echo $$(($(VERSION)+1)))

$(shell if [ ! -d $(OBJDIR) ]; then mkdir $(OBJDIR); fi)

# Standard Setting
LIBS = -pthread -lm -lmd
CFLAGS = -m32 -g -Wall -w -O2 -pipe -fexceptions -D_THREAD_SAFE -DNDEBUG

# Removed -fno-rtti
CFLAGS += -fstack-protector-all -fno-strict-aliasing

# DevIL
INCDIR += -I../../libdevil
LIBDIR += -L../../libdevil
LIBS += -lIL -lpng -ltiff -lmng -llcms -ljpeg

# MySQL
# INCDIR += -I/usr/local/include/mysql
# LIBDIR += -L/usr/local/lib/mysql

ifeq ($(BSD_VERSION), 7)
INCDIR += -I../../libmysql/7.x-5.1.35
LIBDIR += -L../../libmysql/7.x-5.1.35
else
INCDIR += -I../../libmysql/mysql_8_0_20
LIBDIR += -L../../libmysql/mysql_8_0_20
endif

LIBS += -lmysqlclient -lz

# Miscellaneous external libraries
INCDIR += -I../../../Extern/include
LIBDIR += -L../../../Extern/lib
LIBS += -lcryptopp
# LIBS += -lgtest

INCDIR += -I/usr/local/include
LIBDIR += -L/usr/local/lib

# OpenSSL
# INCDIR += -I/usr/include
# LIBS += -lssl
# LIBS += /usr/lib/libssl.a

# Project Library
INCDIR += -I../../liblua/include
INCDIR += -I../../libserverkey
LIBDIR += -L../../libthecore/lib -L../../libpoly -L../../libsql -L../../libgame/lib -L../../liblua/lib -L../../libserverkey

LIBS += -lthecore -lpoly -llua -llualib -lsql -lgame -lserverkey

TARGET = $(BINDIR)/game_r$(REVISION)_$(PLATFORM)

CFILE = minilzo.c

CPPFILE = BattleArena.cpp FSM.cpp MarkConvert.cpp MarkImage.cpp MarkManager.cpp OXEvent.cpp TrafficProfiler.cpp ani.cpp\
	arena.cpp banword.cpp battle.cpp blend_item.cpp block_country.cpp buffer_manager.cpp building.cpp castle.cpp\
	char.cpp char_affect.cpp char_battle.cpp char_change_empire.cpp char_horse.cpp char_item.cpp char_cards.cpp char_manager.cpp\
	char_quickslot.cpp char_resist.cpp char_skill.cpp char_state.cpp char_gem.cpp PetSystem.cpp cmd.cpp cmd_emotion.cpp cmd_general.cpp\
	cmd_gm.cpp cmd_oxevent.cpp config.cpp constants.cpp crc32.cpp cube.cpp db.cpp desc.cpp\
	desc_client.cpp desc_manager.cpp desc_p2p.cpp dev_log.cpp dungeon.cpp empire_text_convert.cpp entity.cpp\
	entity_view.cpp event.cpp event_queue.cpp exchange.cpp file_loader.cpp fishing.cpp gm.cpp guild.cpp\
	guild_manager.cpp guild_war.cpp horse_rider.cpp horsename_manager.cpp input.cpp input_auth.cpp input_db.cpp\
	input_login.cpp input_main.cpp input_p2p.cpp input_teen.cpp ip_ban.cpp\
	item.cpp item_addon.cpp item_attribute.cpp item_manager.cpp item_manager_idrange.cpp locale.cpp\
	locale_service.cpp log.cpp login_data.cpp lzo_manager.cpp marriage.cpp matrix_card.cpp\
	messenger_manager.cpp mining.cpp mob_manager.cpp monarch.cpp motion.cpp over9refine.cpp p2p.cpp packet_info.cpp\
	party.cpp passpod.cpp pcbang.cpp polymorph.cpp priv_manager.cpp pvp.cpp\
	questevent.cpp questlua.cpp questlua_affect.cpp questlua_arena.cpp questlua_ba.cpp questlua_building.cpp\
	questlua_danceevent.cpp questlua_dungeon.cpp questlua_forked.cpp questlua_game.cpp questlua_global.cpp\
	questlua_guild.cpp questlua_horse.cpp questlua_pet.cpp questlua_item.cpp questlua_marriage.cpp questlua_mgmt.cpp\
	questlua_monarch.cpp questlua_npc.cpp questlua_oxevent.cpp questlua_party.cpp questlua_pc.cpp\
	questlua_quest.cpp questlua_target.cpp questmanager.cpp questnpc.cpp questpc.cpp\
	refine.cpp regen.cpp safebox.cpp sectree.cpp sectree_manager.cpp sequence.cpp shop.cpp\
	skill.cpp start_position.cpp target.cpp trigger.cpp utils.cpp vector.cpp war_map.cpp\
	wedding.cpp xmas_event.cpp version.cpp panama.cpp threeway_war.cpp map_location.cpp auth_brazil.cpp\
	BlueDragon.cpp BlueDragon_Binder.cpp DragonLair.cpp questlua_dragonlair.cpp\
	skill_power.cpp affect.cpp SpeedServer.cpp questlua_speedserver.cpp\
	auction_manager.cpp FileMonitor_FreeBSD.cpp ClientPackageCryptInfo.cpp cipher.cpp\
	buff_on_attributes.cpp dragon_soul_table.cpp DragonSoul.cpp\
	group_text_parse_tree.cpp char_dragonsoul.cpp questlua_dragonsoul.cpp\
	shop_manager.cpp shopEx.cpp item_manager_read_tables.cpp offline_shop.cpp offlineshop_manager.cpp MeleyLair.cpp questlua_meleylair.cpp\
	TempleOchao.cpp questlua_templeochao.cpp\
	GrowthPetSystem.cpp questlua_growthpet.cpp\
	char_mailbox.cpp\
	minigame.cpp minigame_catch_king.cpp CsvReader.cpp\
	battle_pass.cpp switchbot.cpp questlua_pvp.cpp

COBJS = $(CFILE:%.c=$(OBJDIR)/%.o)
CPPOBJS = $(CPPFILE:%.cpp=$(OBJDIR)/%.o)

MAINOBJ = $(OBJDIR)/main.o
MAINCPP = main.cpp

default: $(TARGET)

$(OBJDIR)/minilzo.o: minilzo.c
	@$(CC) $(CFLAGS) $(INCDIR) -c $< -o [email protected]
	@echo compiling $<

$(OBJDIR)/version.o: version.cpp
	@$(CC) $(CFLAGS) -D__VERSION__="$(REVISION)" -c $< -o [email protected]
	@echo compiling $<

$(OBJDIR)/%.o: %.cpp
	@echo compiling $<
	@$(CC) $(CFLAGS) $(INCDIR) -c $< -o [email protected]

limit_time:
	@echo update limit time
	@python update_limit_time.py

$(TARGET): $(CPPOBJS) $(COBJS) $(MAINOBJ)
	@echo linking $(TARGET)....
	@$(CC) $(CFLAGS) $(LIBDIR) $(COBJS) $(CPPOBJS) $(MAINOBJ) $(LIBS) -o $(TARGET)
	@expr $(REVISION) > ../REVISION

clean:
	@rm -f $(COBJS) $(CPPOBJS)
	@rm -f $(BINDIR)/game_r* $(BINDIR)/conv

tag:
	ctags *.cpp *.h *.c

dep:
	makedepend -f Depend $(INCDIR) -I/usr/include/c++/3.3 -I/usr/include/c++/4.2 -p$(OBJDIR)/ $(CPPFILE) $(CFILE) $(MAINCPP) 2> /dev/null > Depend

sinclude Depend

 

Edited by ZumbaCafew (see edit history)
Link to post
  • 0
On 10/25/2020 at 1:57 AM, ZumbaCafew said:

linking ../db_r40414_64....
ld: error: unable to find library -lmysqlclient
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)
gmake: *** [Makefile:56: ../db_r40414_64] Error 1

 

Are you compiling on a i386 machine? or an amd64?
Amd64 machines will install you the lib built in 64bit which are incompatible with your game and db executables (which you are building in 32bit).

 

 

On 11/3/2020 at 10:54 PM, ZumbaCafew said:

ifeq ($(BSD_VERSION), 7) INCDIR += -I../../libmysql/7.x-5.1.35 LIBDIR += -L../../libmysql/7.x-5.1.35 else INCDIR += -I../../libmysql/mysql_8_0_20 LIBDIR += -L../../libmysql/mysql_8_0_20 endif

Here you changed the -I and -L paths you are adding to LIBDIR and INCDIR, but can u find the lib in the directory you moved to?

Edited by Ikarus_ (see edit history)

My youtube channel  on which you can see my works here

Link to post
  • 0
10 minutes ago, ZumbaCafew said:

I don't have the lib-lmysqlclient

 

You should put it in your extern/lib.

I don't think you will find it in your machine x64, you need the 32bit one.

What version of freebsd are u using? pkg.freebsd.org may help you to find it easly

My youtube channel  on which you can see my works here

Link to post
  • 0

I have this vdi: FreeBSD 11.3 x64.vdi

In the mysql 7.x-5.1.35 folder I have the lib "libmysqlclient.a / libmysqlclient_r.a" but I want to switch to mysql_8_0_20. Where can I find the lib for this version? Thanks

Link to post
  • 0

i ll send you my include and lib folders for mysql80, they are for freebsd 11.3 only (32 bit obv) give me a moment to make the zip

4 hours ago, ZumbaCafew said:

I solved the problem thanks to the lib in the mysql 7.x-5.1.35 folder, so I manage to compile, but how can I get the lib for mysql8?

 

You can't use a lib and an include which are from differents version of mysql... you will get runtime errors (segmentation fault)

Edited by Ikarus_ (see edit history)

My youtube channel  on which you can see my works here

Link to post
  • 0
8 minutes ago, ZumbaCafew said:

Thanks for sharing, where should I put this folder? Thank you 

 

I usually prefer to put the 3th part libraries on extern folder, but you can move it whenever you want.

The important thing is to change the -I and -L directives with your directories.

An example would be:
 

#Mysql Dynamic 
LIBDIR += -L../../../extern/lib/mysql
INCDIR += -I../../../extern/include/mysql
LIBS += -lmysqlclient

#Mysql Static
INCDIR += -I../../../extern/include/mysql
LIBS += ../../../extern/lib/mysql/libmysqlclient.a

 

the first three lines are for a dynamic linking (it might prefer to link using libmysqlclient.so rather than libmysqlclient.a where both are available)
 

the second two lines are for a static linking (where we are forcing it to use libmysqlclient.a)

You can choice the way you prefer.

 

Edited by Ikarus_ (see edit history)
  • Love 1

My youtube channel  on which you can see my works here

Link to post
  • 0

Hello,

now I'm encountering a problem while creating a character. I go back to the empire selection and as a mistake I have this: 

 

SYSERR: Nov  9 19:42:33 :: DirectQuery: AsyncSQL::DirectQuery : mysql_query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'iq`, `job`, `voice`, `dir`, `x`, `y`, `z`, `hp`, `mp`, `random_hp`, `random_sp`,' at line 1
query: INSERT INTO player (`id`, `account_id`, `name`, `level`, `st`, `ht`, `dx, `iq`, `job`, `voice`, `dir`, `x`, `y`, `z`, `hp`, `mp`, `random_hp`, `random_sp`, `stat_point`, `stamina`, `part_base`, `part_main`, `part_hair`, `part_acce`, `gold`, `cheque`, `gem`, `pin`, `playtime`, `skill_level`, `quickslot`) VALUES (0, 1, 'Pumba', 1, 6, 4, 3, 3, 0, 0, 0, 963541, 278088, 0, 760, 260, 0, 0, 0, 800, 1, 1, 0, 0, 0, 0, 0, '1234', 0, '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
SYSERR: Nov  9 19:42:33 :: DirectQuery: AsyncSQL::DirectQuery : mysql_query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1=0 WHERE `id`=1' at line 1
query: UPDATE player_index SET `pid`1=0 WHERE `id`=1

 

Thank you

Edited by ZumbaCafew (see edit history)
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing

    No registered users viewing this page.

  • Activity

    1. 8

      Weird Cryptopp Problem

    2. 8

      Weird Cryptopp Problem

    3. 8

      Weird Cryptopp Problem

    4. 8

      Weird Cryptopp Problem

    5. 1

      Nemer dungeon crashcore

    6. 8

      Weird Cryptopp Problem

    7. 1

      Nemer dungeon crashcore

    8. 3

      Metin2 Change skill attack range with X armor equiped.

×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.