Pls, help with error with Mysql

Please, help me with errors
[10:09:08] Assembly ‘Library/ScriptAssemblies/Assembly-CSharp.dll’ will not be loaded due to errors: Reference has errors ‘MySql.Data’.
[10:09:08] Assembly ‘Library/ScriptAssemblies/Assembly-CSharp-Editor.dll’ will not be loaded due to errors: Reference has errors ‘Assembly-CSharp’.
[10:09:08] Assembly ‘Assets/Libraries/MySql.Data. dll’ will not be loaded due to errors: Unable to resolve reference ‘Google.Protobuf’. Is the assembly missing or incompatible with the current platform?

i installed Mysql.Data.dll
thank you in advance

How did you ‘install’ that?
You need a framework compatible with C#/.NET

What do you mean?

You said you installed mysql.data.dll
What do you mean with that

I put it in Libraries folder

This is the only MySQL solution that I used in Unity:

Read the instructions.

2 Likes

Can you explain it please

It has its own documentation right on the front page.

What part of the documentation are you having issues with?

I done all from this site and i have error
[09:26:51] Unloading broken assembly Assets/Libraries/MySql.Data.dll, this assembly can cause crashes in the runtime

This is SQLite though.

But for games, it’s the right choice if you absolutely need a database. You should avoid MySQL/SQL Server/Oracle/Postgres/MariaDB which are overkills, since they need a running database server, while SQLite does not need a server at all (it’s just a file).

You won’t ask your players to go and install a MySQL server on their machine just to run your game? right?

You’ve forgotten to remove the broken dlls from your previous attempt.

This sort of comment makes me wonder if you really even need a database. Hardly anybody uses databases in gaming at the client level. Are you sure that you actually need this level of intense complexity???

ScriptableObjects are usually how data is authored. It is FAR simpler to use right in the editor.

I already have server, i need mysql for account system

it is This is a necessary measure

Do you really need any advanced 3D/2D Graphics in your app? if it’s just an admin/tool app, maybe it’s just simpler to use plain .NET and one of its UI frameworks (WinForms, WPF, MAUI, UWP, WinUI…) and not fight against Unity which was not meant to be used to access any database servers.

NO
It is 3d game and i must do connect to mysql database for account system. I cant without it

But where do you host your database? You NEVER directly connect to a mysql database over the internet. Depending on the rights the DB user has, a user could completely screw up your database or manipulate whatever he wants or in the mildest case get access to things he shouldn’t. That’s why interaction with a database from a game is almost always mediated through an API on a server, most commonly a webserver. For example a php script which does do the database interaction and provides concrete methods / end points that your game can use / query.

You can’t really implement any security or measures against manipulation or any other sort of attack when you expose a DB server directly to the internet. They are not designed for that.

Since you seem to be very inexperienced with databases, just a friendly warning: you get into very dangerous territory. Especially since you said “account management” you may risk other peoples personal data which can get you into real trouble.

Are you working on your own or do you work for a company? Because such design decisions should be made by more experienced developers.

Maybe have a look at this gd.se question. The list of reasons why you shouldn’t expose or use a mysql server over the internet is endless.

2 Likes

Exactly.

When you distribute your game (or any app), it’s extremely easy for anybody to decompile your code and have access to any connection string/credentials (username, passwords). Heck even without decompiling, anybody could sniff the packets of your network connection to your database and get the credentials.

TLDR: Create and use an API instead. It’s very easy.

I know it, but i want it. When i do it, i will create security, but i want DONE it first, and then i will protect it

You just cannot protect it. It’s impossible.

Anyway if you insist, this may help you:
https://github.com/Uncle-Uee/mysql-unity