If you like DNray Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

MySQL: how else can user data be stored

Started by Aditi Barman, Feb 16, 2023, 04:49 AM

Previous topic - Next topic

Aditi BarmanTopic starter

Hey there!

We're planning a simple browser game and need to store logins, passwords, and statistics. We have a few options for how to do this: Mysql (zero knowledge), Json, and INI.

Mysql seems like the most suitable option but I'm a bit intiмidated by it since I've never used it before. Json has a simple and clear file structure but isn't great for writing to files. INI is elegant and simple, so I'm thinking of making my own INI file with data for each user (there will be about 150k users). However, I'm not sure how the file will respond to simultaneous requests from different clients - will the data be recorded/counted?

Here's an example of the INI file structure:
[user]
id = 1
username = admin
password = qwerty123

[stats]
health = 100
energy = 1000

//etc

I'm hesitant to use MySQL and was wondering if you had any other suggestions? I know my idea with INI files isn't perfect, but I'm just an amateur in this field.
  •  

Reena Mehta

First things first, you need to decide what will be stored in the database and to what extent (at least approximately). What are your requirements for the database's performance, capabilities, remote access, etc.?

If you prefer JSON, then NoSQL databases like MongoDB might be a good fit for you. The data storage scheme is similar, but there's more flexibility and features like separate access to the database from other applications, built-in data tools, sorting, indexes and much more, as well as security tools and transactions.

There are also several embedded database implementations that don't require a separate DBMS software layer on the server and work at the level of the application itself (including websites). Universal and unique implementations exist in different programming languages, such as NeDB for node.js, LiteDB for .NET, LevelDB, and PouchDB.

For small amounts of data, the entire database can be stored in files such as INI or JSON. However, INI isn't a popular choice, as most web-oriented programming languages already have JSON tools available, including embedded databases based on JSON. Moreover, JSON is commonly used for exchanging data between the server and client.

Storing a large number of small files, as INI does, can become problematic for disk operations, especially depending on the file system and server settings. 50k files is a lot, and problems with more than 30k files in one folder can be difficult to solve.
  •  

SpyLin

Managing files for data storage is much more complex than using a DBMS. DBMSs are designed to protect data and prevent data loss for beginners who lack experience in data management. However, if safety isn't a concern, then using files may be an option.
  •  

Mississauga

Working with files is much more challenging than using a DBMS.

MySQL is an excellent option for beginners. Tables are easy to create and modify, and queries have a human syntax, making it convenient to work with data. It's a reliable DBMS with a vast amount of information available in the community.

Files should not be considered as an option for data storage. There are several popular DBMSs that can be used instead: MySQL, SQLite, PostgreSQL, Redis, and MongoDB. I suggest choosing from the first two options, with SQLite being the easier option for beginners.
  •  

brown.parker23

If you're looking for a simple solution to store login credentials and statistics for your browser game, I would suggest considering SQLite as an alternative to MySQL. SQLite is a lightweight, serverless, file-based database system that is widely used in many applications.

SQLite offers many advantages over INI files for managing data. It provides more structured data storage and better performance for handling simultaneous requests from different clients. With SQLite, you can define tables and columns to organize your data in a more structured manner, which makes it easier to manage and query the information. It also supports concurrent write operations without the risk of data corruption.

Using SQLite is relatively straightforward, and there are many resources available online to help you get started. It has good support for various programming languages, so you shouldn't have trouble finding libraries or frameworks to interact with the database in your preferred language.

If you're still hesitant about using SQLite or MySQL, another option you can consider is a NoSQL database like MongoDB or Firebase.

MongoDB is a popular document-oriented database that stores data in a flexible JSON-like format called BSON. It is known for its scalability and ability to handle large amounts of data. With MongoDB, you can store user logins, passwords, and statistics as JSON documents, similar to your initial idea with INI files. It supports concurrent read and write operations, making it suitable for simultaneous requests from different clients.

Firebase, on the other hand, is a cloud-based platform provided by Google. It offers a real-time database solution that automatically synchronizes data across clients, making it ideal for browser games that require real-time updates. With Firebase, you can easily store and retrieve user data without worrying about managing servers or handling concurrency issues.

Both MongoDB and Firebase have extensive documentation and support, and there are many resources available online to help you integrate them into your game. They also provide convenient APIs for interacting with the databases, which can simplify your development process.

Ultimately, the choice between SQLite, MySQL, MongoDB, or Firebase depends on your specific requirements and preferences. Consider factors such as scalability, complexity, ease of use, and the size of your user base when making your decision.
  •  


If you like DNray forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...