Tuesday, July 25, 2017

Using MySQL with LVM

After configuring your system to support LVM you can install MySQL to use this partition.

NOTE: These instructions can be used to install MySQL with or without the LVM partition.

These instructions are for installing MySQL 5.5 (current production version) on Ubuntu 11.04. Some operating system commands may differ between versions of Linux.

Depending on your operating system and installed libraries you may need the Asynchronous I/O library installed. This is a new dependency for InnoDB, which can be disabled if necessary.. If you see an error like:

/mysql/mysql/bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

You need to install the appropriate library:

$ sudo apt-get install libaio1

The following steps install the current Linux Binary version of MySQL. These commands reference a particular point release, which may change overtime. The mysql.com site provides no simple link to the latest version for version independent instructions.

sudo useradd -m -g mysql -s /bin/bash mysql
sudo mkdir -p /mysql /var/run/mysql
sudo chown mysql:mysql /mysql  /var/run/mysql
sudo su - mysql

cd /mysql
wget http://mysql.mirrors.hoobly.com/Downloads/MySQL-5.5/mysql-5.5.15-linux2.6-x86_64.tar.gz
tar xvfz mysql-5.5.15-linux2.6-x86_64.tar.gz
#mv mysql-5.5.15-linux2.6-x86_64.tar.gz /some/archive/dir
ln -s mysql-5.5.15-linux2.6-x86_64 mysql
mkdir -p log binlog data etc
chmod 700 data binlog
chmod 750 log
chmod 755 etc
vi etc/my.cnf
export MYSQL_HOME=/mysql/mysql
scripts/mysql_install_db --defaults-file=/mysql/etc/my.cnf
bin/mysqld_safe --defaults-file=/mysql/etc/my.cnf &
ps -ef | grep mysql
bin/mysql -uroot -e "SELECT VERSION()"
bin/mysqladmin -uroot shutdown
rm -rf mysql-test sql-bench data
cd /mysql/etc
vi mysql.sh
chmod +x mysql.sh