Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There's a Linux server in our data center that already has MySQL installed in the default location. Is it possible to install my own personal MySQL instance, say in my ~/ directory?

If so, do you know of any instructions on the web for doing this?

share|improve this question

Absolutely. At a minimum, you should start MySQL with the following 4 options (set how you need them, of course):

  • --port 3307
  • --socket /var/tmp/new_mysql.sock
  • --pidfile /var/run/
  • --datadir /home/myuserid/dbdir

You should also be able to set those values in a new my.cnf file and point the new instance at that my.cnf file when it starts.

Here's the MySQL reference about doing this:

share|improve this answer
Good answer... I haven't used mysql in a while. But while starting MySQL, one has to specify the location of my.cnf file though, correct? – Nikolas Sakic Oct 16 '09 at 17:52
Right - everything can be specified in my.cnf. You use the MYSQL_HOME environment variable to specify which my.cnf file to use. From the MySQL manual: MYSQL_HOME is an environment variable containing the path to the directory in which the server-specific my.cnf file resides. – baumgart Oct 20 '09 at 2:28

I'm not sure if you want to install your own binaries or just run a separate server.

To run a separate server, MySQL has a handy chapter in it's manual regarding Running Multiple Servers on Unix.

If you want to compile your own binaries, there is nothing stopping you from compiling your own binaries and running them with your own options (to avoid port collision, etc).

share|improve this answer

I can't comment yet, so I'm posting this as an answer. :( To add to what baumgart said, you'll have to keep in mind that when using mysql client programs you need to specify which server to connect to.

One caveat is that:

mysql -uroot -p --port 3307

Does not connect to 3307 on localhost. If you do not specify an IP, it uses the socket file it was compiled with -- that is, the socket file of the default system install.

Either connect via socket using:

mysql -uroot -p --socket=/var/tmp/new_mysql.sock

Or via TCP using:

mysql -uroot -p --host
--port 3307
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.