MySQL Installation

From CLONWiki
Jump to navigation Jump to search

clondb1 is the primary MYSQL machine for CLAS Online databases, it is running MYSQL server and has database on its local disk in /database. All other CLON cluster machines have MYSQL installed but server should not be run there

Installation for RHEL4 machines with satelite service (type following as 'root'):

 up2date mysql
 up2date mysql-server

version 4.1.20 was obtained August 19, 2006; newer version can be installed if 'up2date' will be used in future; repeat that procedure on all Linux_i686 and Linux_x86_64 machines.

Installation for all other machines: Get tarball 'mysql-4.1.20.tar.gz' from http://www.mysql.com/ and place it to /usr/local/downloads on CLON fileserver

  gunzip mysql-4.1.20.tar.gz
 tar xvf mysql-4.1.20.tar
 mv mysql-4.1.20 mysql_SunOS_sun4u
 cd mysql_SunOS_sun4u
 ./configure --prefix=/usr
 gmake
 repeat for SunOS_i86pc, SunOS_sun4u, Linux_ppc

Login into every CLON cluster machine as 'root', goto /usr/local/clas/mysql_XXXXX_YYY directory and type 'gmake install'. It will install everything into /usr/bin, /usr/lib and /usr/include/mysql (same directories as on RHEL4)

Clondb1 preparations:

Login as 'root' and execute following commands:

 id mysql

you should see something like this:

 uid=27(mysql) gid=27(mysql) groups=27(mysql)

If 'mysql' user or group does not exist, create it. Specify desired database directory in '/etc/my.cnf':

 ###datadir=/var/lib/mysql
 datadir=/database

Make sure '/var/lib/mysql' directory has appropriate ownership (in our case basedir=/var/lib):

 drwxr-xr-x   2 mysql     mysql    4096 Jun  1 23:42 mysql

Modify '/etc/my.cnf' if neseccary.

Starting mysql server:

 cd /var/lib/mysql
 mysql_install_db --user=mysql

some useful instructions will be printed:

 To start mysqld at boot time you have to copy support-files/mysql.server
 to the right place for your system
 PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
 To do so, start the server, then issue the following commands:
 /usr/bin/mysqladmin -u root password 'new-password'
 /usr/bin/mysqladmin -u root -h clondb1.jlab.org password 'new-password'
 See the manual for more instructions.
 You can start the MySQL daemon with:
 cd /usr ; /usr/bin/mysqld_safe &
 You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
 cd sql-bench ; perl run-all-tests
 Please report any problems with the /usr/bin/mysqlbug script!
 The latest information about MySQL is available on the web at
 http://www.mysql.com
 Support MySQL by buying support/licenses at http://shop.mysql.com

Now start mysql deamon:

 cd /usr
 /usr/bin/mysqld_safe &

Make sure 'mysqld' is running:

 ps -ef | grep mysql
   root     23028 21947  0 20:54 pts/2    00:00:00 /bin/sh /usr/bin/mysqld_safe
   mysql    23053 23028  0 20:54 pts/2    00:00:00 /usr/libexec/mysqld --basedir=/usr --datadir=/database
      --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --socket=/var/lib/mysql/mysql.sock

Set mysql root password:

 /usr/bin/mysqladmin -u root password new-password
 /usr/bin/mysqladmin -u root -h clondb1.jlab.org password new-password

setting up replica

Full manual

Complete MYSQL manual can be found at http://dev.mysql.com/doc/refman/4.1/en/index.html.