• 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!

MySQL How to setup a MySQL Database (screenshots included) - Last update: 16/7/2009

Delirium

OTLand veteran
Staff member
Global Moderator
Joined
May 28, 2007
Messages
3,365
Solutions
1
Reaction score
289
Location
Athens, Greece
Welcome. In this thread you will learn how to setup a MySQL Database.

Please do not forget to add me a reputation point after you read this tutorial.

First Step:

First of all you have to download Xampp from Apache Friends - Xampp for Windows

After you download Xampp, run the installer. Set C:/xampp as the installation directory for efficiency. Before you complete the installation, you'll see a page having 3 tick boxes in the bottom. They should be looking like this:

2v3g39z.jpg



After Xampp finishes its installation & the port check, go to http://localhost/xampp and click on Security.

Then click in http://localhost/security/xamppsecurity.php.
Set up a new password by filling out the two first boxes and clicking on password change.
The window should be like this:

1zdrlz7.jpg


Note: The first box in this picture won't be there for you if you just installed Xampp.

If you set your password, stop both of your services (Apache and MySQL) and then start them again. You can do that using Xampp Control Panel:

zk5wrt.jpg


Click once the buttons writing "Stop" in the red square and then click them again.


Second Step:

Go to http://localhost/phpmyadmin and login with "root" as your username and use your newly created password like in this picture:

34gx7op.jpg



Now in PhpMyAdmin's main page, create a new database by typing the name of the database you want to create (theforgottenserver preferably) in the box marked in the following picture with the number 1 and then click "Create":

osdf00.jpg


Now you created your database!


Third Step:


In your server's folder there is a .sql or a .mysql file which is needed for the database.
Now we will import this file into our server's database. In phpMyAdmin on the left side menu choose the database you created (click on its name) and then click in the small "Import" button above it like in these pictures:

2mg5v0y.jpg


and

oursqo.jpg



Click "Browse" or "Search" (whatever the button with number 2 says) and then browse for the schema.mysql (in case you use the forgotten server) or database.sql or whichever file your server comes with and has .sql or .mysql extention, then click "Go".

If the import was successful then you'll see a message saying:
Import has been successfully finished, x queries executed.
- x might be different from user to user

If not then you're doing something wrong.

You now have some examples of players, accounts, groups, and some other things working on your database, try browsing the database to see how clear the information is.You will realise how easy MySQL is.

Fourth Step:

Go to config.lua and fill in your MySQL part

Code:
	sqlType = "mysql"
	sqlHost = "localhost"
	sqlPort = 3306
	sqlUser = "root"
	sqlPass = "your mysql password here"
	sqlDatabase = "the name of your database here"


If you've done whatever I said carefully and properly, you will be able to run your server without MySQL problems. If still have problems add me on msn: [email protected]


Credits: Me and Talaturen
 
Last edited:
RE: How to Setup a MySQL Database (Updated and Detailed Guide)

hmmm i got a problem,i have followed everything u have said and stuff, but when i open the .exe for theforgottenserver, it says

"MYSQL ERROR | mysql_select_db: theforgottenserver | failed!
>> ERROR: Unable to load bans!"

any advice on how to get it to work?i have the bans file in the right place so im confused.
any help would be greatly apreciated
 
RE: How to Setup a MySQL Database (Updated and Detailed Guide)

joeeigel said:
hmmm i got a problem,i have followed everything u have said and stuff, but when i open the .exe for theforgottenserver, it says

"MYSQL ERROR | mysql_select_db: theforgottenserver | failed!
>> ERROR: Unable to load bans!"

any advice on how to get it to work?i have the bans file in the right place so im confused.
any help would be greatly apreciated

You must run the SQL server and edit the config.lua settings about database to : database user: root password: write here the password you wrote in http://localhost/security/xamppsecurity.php

Database name: The name of the database you created in http://localhost/phpmyadmin and leave database location as localhost
 
RE: How to Setup a MySQL Database (Updated and Detailed Guide)

I cant see what is wrong :S This appears after I have "imported" the server on my localhost (xampp)

