Installing Percona Server for MySQL on Debian and Ubuntu¶
Ready-to-use packages are available from the Percona Server for MySQL software repositories and the download page.
Specific information on the supported platforms, products, and versions is described in Percona Software and Platform Lifecycle.
What’s in each DEB package?¶
percona-server-server-5.6 package contains the database server itself, the
mysqld binary and associated files.
percona-server-common-5.6 package contains files common to the server and client.
percona-server-client-5.6 package contains the command line client.
percona-server-5.6-dbg package contains debug symbols for the server.
percona-server-test-5.6 package contains the database test suite.
percona-server-source-5.6 package contains the server source.
libperconaserverclient18.1-dev package contains header files needed to compile software to use the client library.
libperconaserverclient18.1 package contains the client shared library. The
18.1 is a reference to the version of the shared library. The version is incremented when there is a ABI change that requires software using the client library to be recompiled or its source code modified.
Installing Percona Server for MySQL from Percona
GnuPG, the GNU Privacy Guard:
$ sudo apt-get install gnupg2
Fetch the repository packages from Percona web:
$ wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
Install the downloaded package with dpkg. To do that, run the following commands as root or with sudo:
$ sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
Once you install this package the Percona repositories should be added. You can check the repository setup in the
Remember to update the local cache:
$ sudo apt-get update
After that you can install the server package:
$ sudo apt-get install percona-server-server-5.6
apt Testing repository¶
Percona offers pre-release builds from the testing repository. To enable it add the just uncomment the testing repository lines in the Percona repository definition in your repository file (default
/etc/apt/sources.list.d/percona-release.list). It should looks like this (in this example
VERSION is the name of your distribution):
$ sudo percona-release enable original testing
Apt-Pinning the packages¶
In some cases you might need to “pin” the selected packages to avoid the upgrades from the distribution repositories. You’ll need to make a new file
/etc/apt/preferences.d/00percona.pref and add the following lines in it:
Package: * Pin: release o=Percona Development Team Pin-Priority: 1001
For more information about the pinning you can check the official debian wiki.
Installing Percona Server for MySQL using downloaded deb packages¶
Download the packages of the desired series for your architecture from the download page. The easiest way is to download bundle which contains all the packages. Following example will download Percona Server for MySQL 5.6.25-73.1 release packages for Debian 8.0:
$ wget https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-5.6.25-73.1/binary/debian/jessie/x86_64/Percona-Server-5.6.25-73.1-r07b797f-jessie-x86_64-bundle.tar
You should then unpack the bundle to get the packages:
$ tar xvf Percona-Server-5.6.25-73.1-r07b797f-jessie-x86_64-bundle.tar
After you unpack the bundle you should see the following packages:
$ ls *.deb libperconaserverclient18.1-dev_5.6.25-73.1-1.jessie_amd64.deb libperconaserverclient18.1_5.6.25-73.1-1.jessie_amd64.deb percona-server-5.6-dbg_5.6.25-73.1-1.jessie_amd64.deb percona-server-client-5.6_5.6.25-73.1-1.jessie_amd64.deb percona-server-client_5.6.25-73.1-1.jessie_amd64.deb percona-server-common-5.6_5.6.25-73.1-1.jessie_amd64.deb percona-server-server-5.6_5.6.25-73.1-1.jessie_amd64.deb percona-server-server_5.6.25-73.1-1.jessie_amd64.deb percona-server-source-5.6_5.6.25-73.1-1.jessie_amd64.deb percona-server-test-5.6_5.6.25-73.1-1.jessie_amd64.deb percona-server-tokudb-5.6_5.6.25-73.1-1.jessie_amd64.deb
Now you can install Percona Server for MySQL by running:
$ sudo dpkg -i *.deb
This will install all the packages from the bundle. Another option is to download/specify only the packages you need for running Percona Server for MySQL installation (
When installing packages manually like this, you’ll need to make sure to resolve all the dependencies and install missing packages yourself.
Automating the Install Percona Server for MySQL using a non-interactive script¶
You can install Percona Server for MySQL with a non-interactive script using the following options:
debconf- The Debian package configuration system
DEBIAN_FRONTEND- an interface variable for
- debconf-set-selections - inserts values into the debconf database
If needed, you can return the contents of the debconf database with the following statement:
The following example script installs the server and secures the installation.
#!/bin/bash # variable for the root password dbpass="root" # Install the OS updates apt-get update && apt-get upgrade -y # Set the timezone to CST echo "America/Chicago" > /etc/timezone dpkg-reconfigure -f noninteractive tzdata # Install needed packages apt-get install gnupg2 apt-get install debconf-utils # Install noninteractive export DEBIAN_FRONTEND=noninteractive # Fetch the Percona repository wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb # Install the downloaded package with dpkg. dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb # Update the local cache apt-get update # Install essential packages apt-get -y install zsh htop # Install MySQL Server in a Non-Interactive mode. Default root password will be "root" debconf-set-selections <<< "percona-server-server-5.6 percona-server-server/root_password password root" debconf-set-selections <<< "percona-server-server-5.6 percona-server-server/root_password_again password root" apt-get -y install percona-server-server-5.6 # SQL statements to secure the installation mysql -uroot -p"$dbpass"<< EOF_MYSQL UPDATE mysql.user SET Password = PASSWORD("$dbpass") WHERE USER='root'; DELETE FROM mysql.user WHERE User=''; DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1'); DROP DATABASE IF EXISTS test; DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'; FLUSH PRIVILEGES; EOF_MYSQL service mysql stop service mysql start
The following table lists the default locations for files:
Running Percona Server for MySQL¶
Percona Server for MySQL stores the data files in
/var/lib/mysql/ by default. You can find the configuration file that is used to manage Percona Server for MySQL in
/etc/mysql/my.cnf. Debian and Ubuntu installation automatically creates a special
debian-sys-maint user which is used by the control scripts to control the Percona Server for MySQL
mysqld_safe services. Login details for that user can be found in
Starting the service
Percona Server for MySQL is started automatically after it gets installed unless it encounters errors during the installation process. You can also manually start it by running:
$ sudo service mysql start
Confirming that service is running
You can check the service status by running:
$ service mysql status
Stopping the service
You can stop the service by running:
$ sudo service mysql stop
Restarting the service
You can restart the service by running:
$ sudo service mysql restart
Debian 8.0 (jessie) and Ubuntu 15.04 (vivid) come with systemd as the default system and service manager so you can invoke all the above commands with
sytemctl instead of
service. Currently both are supported.
Uninstalling Percona Server for MySQL¶
To uninstall Percona Server for MySQL you’ll need to remove all the installed packages. Removing packages with apt-get remove will leave the configuration and data files. Removing the packages with apt-get purge will remove all the packages with configuration files and data files (all the databases). Depending on your needs you can choose which command better suits you.
Stop the Percona Server for MySQL service
$ sudo service mysql stop
Remove the packages
- Remove the packages. This will leave the data files (databases, tables, logs, configuration, etc.) behind. In case you don’t need them you’ll need to remove them manually.
$ sudo apt-get remove percona-server*
- Purge the packages. NOTE: This will remove all the packages and delete all the data files (databases, tables, logs, etc.)
$ sudo apt-get purge percona-server*