2

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?

3 Answers 3

2

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

2
  • 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? Oct 16, 2009 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, 2009 at 2:28
0

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).

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .