Installing DIF in an additional MySQL server -------------------------------------------- LN@IASF-INAF, 29 August 2012 Note: We suggest to deinstall any MySQL server and replace it with a version compiled from source, but if you really need to keep it then can follow these instructions to run multiple servers. At the moment only MySQL 5.1 is supported. Please also see: - file INSTALL-SOURCE in the root dir of the source distribution! - http://dev.mysql.com/doc/refman/5.1/en/multiple-servers.html - http://dev.mysql.com/doc/refman/5.1/en/multiple-unix-servers.html Step 1: Get, compile and install MySQL 5.1 (e.g. 5.1.65) Go to /path/to/source/mysql-5.1.65 Configure and compile: ./configure --prefix=/usr/local/mysql make Become root and: make install Step 2: Configure environment and server PATH=/usr/local/mysql/bin:$PATH:$HOME/bin export PATH (this is for bash. In tcsh you can use "set path" or "setenv PATH") Check user mysql exists. If not create it: id mysql Eventually: groupadd mysql useradd -r -g mysql mysql Install default DBs: ./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/var --srcdir=$PWD SEE PRINTED MESSAGES! Note: 1. To start/stop MySQL sever at boot/shutdown: cp support-files/mysql.server /etc/init.d/mysql.server chmod 755 /etc/init.d/mysql.server Depending on your system this could not be sufficient. Check your system on how to start/stop services. 2. To handle the configuration cp support-files/my-medium.cnf /usr/local/mysql/my.cnf - Check which of the various my-xyz.cnf files matches your needs and eventually create a custom one. - Check and change conflicting info in /usr/local/mysql/my.cnf vs /etc/my.cnf like socket port number and location which must be different. e.g. set "port = 13306" in /usr/local/mysql/my.cnf Note: port number and socket could have been defined via configure, e.g. ./configure --with-tcp-port=port_number \ --with-unix-socket-path=file_name \ --prefix=/usr/local/mysql 3. Eventually edit /etc/init.d/mysql.server to force the usage of /usr/local/mysql/my.cnf i.e. change extra_args="-e $basedir/my.cnf" into extra_args="-c $basedir/my.cnf" Manually start the server either via mysql.server or via mysqld_safe, e.g. /etc/init.d/mysql.server start or mysqld_safe --defaults-file=/usr/local/mysql/my.cnf Set password for MySQL root user: /usr/local/mysql/bin/mysqladmin -u root password 'the_password' Step 3: Exit from root shell and try to login MySQL as root: 1. First set your PATH to include the new bin dir. bash: PATH=/usr/local/mysql/bin:$PATH:$HOME/bin export PATH tcsh: set path = (/usr/local/mysql/bin $path) If you want that all users have this PATH, check your system on how to do it or inform users to update it. 2. Verify you are using the correct client which mysql /usr/local/mysql/bin/mysql mysql_config ... mysql -u root -p Enter password: ... Server version: 5.1.65-log Source distribution ... mysql> exit; Now, eventually, can stop the server: /etc/init.d/mysql.server stop (as root) or mysqladmin -u root -p shutdown Step 4: To force the usage by other packages of the compiled libraries and includes: 1. As root add (or edit) /etc/ld.so.conf.d/mysql.conf inserting the line /usr/local/mysql/lib/mysql 2. update ld info ldconfig /usr/local/mysql/lib/mysql Final notes: When compiling (and istalling as user root) DIF, make sure the PATH variable is set as above to properly point to the /usr/local/mysql/bin dir. Then ./configure --with-mysql-source=/path/to/source/mysql-5.1.65 make make install (as root with correct PATH set) We also suggest to disable bin logging (in my.cnf) if you are going to manage large tables as this will save disk space and make the data insertion faster.