Last Updated: February 25, 2016
·
7.63K
· subicura

ubuntu / Installing MySQL 5.6.x from source

http://dev.mysql.com/doc/refman/5.6/en/installing-source-distribution.html

  • root user
sudo -i
  • preconfiguration setup
apt-get install -y cmake build-essential libreadline6-dev libncurses5-dev
groupadd mysql
useradd -r -g mysql mysql
mkdir -p /usr/local/src/mysql
cd /usr/local/src/mysql
wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.10.tar.gz
tar xvfz mysql-5.6.10.tar.gz
cd mysql-5.6*
rm CMakeCache.txt
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.6.10 \
-DWITH_INNOBASE_STORAGE_ENGINE=1\
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DSYSCONFDIR=/etc \
.
make
make install
ln -s /usr/local/mysql-5.6.10 /usr/local/mysql
  • postinstallation setup
cd /usr/local/mysql

cp ./support-files/my-default.cnf /etc/my.cnf
echo "character-set-server = utf8" >> /etc/my.cnf
echo "collation-server = utf8_general_ci" >> /etc/my.cnf
echo "character-set-client-handshake = false" >> /etc/my.cnf

chown -R root .
chgrp -R mysql .
chown -R mysql data

scripts/mysql_install_db --user=mysql
  • run
bin/mysqld_safe --user=mysql &
bin/mysqladmin -u root password 'new-password'
  • init.d shell
cp support-files/mysql.server /etc/init.d/mysql.server
ln -s /etc/init.d/mysql.server /etc/rc2.d/S90mysql
  • path
echo "export PATH=/usr/local/mysql/bin:$PATH" >> /etc/profile
  • check my.cnf

if /etc/mysql/my.cnf file exists, sudo /etc/mysql/my.cnf /etc/mysql/my.cnf.old