Something about MySQL
#1

Hey guys

So I have a single question regarding MySQL.

Can you edit some numbers/words in a field WHILE that database is open and running along with a server?

Example 1: A player is connected and playing. Can you edit some things in his account? Will it stay saved(In my opinion it should not) and will it cause a bug doing so?

Example 2: A player is not connected. Can you edit some things in his account? Will it cause a bug?


For all these years I have been editing MySQL database by first shutting down the server and then editing the database. I don't know why but I always thought you can't edit something while is opened.

All answers appreciated!
Reply
#2

Yes BUT, you must be able to update whatever you just changed in real time

For example, let's say you have a column for health, you can update the value and then use something like SetPlayerHealth to update it in game as well

And you can edit whatever you want on their offline account, as when they connect, it will request the information from the database and load it in so it would be the same as if they logged out and it saved
Reply
#3

Okay, I get it.
Basically, it's better doing stuff while they are offline because fields can be overwritten by them while they are in game. So no bugs should pop up while I edit an opened database?
Reply
#4

Quote:
Originally Posted by Sime30
Посмотреть сообщение
Okay, I get it.
Basically, it's better doing stuff while they are offline because fields can be overwritten by them while they are in game. So no bugs should pop up while I edit an opened database?
That's not quite how it works, i'm trying to find an easy way to explain this to you

Alright let's say the player is in game, and they receive 500 dollars. It will update that value and store it temporarily, then when the player disconnects, it will save all those values in the MySQL database. That's why sometimes when player/server crashes it doesn't save properly and their accounts are set back.

It's all a matter of which one saves last, if you edit a value, and the player is online but then he/she logs off, it will overwrite it with that last save from the server
Reply
#5

Yes, I know that. "THE LAST ONE WINS" haha

I got that even though I may seemed like I didn't. Only thing is, I've seen bugs coming that way on some servers. They edited a live running database and crap happened
Reply
#6

So is it then okay to edit an offline account/data that is not currently being used in a running database?
Reply
#7

Quote:
Originally Posted by Sime30
Посмотреть сообщение
So is it then okay to edit an offline account/data that is not currently being used in a running database?
Should be fine, yes, to prevent any problems, don't edit big things while the server is running, like businesses
Reply
#8

Thanks , you've been of great help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)