Warning: mb_strpos() [function.mb-strpos]: Unknown encoding or conversion error. in C:xamppphpMyAdminlibrariesstring.lib.php on line 112

Warning: mb_strpos() [function.mb-strpos]: Unknown encoding or conversion error. in C:xamppphpMyAdminlibrariesstring.lib.php on line 112

Warning: mb_strpos() [function.mb-strpos]: Unknown encoding or conversion error. in C:xamppphpMyAdminlibrariesstring.lib.php on line 112

Warning: Cannot modify header information - headers already sent by (output started at C:xamppphpMyAdminlibrariesstring.lib.php:112) in C:xamppphpMyAdminlibrariesheader_http.inc.php on line 13

Warning: Cannot modify header information - headers already sent by (output started at C:xamppphpMyAdminlibrariesstring.lib.php:112) in C:xamppphpMyAdminlibrariesheader_http.inc.php on line 14

Warning: Cannot modify header information - headers already sent by (output started at C:xamppphpMyAdminlibrariesstring.lib.php:112) in C:xamppphpMyAdminlibrariesheader_http.inc.php on line 15

Warning: Cannot modify header information - headers already sent by (output started at C:xamppphpMyAdminlibrariesstring.lib.php:112) in C:xamppphpMyAdminlibrariesheader_http.inc.php on line 16

Warning: Cannot modify header information - headers already sent by (output started at C:xamppphpMyAdminlibrariesstring.lib.php:112) in C:xamppphpMyAdminlibrariesheader_http.inc.php on line 19
Server: localhost Databas: TheForgottenServer
Fel
Det är möjligt att du har hittat en bugg i SQL-analysatorn. Var god granska din fråga noga och kontrollera att citationstecknen är korrekta och matchar varandra. En annan möjlig felorsak kan vara att du överför en fil med binärkod som inte ligger inom citationstecken. Du kan även testa din fråga i MySQL:s kommandoradsgränssnitt. Felmeddelandet från MySQL-servern nedan, om det finns något, kan också hjälpa dig att analysera problemet. Om du fortfarande har problem eller om SQL-analysatorn misslyckas när kommandoradsgränssnittet lyckas, var vänlig reducera din inmatning av SQL-frågor till den enda fråga som orsakar problem och skicka en buggrapport med datastycket i URKLIPP-sektionen nedan:
----START URKLIPP----
eNrtlNFLU3EUx890iV3DxjAQw/Yb3Kdyl7s5TRcDxZZJc043LSzJTVcN3FzbneWbNYQuF8OoP6Co
h+iphwJLilsEPQnSU9BLBMGNfOghZEiwzu/eBUpFb+HDOezud3fP9/c953cu+4RGRoZGAqzPy/p8
LByKBJiPtTOv3Cl3C7E4ZpYFITaGj8WB6QArXJ7JJfKFVF6aSSel3KUcKn3+o8wny0c9st8j860B
X3vA3z3OZlKZbiYKg/Ox4XCAdUiy5Pd6pmYzmWI2rcx7soowGhthQ7E21tsfisTb2FgI651OZ9lA
iHVKshAd7MV2JK8seYXoySjPtw3FuJVP8rHTA5FIXAj3RvqxrzlPUbng6RLMUoPjy1ALAHa8KhWA
FbCiB/4dC3g1up43wpO9a+4VW3jNHb+ULrBcfvZiPpFhU4lsdlZhyRTLF7MMWz0+FGOZ2emUJAhi
1SIaAgjb6kCvzZ34ZfsR9tc22Gq6oM4FUOcGSAIwJyYceDGX1Ry/r7HatlXbN+Ou2/xR89RtHgs3
WFr+5bAkju1nkN3Q1MwbccO3EPy3kJTUVQXXh3aX1RA/q32nZhI/0nRCSXBdY/XsXCu4duhwGrqU
t4Q9N3EaMuaXcW35TdcjJQsF856b6uxvr1WX0pafORucEbTg+oj9oW4hP4X35uxwhsDf4pvfdUCx
K2NU/VzaaFYnytpovfeDWvyh1Xg3NQjewnd2pS+4hEv+7Ev+D3trF+tx8erqcdFuPHjphFLZpsws
6srhaqqyvlrBUN9raDNRVjcmXtsheBstlBfBO3xZ3ZlbmoPgHnxeNNChgZtvqgqa91fN/Wi+Vk1V
1r/eq9ZZ5e2o51B4CIWLm8oNo6PkBLP412tV/TMusvoJo/L7Cyd8SXKBsLw98Pyx0oa4NFHGfeDo
AePRayy+YTc+XXfC21CZD2kF9ElYGv2ONR2a8PjIeeAzUONiPXrvw412zBuvsMS9BZYA7PrMfR1V
2oFoB/58t39RQ5fS1keFmQK+W2vlOe2UrO4TjTncaolLW7pyUGs1VXhCTTBVw1G1STSiqDKOEbAJ
2ARsAjYBm4BNwCZgE7AJ2ARsAjYBm4BNQcAmYBOwCdgEbAI2AZuATcAmYFMQsAnYBGwCNgGbgoBN
wCZgE7AJ2ARsAvauAfZPYad7BQ==
----SLUT URKLIPP----
----START RÅTEXT----

