Jump to content

Mysql56 to Mysql8


Go to solution Solved by AZICKO,

Recommended Posts

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 comment
Share on other sites

  • Management
  • Solution

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...)
  • Metin2 Dev 1
  • Confused 1
  • Love 3
Link to comment
Share on other sites

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 comment
Share on other sites

  • Management

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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 comment
Share on other sites

  • Forum Moderator

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

Gurgarath
coming soon

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Management

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. In my example, I wrapped all columns.

Example:

This is the hidden content, please

 

To """ recreate """ 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:

This is the hidden content, please

  • Metin2 Dev 112
  • kekw 1
  • Eyes 1
  • Dislove 1
  • Smile Tear 1
  • Good 32
  • Love 51
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 2 weeks later...

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 $@

$(OBJDIR)/version.o: version.cpp
	@$(CC) $(CFLAGS) -D__VERSION__=\"$(REVISION)\" -c $< -o $@
	@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 $@
	@echo compiling $<

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

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

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
Link to comment
Share on other sites

  • Developer
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_

My youtube channel  on which you can see my works here

Link to comment
Share on other sites

  • Developer
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 comment
Share on other sites

  • Developer

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_

My youtube channel  on which you can see my works here

Link to comment
Share on other sites

  • Developer
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_
  • Love 1

My youtube channel  on which you can see my works here

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • 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.