Building/running MySQL on your AFS space

Building/running MySQL on your AFS space

This page utilizes tools which are only available for versions < 6 of MySQL. For newer versions, see Mysql

1) Obtain MySQL source code from:

   http://dev.mysql.com/downloads/mysql/

   ==> at "Select Platform", choose "Source Code" and then download "Generic Linux (Architecture Independent), Compressed TAR Archive" at the bottom.
   ==> at the download page select "No thanks, just start my download." 
Mysql.jpg

2) tar -zxvf mysql-X.Y.Z.tar.gz

3) module load cmake

4) Create MySQL installation directory and its subdirectrories:

  mkdir $HOME/MySQL
  mkdir $HOME/MySQL/data
  mkdir $HOME/MySQL/etc
  mkdir $HOME/MySQL/tmp
  mkdir $HOME/boost

and

  mkdir /tmp/$USER  (==> For example, /tmp/crcuser will be created)

5) cd mysql-X.Y.Z

6) Configure/install MySQL with some options. Installation should take approximately 35-40 minutes:

  cmake -DMYSQL_DATADIR=$HOME/MySQL/data -DSYSCONFDIR=$HOME/MySQL/etc -DCMAKE_INSTALL_PREFIX=$HOME/MySQL -DWITH_INNOBASE_STORAGE_ENGINE=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=$HOME/boost \
  -DMYSQL_UNIX_ADDR=/tmp/$USER/mysql.sock .
  make
  make install

7) Prepare/create base MySQL database tables:

   setenv PATH $HOME/MySQL/bin:$HOME/MySQL/scripts:$PATH

   mysql_install_db --basedir=$HOME/MySQL --datadir=$HOME/MySQL/data --tmpdir=$HOME/MySQL/tmp --user=$USER

==> This will create "my.cnf" in the base directory ($HOME/MySQL). If not, copy it from $HOME/MySQL/support-files:

  cp $HOME/MySQL/support-files/my-default.cnf $HOME/MySQL/my.cnf

8) Edit the my.cnf file and add below lines, for example:

   basedir = /afs/crc.nd.edu/user/c/crcuser/MySQL
   datadir = /afs/crc.nd.edu/user/c/crcuser/MySQL/data
   ...
  
   socket = /tmp/crcuser/mysql.sock 

==> Attention !!!!

*** The full path name should be added explicitly.

9) Start/stop the MySQL server - Download script file

    i)  Download this file and move into $HOME/MySQL/scripts/ directory and unzip the zip file

             unzip Crc-mysql.server.zip

   ii) Execute the command: 
  setenv PATH $HOME/MySQL/bin:$HOME/MySQL/scripts:$PATH


   ii) To start/stop the MySQL server:

            crc-mysql.server start
            crc-mysql.server stop

10) To load the MySQL client:

  mysql
  mysql> help
  mysql> show databases ;