Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

MU Server with MySQL Database

Newbie Spellweaver
Joined
Jun 26, 2006
Messages
17
Reaction score
8
I'm wondering why everyone says that MU server has to use MSSQL as its DB. I want to show you, it is possible to use MySQL (and other DBs should work the same way). In fact, MU server is created to work with MSSQL, so server files will need some changes, but comparing to assembler coding main.exe, I really don't find this difficult :) So let's see how does it work:

What do you need

Brain

MySQL:
MySQL Connector/ODBC:
DreamCoder for MySQL (for simplicity):
MSSQL:
MSSQL2MySQL:
Hex editor (I am using PSPad):

Server files: (used 0.97d + 0.99):
Client files: I think, you can find on your own :)

How to do

0) Download and install the required soft.

1) Restore MSSQL DBs as you would do normally.

2) Create 2 MySQL DBs - `muonline` and `ranking`. Also create some passworded! login (do not use root, in fact it won't work with root anyway). You may use DreamCoder for ease.

3) Run MSSQL2MySQL and migrate DBs:


One of the differences between MSSQL and MySQL is, that in MySQL, there is a keyword CHARACTER. This makes problems with the table Character, so you have to rename the table (I renamed it to `chars`).


4) Create 2 MySQL ODBCs: MU and Ranking and link them into right DBs.


5) Now we have to modify server files to make them work correctly with MySQL. We have to solve a few problems:
> MySQL doesn't use NT authority, so you have to fill all logins and passwords correctly.
> MSSQL function GETDATE() is named NOW() in MySQL.
> Stored procedures aren't called with keyword EXEC, but with CALL and must use parenthesis.
> We have renamed the table Character.

5a) Open DataServer in hex editor and find this:
XyXeL - MU Server with MySQL Database - RaGEZONE Forums

Replace DB connection info with your valid login. For ODBC DSN, you created "MU" in the step 4, didn't you? :)
XyXeL - MU Server with MySQL Database - RaGEZONE Forums

Next thing, search for queries using Character table. We have renamed Character, so we must modify all queries (I mean ALL, not only these on the picture ;)). Also search for GETDATE() function and replace it with NOW(). Don't worry about blank spaces, SQL ignores them.
XyXeL - MU Server with MySQL Database - RaGEZONE Forums

Save and do the same with the second DataServer (or just copy the exe).

5b) Open JoinServer with hex editor and find:
XyXeL - MU Server with MySQL Database - RaGEZONE Forums

Again, replace DSN, user and password with your valid login. Replace it everywhere in the JoinServer file, you can find it about 10x. If you didn't yet, find the login that uses USELOG DSN instead of MuOnlineJoinDB and modifi it the same way.
XyXeL - MU Server with MySQL Database - RaGEZONE Forums

Search for GETDATE() function and replace it with NOW().
XyXeL - MU Server with MySQL Database - RaGEZONE Forums

Now search for queries with keyword EXEC and replace EXEC with CALL. Rename procedures WZ_CONNECT_MEMB() and WZ_DISCONNECT_MEMB() to connect() and disconnect(). Don't forget the parenthesis ;)
XyXeL - MU Server with MySQL Database - RaGEZONE Forums


XyXeL - MU Server with MySQL Database - RaGEZONE Forums

Save JoinServer

5c) Open ExDB with hex editor and find:
XyXeL - MU Server with MySQL Database - RaGEZONE Forums

Again replace the login info.
Now search for the procedure WZ_GuildCreate and add parenthesis to the parameters:
XyXeL - MU Server with MySQL Database - RaGEZONE Forums

Save ExDB.

6) Finish setting IPs, ports etc. as you would do normally. Don't forget to fill svconfig.ini (EventServer and RankingServer) with right DSN, user and password.

