This sounds dumb but say you have written a program that uses MySQL on localhost. Now you want to ship this software to your customers. How do you go about installing MySQL on their computer? Of course the login information should also have to be included in the installation and all the databases and everything else. How is that done?
Posted on 2009-01-01 17:28:21 by XCHG
I know it's not an answer to your question, but: if you're only using the database locally, you might want to consider SQLite instead of MySQL - it links statically instead of requiring a separate database daemon.
Posted on 2009-01-01 17:36:53 by f0dder
Yeah it's too late to do that now. I don't like SQLite. It's really bad. The one that we used on the iPhone didn't even let us do ALTER TABLE and that causes us a lot of problems.
Posted on 2009-01-01 17:45:42 by XCHG
IMHO SQLite is pretty decent, but it isn't as feature-complete as MySQL or Postgres - and it isn't meant to replace them :) - but where it works, it's pretty fast and hassle-free.

What is it that causes you trouble wrt. installation of MySQL? Figuring out what to install, or how to automate the process?
Posted on 2009-01-01 17:52:03 by f0dder
1.) If MySQL isn't installed, you don't want to annoy users with extra/useless steps, or bog down the machine with running MySQL as a service when it isn't really needed.
2.) If MySQL is already installed (as a service), chances are that it isn't desired for your program to be accessing that database.
3.) Even if you did utilize a service-based MySQL server, you still have to ensure that it is running prior to executing your main program.
4.) Considering point 3, you will probably want your program to be able to start/stop the MySQL server on demand.
5.) Considering point 4, it makes it impractical to share such a MySQL server instance.

The above five points conclude a suggestion of utilizing a stand-alone version of MySQL server that is distributed with your program.

Also, I would using named pipes or sockets instead of TCP/IP, so that there aren't any port conflicts or unpleasant surprises.

It is a bit of extra work to achieve, but it will probably make things easier in the long run.
Posted on 2009-01-01 18:32:28 by SpooK

The above five points conclude a suggestion of utilizing a stand-alone version of MySQL server that is distributed with your program.

Also, I would using named pipes or sockets instead of TCP/IP, so that there aren't any port conflicts or unpleasant surprises.

It is a bit of extra work to achieve, but it will probably make things easier in the long run.


Yeah that's what I really want to do. To ship a version of MySQL with my program. I had seen programs before which when installed, also installed MySQL on your computer by you were not notified of any additional setup steps for MySQL. So I think that's more convenient than executing MySQL's setup on the user's computer prior to your software's setup. How do we do that?

I was also thinking if MySQL had to necessarily be set up rather than just copied and pasted over on a targer folder? Because if we can do that without having to install MySQL, we could just create the MySQL folder in our setup folder and when your program is set up, we could copy the MySQL folder into the user's Program Files directory or somewhere else and eventually run the MySQLD service ourselves.
Posted on 2009-01-04 04:35:11 by XCHG
XCHG: as per SpooK's points, if you want the whole process to be automatic and no extra MySQL installation steps, please install MySQL to a subfolder of your programs install folder, and not %ProgramFiles%\MySQL. You don't want to "junk up" the user's machine.
Posted on 2009-01-04 15:21:43 by f0dder

XCHG: as per SpooK's points, if you want the whole process to be automatic and no extra MySQL installation steps, please install MySQL to a subfolder of your programs install folder, and not %ProgramFiles%\MySQL. You don't want to "junk up" the user's machine.


So that means MySQL doesn't necessarily have to be installed on the user's computer right? So When MySQL is installed, it won't put any extra DLL/EXE/ETC folders anywhere else in the computer except for its own folder, huh?
Posted on 2009-01-05 04:59:04 by XCHG


XCHG: as per SpooK's points, if you want the whole process to be automatic and no extra MySQL installation steps, please install MySQL to a subfolder of your programs install folder, and not %ProgramFiles%\MySQL. You don't want to "junk up" the user's machine.

So that means MySQL doesn't necessarily have to be installed on the user's computer right? So When MySQL is installed, it won't put any extra DLL/EXE/ETC folders anywhere else in the computer except for its own folder, huh?

I don't know about that - but I'd try installing MySQL, copying the installed files "somewhere else", uninstalling MySQL, and see if the "somewhere else" files can be used to start it. You might want to test this on a virtual machine, just to make sure there's no residue left behind after uninstall. If it does install DLLs to other places, hunt those down (sysinternals' process monitor ftw) and put them along with the files in the "somewhere else" place.

The above should work just fine - the challenge will be whether MySQL uses globally stored configuration (whether registry or %AppData%) - if it does, you risk screwing up existing installs.
Posted on 2009-01-05 12:03:26 by f0dder
I've seen/done it before. A "mysql" sub-folder with a proper my.cnf will do just fine... "mysqld-nt.exe --standalone" will take care of the rest ;)

Obviously, the above suggestion is Windows NT centric.
Posted on 2009-01-05 20:01:25 by SpooK