The steps in this article show how to connect your unity project to a MySQL database. Databases can store very large numbers of records efficiently. Multiple users can read and modify the data at the same time. Databases are searchable and sortable, so the data you need can be found quick and easily. As a unity developer you probably sometimes felt the need to store your players progress on an online server. This way you can ensure the integrity of your data and when a player deletes your game, their progress and saves are still stored on your online server and they can start where they left off by simply reinstalling you game and load their data from your servers. MySQL is a simple and fast database that can help you with that.
Unity can’t directly connect to a MySQL database and to be honest it wouldn’t have been secure even if it could. Because to connect directly to a database you will have to use the database credentials including the database password, then someone can simply decompile your game (which can easily be done) and access your database credentials. The best way to connect your unity project to an online MySQL database is to use a web API. Using this method, you will send a http request to a web page, then the web page connects to the database and update or retrieve the data that you specified and returns the response to you unity project.
There is a unity package that can help you to connect your game to an online MySQL database on a web hosting server using web API. Note that this package is free but you will need a web hosting server to connect your project to it. There is no difference between cPanel, DirectAdmin or other types of control panels, as long as you know your way around web hosting and familiar with basic php and MySQL query you should be fine, and even if you don’t, it’s too simple and easy to learn.
Here is the video tutorial on how to setup the connection and send requests.