7) Create stored procedures (again, you may use DreamCoder for ease):
Code:
CREATE PROCEDURE connect(acc varchar(10), server varchar(20), userip varchar(15))
BEGIN
  IF EXISTS (SELECT * FROM memb_stat WHERE memb___id=acc) THEN UPDATE memb_stat SET ConnectStat=1, ServerName=server, IP=userip, ConnectTM=now() WHERE memb___id=acc;
  ELSE INSERT INTO memb_stat(memb___id, ConnectStat, ServerName, IP, ConnectTM) VALUES(acc, 1, server, userip, NOW());
  END IF;
END
Code:
CREATE PROCEDURE disconnect(acc varchar(10))
BEGIN
  UPDATE memb_stat SET ConnectStat=0, DisConnectTM=now() WHERE memb___id=acc;
END
Code:
CREATE PROCEDURE WZ_getitemserial()
BEGIN
    UPDATE GameServerInfo SET ItemCount = ItemCount + 1;
    SELECT ItemCount FROM GameServerInfo;
END
Code:
CREATE PROCEDURE WZ_GuildCreate(gname varchar(20), gmaster varchar(20))
BEGIN
    IF EXISTS (SELECT * FROM Guild WHERE G_Name=gname) THEN SELECT 1;
    ELSEIF EXISTS (SELECT * FROM GuildMember WHERE Name=gmaster) THEN SELECT 2;
    ELSE BEGIN
        INSERT INTO Guild(G_Name, G_Master, G_Score) VALUES(gname, gmaster, 0);
        INSERT INTO GuildMember(Name, G_Name, G_Level) VALUES(gmaster, gname, 1); 
        SELECT 0; 
    END;
    END IF;
END
You may copy other procedures too, but these are the most important I think...

8) If you want, disable MSSQL. Run servers and enjoy your MySQL MU Server :)


Notes

> It is not really necessary to instal MSSQL. You may create whole DBs manually. I used it just because migration is much more simple.
> You don't have to use exactly the same soft as I named, but be sure yours does the same thing :)
> You don't even have to follow my guide if you find how does it work :)
> I'm not SQL master, there may be more errors in queries, in fact it's on you to test ;)
> Any questions and comments will be posted in this topic - no PM, no ICQ etc...

Credits

Created by XyXeL (C)2009
 
Kingdom of Shadows
Loyal Member
Joined
Jul 13, 2007
Messages
923
Reaction score
320
Re: [Guide] MU Server with MySQL Database

some incompatibility at guildmember table but with a few mssql/mysql experience can be fixed.10/10
 
Newbie Spellweaver
Joined
Jun 6, 2008
Messages
71
Reaction score
8
Re: [Guide] MU Server with MySQL Database

Great Job....i've done this thing in the past, but i couldn't migrate the stored procedures
 
Junior Spellweaver
Joined
Oct 4, 2007
Messages
173
Reaction score
74
Re: [Guide] MU Server with MySQL Database

Need help with season 1-3 dataserver...
Cant find dns, login and password...
XyXeL - MU Server with MySQL Database - RaGEZONE Forums
 
Experienced Elementalist
Joined
Apr 15, 2008
Messages
256
Reaction score
0
Re: [Guide] MU Server with MySQL Database

really good job!!
in MYSQL there's a function called dump,which backs up all of your db's into a file and can email them/upload to ftp. Which is really useful to do every week or so :)
 
Newbie Spellweaver
Joined
Jun 6, 2008
Messages
71
Reaction score
8
Re: [Guide] MU Server with MySQL Database

But why to hex the data server when you can choose that options from DataServer.ini.dat...i mean why to change user/pass with hex?
 
Newbie Spellweaver
Joined
Jun 6, 2008
Messages
74
Reaction score
0
Re: [Guide] MU Server with MySQL Database

what is the port for the mu i am from singapore

i having portforward problem
 
Newbie Spellweaver
Joined
Jun 6, 2008
Messages
71
Reaction score
8
Re: [Guide] MU Server with MySQL Database

Now...if we want a faster mu online server we need to make it run under linux, I mean without Wine....but this is very hard work....even if there is eDataServer(which Error has the sources)
 
Initiate Mage
Joined
Nov 22, 2008
Messages
2
Reaction score
0
Re: [Guide] MU Server with MySQL Database

I have a problem :/..

ALL WORKS..

BUT, WHEN I TRY CONNECT TO THE SERVER, THE SERVER SAYS "ACCOUNT INVALID"

I DONT KNOW WHAT IS THE REASON :/

PLEASE HELP ME

THANKS

PD : SORRY FOR MY BAD ENGLISH
 
Newbie Spellweaver
Joined
Jan 23, 2009
Messages
46
Reaction score
0
Re: [Guide] MU Server with MySQL Database

I get this error:
Code:
02:02:29p INSERT INTO Chars
SQLSTATE:42000, diagnosis:[MySQL][ODBC 5.1 Driver][mysqld-5.0.51b-community-nt-log]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 '' at line 1
 
Experienced Elementalist
Joined
Nov 4, 2007
Messages
200
Reaction score
5
Re: [Guide] MU Server with MySQL Database

works only on old versions :(
 
Kingdom of Shadows
Loyal Member
Joined
Jul 13, 2007
Messages
923
Reaction score
320
Re: [Guide] MU Server with MySQL Database

works only on old versions :(
in new ds versions this info are stored in a file named dataserver.ini.dat.You need to decrypt it and change the info..
 
Experienced Elementalist
Joined
Aug 5, 2008
Messages
268
Reaction score
28
Re: [Guide] MU Server with MySQL Database

how do u decrypt it?
 
Newbie Spellweaver
Joined
May 21, 2009
Messages
84
Reaction score
0
Re: [Guide] MU Server with MySQL Database

:D ITS WORK IN ALL MU VERSION??????? IHAV SERVER SEASON2 ???? ..... tnx:8::8::8::8:
 
Newbie Spellweaver
Joined
May 2, 2009
Messages
16
Reaction score
0
Re: [Guide] MU Server with MySQL Database

Nice man but I think there is only one problem.
How can I use a Web Site for Mu Online. In MySql
What do I need to change ?
 
Initiate Mage
Joined
Jul 11, 2008
Messages
4
Reaction score
0
Re: [Guide] MU Server with MySQL Database

Thats very good. I can put on my server but i have a little problem.
When i'm loggued in, i can create characters and i can play whith it, but when i loggout the character dissapear. The name is registered but i cant play because in my account havn't characters.
I'm spanish and my english is very bad.
Who can help me?
 
Junior Spellweaver
Joined
Jan 8, 2005
Messages
104
Reaction score
0
Re: [Guide] MU Server with MySQL Database

Thats very good. I can put on my server but i have a little problem.
When i'm loggued in, i can create characters and i can play whith it, but when i loggout the character dissapear. The name is registered but i cant play because in my account havn't characters.
I'm spanish and my english is very bad.
Who can help me?

I dont know exactly, but I think this is a problem with one of the stored procedures. I dont know if I can try this beacause I have a paid version, but later I will try with a free version.
 
Initiate Mage
Joined
Jul 11, 2008
Messages
4
Reaction score
0
Re: [Guide] MU Server with MySQL Database

I've all stored procedures applied but don't works...
The server ir 99b+ but i was tried with the example version too and dont works.
 
Initiate Mage
Joined
Jul 11, 2008
Messages
4
Reaction score
0
Re: [Guide] MU Server with MySQL Database

I try with a 97d too but i have the same bug.
I make a video with my problem (i'ts on spanish but it's very graphic and you don't need understand-it)
The video can be downloaded at
Or see online at [nomedia]http://www.youtube.com/watch?v=4E4aOQK6I8I[/nomedia]
I need help please it's very important for me.
Tnxx: thumbup1:
 
Last edited:
Initiate Mage
Joined
Nov 9, 2007
Messages
4
Reaction score
0
Can Some One Help Me Please Im Confuse of what to do with This>>>>>1) Restore MSSQL DBs as you would do normally.

2) Create 2 MySQL DBs - `muonline` and `ranking`. Also create some passworded! login (do not use root, in fact it won't work with root anyway). You may use DreamCoder for ease.
 
Back
Top