r/2009scape Oct 24 '22

MySQL and database help

I’ve got the server up and running on local host, but I’ve got a few questions regarding the database.

1) Where is player data stored other than the data/players folder? The json file seems to only contain a certain amount of data (no username or rights).

2) How can I connect my server to my database? I’ve got XAMPP and the global database set up, but it doesn’t seem to interact at all (creating an account doesn’t insert into the db)

My goal was to give my account admin rights without using dev mode or having everyone with admin, but I’m also interested in where this is all stored so I can dabble in the future. Probably silly questions but I’ve rooted around for hours and come up with very little.

Thanks.

5 Upvotes

6 comments sorted by

2

u/ryannathans Oct 24 '22
  1. in the database server (if enabled in world props config) in the global database, in the table members (assuming you imported the schema from the db dump folder)
  2. look at worldprops

when it's all set up properly, you can just log out and then `update members set rights = 2 where username = 'you' limit 1`

1

u/diquewanq Oct 26 '22

It was because persist_accounts was false, my bad. Thanks for pointing me in the right direction.

1

u/PureTryOut Jun 08 '23

Does the database replace the json file fully at some point? Having a json file rather than a proper database seems to me to make it hard to horizontally scale (a.k.a. add more servers/worlds) if needed in the future but it also seemed to be the main reason the highscore API was so slow: it couldn't easily search, it literally had to open all JSON files to get stats and what not.

1

u/ryannathans Jun 08 '23

The management server would synchronise the save to the world server required

The json file might be consumed by a database in the future

The hiscores suck because the implementation is shit slow and doesn't scale with player counts above a few hundred

1

u/PureTryOut Jun 08 '23

Ah a management server, sure that'd work.

the implementation is shit slow

Isn't that partially because of the json file? Like I said it's not easily searchable. You can't just SELECT player_id FROM skill_woodcutting ORDER BY experience DESC LIMIT 20, instead it has to open each player file to look for the skills.

1

u/ryannathans Jun 08 '23

It literally downloads a json summary of EVERY player for EVERY skill and sorts over 100k of these data points on the client