Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

3 Answers

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/new_mysql.pid
  • --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: http://dev.mysql.com/doc/refman/5.1/en/multiple-servers.html

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
add comment

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
add comment

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 192.168.1.2
--port 3307
share|improve this answer
add comment

Your Answer

 
discard

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.