Take the 2-minute tour ×

I have a winform application written in C#. My database stands in MySql. Now i wanted it to deploy on other machines without having to install mysql individually/saperately on each machine. Please suggest me ways i could include my MySql database with the application in one installer without having to install mysql on each machine. Alternatively if its not possible in MySql i could migrate it in Sqlite. Please point me to relevant resources.

I have seen similar questions on this board before but none of them was clear in their solutions.


share|improve this question
add comment

2 Answers

When faced with a similar situation I simply included a MySQL distribution with the application (this was for internal purposes, you may need a license to distribute MySQL commercially).

Here's what I did:

  • I installed a MySQL server on a local machine. I configured it so that the data folder and the configuration file reside in the same folder as the rest of the MySQL server. I then created the database, an user, and filled the database with relevant data.
  • I included the entire MySQL folder in the installer. The installer would simply copy this folder to the application's destination folder.
  • I could then start MySQL like this: {app_folder}\mysql\bin\mysqld.exe --defaults-file="{app_folder}\my.ini". To stop MySQL I used: {app_folder}\mysql\bin\mysqladmin.exe -u youruser -p yourpassword shutdown. You could have your application check if MySQL is running and start it if not.

This might not be the best solution since anyone could easily access the database. Also I cannot confirm if this would work with the current versions of MySQL (you may need to specify the data folder in the configuration file). If the database is only used by your application SQLite might be a better option.

share|improve this answer
add comment

If I understand your question you could use the "Prerequisites in Windows Installer Deployment"

So you add mysql installer as prerequisities and after you can install your application and execute the script for the Database creation and other resource like Table, Views and Stored Procedure.

This tutorial can help you on the second step.

share|improve this answer
add comment

Your Answer


