如何使用Mysql数据库部署我的应用程序? [英] How Can I Deploy My Application With Mysql Database?

查看:127
本文介绍了如何使用Mysql数据库部署我的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用与MYSQL上的数据库连接的visual studio c#创建了一个应用程序。现在我正处于应用程序设置阶段。我有一个问题,安装应用程序的人/客户端需要MYSQL吗?如何将MYSQL文件附加到应用程序。有没有办法让客户端可以在不安装MYSQL的情况下运行应用程序。

请帮忙。我是这个环境的新手。请帮助

i have created an application using visual studio c# connected with the database on MYSQL. Now i am at the app setup stage. I have one question does the person/client installing the application requires MYSQL? How can i attach MYSQL files to the application. Is there any way that a client can run the app without installing MYSQL.
Please help. I am new to this environment. please help

推荐答案

如果您在应用程序中使用MySql数据库,则需要从运行该应用程序的每台PC访问MySQL数据库服务器。 br />


通常情况下,这将由用户单独安装,因为增加任何数据库服务器是一个坏主意。



如果您没有使用数据库进行多用户访问,则不要使用基于服务器的系统(如MySql或Sql Server) - 使用基于单个用户的数据库,而不需要任何其他安装。 SqLite,SQLCE,甚至Access都很好。
If you are using a MySql database in your application, then a MySQL database server needs to be accessible from each PC that is to run the app.

Normally, this would be installed separately by the user, as proliferating any database server is a bad idea.

If you are not using the database for multi-user access, then do not use a server based system (like MySql or Sql Server) - use a single user based database instead which does not require any additional installation. SqLite, SQLCE, or even Access are all fine.


您好,



您至少有3个选择:

1.在客户端的计算机上安装MySQL数据库服务器

2.在位于其局域网内的客户端计算机上安装MySQL数据库服务器

3.使用MySQL数据库服务器安装在外部主机上并通过互联网连接



选择第一个或第二个选项是好的,如果您的应用程序将由LAN上的一个或多个用户使用而无法从互联网访问。

如果您计划通过互联网从不在一个网络内的不同办公室连接到数据库,则第三个选项很好。



IMO最佳选择部署数据库是通过创建安装脚本并在安装应用程序时或在应用程序首次运行时从该脚本生成数据库。据我所知,您可以使用MySQL Workbench应用程序生成该脚本(链接如下)或PHPMyAdmin。



链接:

http://dev.mysql.com/doc/workbench/en/index.html [<一个href =http://dev.mysql.com/doc/workbench/en/index.htmltarget =_ blanktitle =新窗口> ^ ]



[评论更新]

这取决于你如何知道如何连接到MySQL服务器。如果您在代码中提供了连接信息(host / dbname / user / pass),则必须修改应用程序。您可以添加配置窗口以允许用户输入连接配置,然后将其存储在配置文件中。在应用程序启动时读取该文件并动态构建数据库连接字符串。如果缺少配置文件或该文件中不存在连接信息,则可以显示数据库配置窗口,并且在用户提供必要数据之前不允许用户运行您的应用程序。记得加密配置文件中的DB密码!



我希望它可以帮到你。
Hi,

You have at least 3 choices:
1. Install MySQL DB server on client's computer
2. Install MySQL DB server on client's computer located within his Local Area Network
3. Use MySQL DB server installed on external hosting and connect via internet

Chosing first or second option is good if your app will be used by one or more users on LAN without access from internet.
Third option is good if you are planning to connect to database over internet from different offices not located within one network.

IMO best option to deploy database is by creating install scripts and generate database from that script while installing your app or on app's first run. As far as I know you can use MySQL Workbench application to generate that script (link below) or PHPMyAdmin.

Link:
http://dev.mysql.com/doc/workbench/en/index.html[^]

[Update for a comment]
It depends on how you know how to connect to MySQL server. If you provided connection info (host/dbname/user/pass) inside your code you will have to modify your application. You can add configuration window to allow user enter connection configuration and then store it in configuration file. On app startup read that file and dynamically build you database connection string. If configuration file is missing or connection info is not present in that file you can display DB configuration window and not let user run your app until he provide necessery data. Remember to encrypt DB password in configuration file!

I hope it help you.


这篇关于如何使用Mysql数据库部署我的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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