ERROR: C1 C2 LEN: 2 3 10609
STR: ?

SVN: $Id: sqlparser.lib.php 10247 2007-04-03 10:23:49Z lem9 $
MySQL: 5.0.41-community-nt
USR OS, AGENT, VER: Win IE 6.0
PMA: 2.10.1
PHP VER,OS: 5.2.2 WINNT
LANG: sv-utf-8
SQL: MZ???@??? ͡?L͡This program cannot be run in DOS mode.

$PEL?pF? 8!b  @?!?! 0!P!?.text?``.data? 
@?rdata@?0?@@.bss@a???idata0!? @?rsrc?P!FĠ@?U?僬?]?ۉu?=??C=??[?DŽ$1?D$褾???*DŽ$??؋u?]„=???=????؋u?]„?v=?臄$ 1?臾???͇$ ?DŽ$??$螾??5???끇$ ????L$贽颿??????????????U?哃줍]?@誂?섨ₒDž????U?
?+_?D$?T$?L$ DŽ$?聽?? a??X??_?P5a?ҏ????? a?D$?P5a?K0? $趽?P5a??? a?$?
P5a?QP?$落軍Z???@??? ͡?L͡This program cannot be run in DOS mode.

$PEL?pF? 8!b  @?!?! 0!P!?.text?``.data? 
@?rdata@?0?@@.bss@a???idata0!? @?rsrc?P!FĠ@?U?僬?]?ۉu?=??C=??[?DŽ$1?D$褾???*DŽ$??؋u?]„=???=????؋u?]„?v=?臄$ 1?臾???͇$ ?DŽ$??$螾??5???끇$ ????L$贽颿??????????????U?哃줍]?@誂?섨ₒDž????U?
?+_?D$?T$?L$ DŽ$?聽?? a??X??_?P5a?ҏ????? a?D$?P5a?K0? $趽?P5a??? a?$?
P5a?QP?$落軍Z???@??? ͡?L͡This program cannot be run in DOS mode.

$PEL?pF? 8!b  @?!?! 0!P!?.text?``.data? 
@?rdata@?0?@@.bss@a???idata0!? @?rsrc?P!FĠ@?U?僬?]?ۉu?=??C=??[?DŽ$1?D$褾???*DŽ$??؋u?]„=???=????؋u?]„?v=?臄$ 1?臾???͇$ ?DŽ$??$螾??5???끇$ ????L$贽颿??????????????U?哃줍]?@誂?섨ₒDž????U?
?+_?D$?T$?L$ DŽ$?聽?? a??X??_?P5a?ҏ????? a?D$?P5a?K0? $趽?P5a??? a?$?
P5a?QP?$落軍Z???@??? ͡?L͡This program cannot be run in DOS mode.

