MySQL

Upgrade MySQL version on Debian 7/8

  1. Download the MySQL APT repository config tool (you can see more details and the latest version of the tool here: http://dev.mysql.com/downloads/repo/apt/)
    wget https://dev.mysql.com/get/mysql-apt-config_0.8.9-1_all.deb
  2. Install the MySQL APT repository config tool
    dpkg -i mysql-apt-config_0.8.9-1_all.deb

    You will be asked to select product and version that you want to install. In the first step, select Server and next select either mysql-5.6 or mysql-5.7. Then click Apply.

  3. Update APT
    apt-get update
  4. Install the server
    apt-get install mysql-server
  5. Set the data directory in /etc/mysql/mysql.conf.d/mysqld.cnf, restart the server and run the table upgrade utility
    /etc/init.d/mysql restart
    mysql_upgrade -u<user> -p

Install MariaDB on Debian 7/8

  1. Uninstall mysql with
    sudo apt-get remove --purge mysql\*
  2. Install APT repository sources
    sudo apt-get install software-properties-common
    sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
    sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://www.ftp.saix.net/DB/mariadb/repo/10.1/debian  jessie main'
  3. Install MariaDB server
    sudo apt-get update
    sudo apt-get install mariadb-server
  4. Install phpmyadmin and php5-mysql which got uninstalled when uninstalling mysql
    apt-get install phpmyadmin
  5. Modify configuration file /etc/mysql/my.cnf and set path to data directory
  6. Restart server and run mysql-upgrade
    /etc/init.d/mysql restart
    mysql-upgrade
  7. login to the server (command line or phpmyadmin) and set the password of user debian-sys-maint to the one stored in /etc/mysql/debian.cnf
  8. Install MySQLTuner
    wget https://github.com/major/MySQLTuner-perl/tarball/master
    tar xf master
    cd major-MySQLTuner-perl-993bc18/
    ./mysqltuner.pl

Links