Mysql

MySQL

  • MySQL can be ran on CRC sytems utilizing the singularity container system. MySQL is currently restricted to running on one node at a time. Note that running a database application on a shared file system such as AFS is not reccomended, the following solution is provided with limited support.

Preparing environment

  • To use MySQL, your AFS enviornment must be prepped. First, and note that you'll only have to do this once, create a mysql directory and obtain a copy of the helper scripts
 $ mkdir -p ${HOME}/mysql/var/lib/mysql
 $ cp -r ~ckankel/mysql/bin ~/mysql/bin
  • Add the ~/mysql/bin directory to your PATH. Perform the following depending on which shell you are using. Use the following command to determine your shell:
 $ echo $0

Bash

  • Add ~/mysql/bin to your path through:
 $ echo "export PATH=$PATH\:$HOME/mysql/bin" >> ~/.bashrc
 $ source ~/.bashrc

Tcsh / Cshell

  • Add ~/mysql/bin to your path through:
 $ echo "setenv PATH $PATH\:$HOME/mysql/bin" >> ~/.cshrc
 $ source ~/.cshrc


Starting MySQL

Once logged into a node or front end where you plan on using MySQL, perform the following. You will need to do this each time you plan on using MySQL.

  • Setup the MySQL daemon and process, pay attention to the brief messages which may appear:
 $ setup_MySQL.sh
  • You can now run the mysql command to communicate with the database:
 $ mysql
 Welcome to the MySQL monitor.  Commands end with ; or \g.
 Your MySQL connection id is 3
 Server version: 5.7.21 MySQL Community Server (GPL)
 
 Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
 
 Oracle is a registered trademark of Oracle Corporation and/or its
 affiliates. Other names may be trademarks of their respective
 owners.
 
 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
 mysql>

Cleaning up

When finished procesing within MySQL, you must run the stop_mysql command to cleanup the database:

 $ stop_mysql
 Stopping mysql instance of /tmp/$USER/mysql.simg (PID=XXXXX)
 Removing /tmp directories . . .

All data will continue to reside in your AFS space. The next time MySQL is needed, run the commands described in Starting MySQL above.

Starting over

It is very easy to start over with a fresh database. If you want to completely wipe out your database, run the bulldoze_mysql command:

 $ bulldoze_mysql
 Do you really want to remove the data files?
 [Y/N]: y
 Removing data files . . .

You can then run the setup_MySQL.sh command to start over.