$PEL?pF? 8!b  @?!?! 0!P!?.text?``.data? 
@?rdata@?0?@@.bss@a???idata0!? @?rsrc?P!FĠ@?U?僬?]?ۉu?=??C=??[?DŽ$1?D$褾???*DŽ$??؋u?]„=???=????؋u?]„?v=?臄$ 1?臾???͇$ ?DŽ$??$螾??5???끇$ ????L$贽颿??????????????U?哃줍]?@誂?섨ₒDž????U?
?+_?D$?T$?L$ DŽ$?聽?? a??X??_?P5a?ҏ????? a?D$?P5a?K0? $趽?P5a??? a?$?
P5a?QP?$落軍Z???@??? ͡?L͡This program cannot be run in DOS mode.

$PEL?pF? 8!b  @?!?! 0!P!?.text?``.data? 
@?rdata@?0?@@.bss@a???idata0!? @?rsrc?P!FĠ@?U?僬?]?ۉu?=??C=??[?DŽ$1?D$褾???*DŽ$??؋u?]„=???=????؋u?]„?v=?臄$ 1?臾???͇$ ?DŽ$??$螾??5???끇$ ????L$贽颿??????????????U?哃줍]?@誂?섨ₒDž????U?
?+_?D$?T$?L$ DŽ$?聽?? a??X??_?P5a?ҏ????? a?D$?P5a?K0? $趽?P5a??? a?$?
P5a?QP?$落軍Z???@??? ͡?L͡This program cannot be run in DOS mode.

$PEL?pF? 8!b  @?!?! 0!P!?.text?``.data? 
@?rdata@?0?@@.bss@a???idata0!? @?rsrc?P!FĠ@?U?僬?]?ۉu?=??C=??[?DŽ$1?D$褾???*DŽ$??؋u?]„=???=????؋u?]„?v=?臄$ 1?臾???͇$ ?DŽ$??$螾??5???끇$ ????L$贽颿??????????????U?哃줍]?@誂?섨ₒDž????U?
?+_?D$?T$?L$ DŽ$?聽?? a??X??_?P5a?ҏ????? a?D$?P5a?K0? $趽?P5a??? a?$?
P5a?QP?$落軍Z???@??? ͡?L͡This program cannot be run in DOS mode.

$PEL?pF? 8!b  @?!?! 0!P!?.text?``.data? 
@?rdata@?0?@@.bss@a???idata0!? @?rsrc?P!FĠ@?U?僬?]?ۉu?=??C=??[?DŽ$1?D$褾???*DŽ$??؋u?]„=???=????؋u?]„?v=?臄$ 1?臾???͇$ ?DŽ$??$螾??5???끇$ ????L$贽颿??????????????U?哃줍]?@誂?섨ₒDž????U?
?+_?D$?T$?L$ DŽ$?聽?? a??X??_?P5a?ҏ????? a?D$?P5a?K0? $趽?P5a??? a?$?
P5a?QP?$落軍Z???@??? ͡?L͡This program cannot be run in DOS mode.

$PEL?pF? 8!b  @?!?! 0!P!?.text?``.data? 
@?rdata@?0?@@.bss@a???idata0!? @?rsrc?P!FĠ@?U?僬?]?ۉu?=??C=??[?DŽ$1?D$褾???*DŽ$??؋u?]„=???=????؋u?]„?v=?臄$ 1?臾???͇$ ?DŽ$??$螾??5???끇$ ????L$贽颿??????????????U?哃줍]?@誂?섨ₒDž????U?
?+_?D$?T$?L$ DŽ$?聽?? a??X??_?P5a?ҏ????? a?D$?P5a?K0? $趽?P5a??? a?$?
P5a?QP?$落軼/pre>
----SLUT RÅTEXT----


SQL-fråga:


MZ???@??? ͡?L͡This program cannot be run in DOS mode.

$PEL?pF? 8!b  @?!?! 0!P!?.text?``.data? 
@?rdata@?0?@@.bss@a???idata0!? @?rsrc?P!FĠ@?U?僬?]?ۉu?=??C=??[?DŽ$1?D$褾???*DŽ$??؋u?]„=???=????؋u?]„?v=?臄$ 1?臾???͇$ ?DŽ$??$螾??5???끇$ ????L$贽颿??????????????U?哃줍]?@誂?섨ₒDž????U?
?+_?D$?T$?L$ DŽ$?聽?? a??X??_?P5a?ҏ????? a?D$?P5a?K0? $趽?P5a??? a?$?
P5a?QP?$落車

