Installing Percona Server for MySQL 8 on Debian and Ubuntu
Ready-to-use packages are available from the Percona Server for MySQL software repositories and the Percona downloads page.
Specific information on the supported platforms, products, and versions is described in Percona Software and Platform Lifecycle.
What’s in each DEB package?
Package | Contains |
---|---|
percona-server-server | The database server itself, the mysqld binary and associated files. |
percona-server-common | The files common to the server and client. |
percona-server-client | The command line client. |
percona-server-dbg | Debug symbols for the server. |
percona-server-test | The database test suite. |
percona-server-source | The server source. |
libperconaserverclient21-dev | Header files needed to compile software to use the client library. |
libperconaserverclient21 | The client shared library. The version is incremented when there is an ABI change that requires software using the client library to be recompiled or its source code modified. |
Installing Percona Server for MySQL from Percona apt repository
Install GnuPG, the GNU Privacy Guard:
1 |
$ sudo apt-get install gnupg2 |
Fetch the repository packages from Percona web:
1 |
$ wget https://repo.percona.com/apt/percona-release_latest.<span class="k">$(</span>lsb_release -sc<span class="k">)</span>_all.deb |
Install the downloaded package with dpkg. To do that, run the following commands as root or with sudo:
1 |
$ sudo dpkg -i percona-release_latest.<span class="k">$(</span>lsb_release -sc<span class="k">)</span>_all.deb |
Once you install this package the Percona repositories should be added. You can check the repository setup in the/etc/apt/sources.list.d/percona-release.list file.
Enable the repository:
1 |
$ sudo percona-release setup ps80 |
After that you can install the server package:
1 |
$ sudo apt-get install percona-server-server |
Note
Percona Server for MySQL 8.0 comes with the TokuDB storage engine and MyRocks storage engine. These storage engines are installed as plugin.
For information on how to install and configure TokuDB, refer to the TokuDB Installation guide.
For information on how to install and configure MyRocks, refer to the Percona MyRocks Installation Guide guide.
The Percona Server for MySQL distribution contains several useful User Defined Functions (UDF) from Percona Toolkit. After the installation completes, run the following commands to create these functions:
1 2 3 |
mysql -e <span class="s2">"CREATE FUNCTION fnvla_64 RETURNS INTEGER SONAME 'libfnvla_udf.so'"</span> mysql -e <span class="s2">"CREATE FUNCTION fnv_64 RETURNS INTEGER SONAME 'libfnv_udf.so'"</span> mysql -e <span class="s2">"CREATE FUNCTION murmur_hash RETURNS INTEGER SONAME 'libmurmur_udf.so'"</span> |
For more details on the UDFs, see Percona Toolkit UDFS.
Percona apt Testing repository
Percona offers pre-release builds from the testing repository. To enable it, run percona-release with the testing argument. Run this command as root or by using the sudo command.
1 |
$ sudo percona-release <span class="nb">enable</span> ps80 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:
1 2 3 |
<span class="n">Package</span><span class="p">:</span> <span class="o">*</span> <span class="n">Pin</span><span class="p">:</span> <span class="n">release</span> <span class="n">o</span><span class="o">=</span><span class="n">Percona</span> <span class="n">Development</span> <span class="n">Team</span> <span class="n">Pin</span><span class="o">-</span><span class="n">Priority</span><span class="p">:</span> <span class="mi">1001</span> |
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 Percona downloads page. The easiest way is to download bundle which contains all the packages. The following example will download Percona Server for MySQL 8.0.13-3release packages for Debian 9.0 (stretch):
1 |
$ wget https://www.percona.com/downloads/Percona-Server-8.0/Percona-Server-8.0.13-3/binary/debian/stretch/x86_64/percona-server-8.0.13-3-r63dafaf-stretch-x86_64-bundle.tar |
You should then unpack the bundle to get the packages:
1 |
$ tar xvf percona-server-8.0.13-3-r63dafaf-stretch-x86_64-bundle.tar |
After you unpack the bundle you should see the following packages:
1 |
$ ls *.deb |
Output
1 2 3 4 5 6 7 8 9 |
libperconaserverclient21-dev_8.0.13-3-1.stretch_amd64.deb libperconaserverclient21_8.0.13-3-1.stretch_amd64.deb percona-server-dbg_8.0.13-3-1.stretch_amd64.deb percona-server-client_8.0.13-3-1.stretch_amd64.deb percona-server-common_8.0.13-3-1.stretch_amd64.deb percona-server-server_8.0.13-3-1.stretch_amd64.deb percona-server-source_8.0.13-3-1.stretch_amd64.deb percona-server-test_8.0.13-3-1.stretch_amd64.deb percona-server-tokudb_8.0.13-3-1.stretch_amd64.deb |
Now, you can install Percona Server for MySQL using dpkg. Run this command as root or by using the sudo command
1 |
$ 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 (libperconaserverclient21_8.0.13-3-1.stretch_amd64.deb, percona-server-client_8.0.13-3-1.stretch_amd64.deb, percona-server-common_8.0.13-3-1.stretch_amd64.deb, and percona-server-server_8.0.13-3-1.stretch_amd64.deb. Optionally, you can install percona-server-tokudb_8.0.13-3-1.stretch_amd64.deb if you want the TokuDB storage engine).
Note: Percona Server for MySQL 8.0 comes with the TokuDB storage engine. You can find more information on how to install and enable the TokuDB storage in the TokuDB Installation guide.
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.
Note :Debian and Ubuntu installation doesn’t automatically create a special debian-sys-maint user which can be used by the control scripts to control the Percona Server for MySQL mysqld and mysqld_safe services like it was the case with previous Percona Server for MySQL versions. If you still require this user you’ll need to create it manually.
Run the following commands as root or by using the sudo command
- 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: 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: service mysql stop
- Restarting the service. service mysql restart
Note: Debian 9.0 (stretch) and Ubuntu 18.04 LTS (bionic) come with systemd as the default system and service manager. You can invoke all the above commands with systemctl 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 removewill leave the configuration and data files. Removing the p ackages 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: 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: 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.): apt-get purge percona-server*