I'm new to Linux. just studying php/mysql development. On windows I kept Apache, PHP, Mysql, PgSQL directories in one folder on SEPARATE DRIVE, like this:
D:\server
\mysql
\apache
\php
So - If I would to reinstall Windows - all I would have to do is start mysql and httpd services - and that's that. quick and easy. The same like XAMPP, except I don't need 20 extra apps that xammp give you.
I would love to do the same in Ubuntu. So I would keep apache,mysql,php on separate drive and start them whenever I want to (init.d or upstart to start them automatically).
so - the structure would be:
/media/storage/server
/media/storage/server/mysql
/media/storage/server/apache
/media/storage/server/php
I got everything compiled and setup aside from config files.
The problem is:
I want all config files to be in one place as well. I mean http.conf -in apache folder. my.cnf - in mysql folder
so - Question: How do I make MySQL load configuration file not from /etc/my.cnf, but from another arbitrary location. couldn't find this info anywhere..:(
important:
1)it's not a production server! It's just for someone who studyis web development and linux and doesn't want to keep reinstalling and reconfiguring server when he changes distros. 2) I know it's against Linux hierarchical standards. 3) I now about Ubuntu's tasksel lamp-server and/or XAMPP easinness:)
The easiest way to achieve your goals would probably be with simple symbolic links. Let the package create its configuration file wherever it wants to create them. Once that is done simply move the configuration files to where you want it, then create a symlink from the location where the package expect it to the folder where you want the config stored.
So if you installed the official mysql server package you would do something like this.
If you can commit to a single distribution for running your web stack then you may be able to make this easier on yourself by setting up a chroot environment. A chroot basically allows you to have a folder that has a self contained application and all the supporting libraries it needs. If you have the same architecure in multiple places you should be able to run things from that chroot on any system. Building a Debian/Ubuntu chroot is very easy I occasionally use it to allow me to have multiple different versions of a distro available on my system for testing things.
Read http://dev.mysql.com/doc/refman/5.1/en/option-files.html after