简体   繁体   English

如何访问mysql远程数据库

[英]how access mysql remote database

im creating inapp purchage subscription module, in this app i want to access remote database but problem is that how i connect my objective-c code with the mysql on the server, 我在此应用程序中创建了inapp购买订阅模块,我想访问远程数据库,但问题是我如何将我的Objective-C代码与服务器上的mysql连接起来,

i am not found any sufficient refrence please help me if any refrence or solution is there. 我找不到足够的参考资料,如果有任何参考资料或解决方案,请帮助我。

In mySQL, all access from your application to the database server is already remote access. 在mySQL中,从应用程序到数据库服务器的所有访问已经是远程访问。 Local access is simply one case of remote access. 本地访问只是远程访问的一种情况。

If you're working locally, you may be using "localhost" or "127.0.0.1" as the hostname for your data base, and 3306 as the port number. 如果在本地工作,则可能使用“ localhost”或“ 127.0.0.1”作为数据库的主机名,并使用3306作为端口号。 You're using the data base name you set up on your local server, perhaps "arunsdata" or some such thing 您正在使用在本地服务器上设置的数据库名称,也许是“ arunsdata”或类似的名称

You need to find out the hostname and port number of the remote data base server. 您需要找出远程数据库服务器的主机名和端口号。 (The port number is probably 3306.) Then you need to modify your application code to specify that hostname and port number. (端口号可能是3306。)然后,您需要修改应用程序代码以指定该主机名和端口号。

Before you do that you will need to have a username and password, and create your data base ("arunsdata" or whatever) on the remote data base and create your tables and other schema items. 在执行此操作之前,您将需要具有用户名和密码,并在远程数据库上创建数据库(“ arunsdata”或其他内容),并创建表和其他架构项目。 The administrator of the remote database server can probably help you with this. 远程数据库服务器的管理员可能可以帮助您。

Good luck! 祝好运! I remember how confusing this was the first time I faced it. 我记得这是我第一次面对它,这真是令人困惑。 It's simpler than it seems. 它比看起来简单。

You should probably create a web service to access the remote mySQL server database. 您可能应该创建一个Web服务来访问远程mySQL服务器数据库。 You can then send a request to the service using NSMutableURLRequest. 然后,您可以使用NSMutableURLRequest向服务发送请求。 If you need to return data back, return json since its more light weight than XML. 如果您需要返回数据,请返回json,因为它的权重比XML轻。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM