MySQL和Unity登录 [英] MySQL and Unity login

查看:293
本文介绍了MySQL和Unity登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚通过ssh协议在VPS上用phpmyadmin安装了MySQL,并且已经创建了具有所有特权的root帐户.我想出了如何使用MySQL 5.5v通过C#与数据库连接.适用于.Net 2.0-Unity3D唯一可接受的版本.我对此有一些疑问.我不知道使用root帐户在客户端连接数据库是否正确,我的意思是这样的:Server=***;Database=Users;Uid=root;Pwd=***; 然后键入查询:SELECT * FROM Users where ....我认为它的不安全方式.我该如何以更安全的方式进行连接?如果不使用C#代码将密码提供给Root帐户,也许可以创建另一个没有修改权限的帐户?

I've just installed MySQL with phpmyadmin on my VPS via ssh protocol, and I've created root account with all privileges. I figured out how to connect with my databases via C# using MySQL 5.5v. for .Net 2.0 - the only version acceptable for Unity3D. And I have a few questions about it. I don't know is it right to connect to database on client side with root account, i mean something like that: Server=***;Database=Users;Uid=root;Pwd=***; and then type query: SELECT * FROM Users where .... i think its unsafe way. How can I connect do it in more safety way? Without giving Password to Root account in C# code, maybe create another account without modify permissions?

推荐答案

从客户端(Unity)连接到数据库不是一个好主意,如果该应用将在互联网上的任何地方发布.在 WWW 的帮助下使用POSTGET方法的方法a>类,以发送和接收服务器信息.

It's not a good idea to connect to the database from the client(Unity), if this app will be released anywhere on the internet. The way to do this to use POST or GET method with the help of the WWW class, to send and receive information your server.

您的服务器应使用phpperlc++或您喜欢的任何语言编码,它将读取您从Unity发送的数据,然后从数据库检索信息并将其发送回客户端(Unity) . 同样,整个数据库连接应在服务器而不是客户端上完成.

Your server should be coded with php,perl, c++ or whatever language you prefer.It will read data you send from Unity, then retrieve information from database and send it back to the client(Unity). Again, the whole database connection should be done on the server not on the client side.

一个例外情况是您的应用将用于公司办公室.只要您可以将其下载供他人使用,如果您对登录信息进行硬编码甚至允许从客户端直接连接到数据库,则是不安全的.在Unity Wiki 网站上有很多示例.

One exception to this is when your app will only be used in your company office. As long as it will be made available for others to download, it is not secure if you hard-code the login information or even allow direct connect to the database from the client side. There are many examples on Unity wiki website.

这篇关于MySQL和Unity登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