MySQL sa:


#1064 - 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 'MZ
 
RE: How to Setup a MySQL Database (Updated and Detailed Guide)

The only thing i can say about this is : WTF!?
 
RE: How to Setup a MySQL Database (Updated and Detailed Guide)

This is a great tutorial! really helps alots of people who dont know how to set up a Mysql database
 
RE: How to Setup a MySQL Database (Updated and Detailed Guide)

Hehe better is here: http://rapidshare.com/files/31624397/tutorial.wmv.html first scan it and later open
 
RE: How to Setup a MySQL Database (Updated and Detailed Guide)

Thanks man, helped me alot! ((Nothing))
 
RE: How to Setup a MySQL Database (Updated and Detailed Guide)

I think that tutorials of MySQL databases using XAMPP are too old (there'r a thousands of it), don't you think? Why not do some using the Windows SQL Center? Which has an interface super-easy to handle. Or maybe this's just a ctrl+c/ctrl+v.

I'm just giving my opinion about it.
 
RE: How to Setup a MySQL Database (Updated and Detailed Guide)

Err... "MYSQL ERROR mysql_real_querry: SELECT * FROM bans Table 'otserv.bans' doesn't exist. Any suggestions on how I shuld fix this?
 
RE: How to Setup a MySQL Database (Updated and Detailed Guide)

Thanks for Tutorials :)
 
RE: How to Setup a MySQL Database (Updated and Detailed Guide)

kennet123 said:
Err... "MYSQL ERROR mysql_real_querry: SELECT * FROM bans Table 'otserv.bans' doesn't exist. Any suggestions on how I shuld fix this?

did you imported the .sql file of your server
 
RE: How to Setup a MySQL Database (Updated and Detailed Guide)

Nikolas1994 said:
kennet123 said:
Err... "MYSQL ERROR mysql_real_querry: SELECT * FROM bans Table 'otserv.bans' doesn't exist. Any suggestions on how I shuld fix this?

did you imported the .sql file of your server

I can't import my .sql because when I try to do that it sais:

Error

SQL query:

DELIMITER | CREATE TRIGGER `ondelete_accounts` BEFORE DELETE ON `accounts` FOR EACH ROW BEGIN DELETE FROM `bans` WHERE `account` = OLD.`id` ;

MySQL said: Documentation
#1064 - 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 'DELIMITER |

CREATE TRIGGER `ondelete_accounts`
BEFORE DELETE
ON `accounts`
FOR ' at line 1

I use phpMyAdmin. Thanks.
 
RE: How to Setup a MySQL Database (Updated and Detailed Guide)

This tutorial has to be updated, database.sql can no longer be imported with phpMyAdmin, you have to use commandline.
 
RE: How to Setup a MySQL Database (Updated and Detailed Guide)

Thanks Talaturen,i posted the important.txt and added credits to you :)
 
RE: How to Setup a MySQL Database (Updated and Detailed Guide)

nice tutor rly had helped me but i had to learn it by myeself
 
RE: How to Setup a MySQL Database (Updated and Detailed Guide)

Great tutorial Nikolas ;)
Now unshould question type: "I cannot load bans plz help" :)
 
RE: How to Setup a MySQL Database (Updated and Detailed Guide)

Wow!!!! Nice tutorial!! Now i can use a MySql uhuhuhuhuhuuhuuhu
Thx!
 
RE: How to Setup a MySQL Database (Updated and Detailed Guide)

Script line: 1 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 'IF EXISTS `oncreate_players`' at line 1
Script line: 2 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 'IF EXISTS `oncreate_guilds`' at line 1
Script line: 3 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 'IF EXISTS `ondelete_players`' at line 1
Script line: 4 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 'IF EXISTS `ondelete_guilds`' at line 1
Script line: 5 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 'IF EXISTS `ondelete_accounts`' at line 1



im just importing.... wont work in anyway.. not even the way thats been told in this tutorial
 
Back
Top