At the time of writing, Ubuntu 18.04 LTS is relatively newer. Those who are using Ubuntu 16.04 LTS, eventually will need to upgrade to Ubuntu 18.04 LTS. Here is the Tested Steps to Install Percona MySQL Server on Ubuntu 18.04 LTS For Cloud Server, VPS and Dedicated Server. If you are reading this guide many months after publication, you should check the URLs of the repository mentioned in our guide to grab the latest version.
Steps to Install Percona MySQL Server on Ubuntu 18.04 LTS
We have the official Percona Apt repo here :
1 | https://repo.percona.com/apt/ |
At the time of publication of this guide, bottom of the list contains :
---
1 2 3 4 5 6 7 8 | ... percona-release_0.1-6.artful_all.deb 21-May-2018 15:36 7582 percona-release_0.1-6.bionic_all.deb 21-May-2018 15:37 7628 percona-release_0.1-6.jessie_all.deb 21-May-2018 15:36 7832 percona-release_0.1-6.stretch_all.deb 21-May-2018 15:39 7602 percona-release_0.1-6.trusty_all.deb 21-May-2018 15:36 7554 percona-release_0.1-6.wheezy_all.deb 21-May-2018 15:39 7774 percona-release_0.1-6.xenial_all.deb 21-May-2018 15:36 7566 |
0.1-6
is a required number for now. We have to fetch the repository packages from Percona’s that repo using that number :
1 | wget https://repo.percona.com/apt/percona-release_0.1-6.$(lsb_release -sc)_all.deb |
Thereafter, we have to install the downloaded package with dpkg
:
1 | dpkg -i percona-release_0.1-4.$(lsb_release -sc)_all.deb |
If we run a cat on /etc/apt/sources.list.d/percona-release.list
, we can see the content :
1 | cat /etc/apt/sources.list.d/percona-release.list |
That should show the Percona repositories as added. Next, we will install Percona Server 5.7 :
1 2 | sudo apt-get update sudo apt-get install percona-server-server-5.7 |
During installation, installation will ask to provide a password for root
user of Percona MySQL. We can perform apt-pinning by creating a file :
1 | nano /etc/apt/preferences.d/00percona.pref |
Copy-pasting this content :
1 2 3 | Package: * Pin: release o=Percona Development Team Pin-Priority: 1001 |
… and saving the file. That will prevent conflicting upgrades from Ubuntu distribution repository. Then, we will run this command :
1 | sudo mysql_secure_installation |
sudo mysql_secure_installation
needed to ensure security.
1 2 3 4 5 6 7 8 | ... Would you like to setup VALIDATE PASSWORD plugin : N Change the password for root : N Remove anonymous users? : Y Disallow root login remotely? : (If you need to access from other server or your computer, only then yes. Yes is less secured) Remove test database and access to it? : Y Reload privilege tables now? : Y ... |
Now login to MySQL server and run the commands specific for Percona (you’ll see they are instructed to run) :
1 2 3 4 5 6 7 8 9 | mysql -u root -p # run after login CREATE FUNCTION fnv1a_64 RETURNS INTEGER SONAME 'libfnv1a_udf.so'; CREATE FUNCTION fnv_64 RETURNS INTEGER SONAME 'libfnv_udf.so'; CREATE FUNCTION murmur_hash RETURNS INTEGER SONAME 'libmurmur_udf.so'; # you should exit exit # then restart mysql service mysql restart |
We ran the above Percona Server is distributed with several User Defined Function from Percona Toolkit, see :
1 | http://www.percona.com/doc/percona-server/5.7/management/udf_percona_toolkit.html |
Login an create an user named yourserver2018
, with password BADPASSWORD__a&ET#
:
1 2 3 4 5 6 7 | mysql -u root -p CREATE USER 'yourserver2018'@'localhost' IDENTIFIED BY 'BADPASSWORD__a&ET#'; CREATE DATABASE wordpress2018; GRANT SELECT,DELETE,INSERT,UPDATE ON wordpress2018.* TO 'yourserver2018'@'localhost'; ## OR ## GRANT ALL PRIVILEGES ON wordpress2018.* TO 'yourserver2018'@'localhost'; FLUSH PRIVILEGES; |
Check :
1 2 3 | show databases; use information_schema; show tables; |
Happy?
Now exit :
1 | exit |
Open /etc/mysql/my.cnf
and add this stanza above !includedir /etc/mysql/conf.d/
lines :
1 2 3 4 5 6 | [mysqld_safe] pid–file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock nice = 0 log_error=/var/log/mysqld.log datadir=/var/lib/mysql |
Save the file. Restart MySQL :
1 2 3 4 | touch /var/log/mysqld.log service mysql restart service mysql status cat /var/log/mysqld.log |
Change the permission of /var/log/mysqld.log
to make it writable :
1 | chmod 777 /var/log/mysqld.log |
Above will prevent failure to auto-restart MySQL on need. That is one reason why WordPress front throws infamous can not connect database error demanding manual restart.
Advanced : Creating debian-sys-maint User for Percona MySQL
Ubuntu installation does not automatically create debian-sys-maint
user. That user coded to be the control scripts of Percona Server mysqld and mysqld_safe services. Creating this user is needed to have automatic restart of MySQL server specially for WordPress like PHP-MySQL web application. If the user is not present, upon failure to auto-restart; WordPress front will throw infamous Can not connect database error demanding manual restart.
To clarify, Debian has a debian-sys-maint which is used for checking status. The password for that user should be the same as stored in /etc/mysql/debian.cnf
.
The user related password could be kept under this directory or Percona :
1 | /etc/mysql/percona-server.conf.d |
If you run ls -al
, you’ll see two files there :
1 | mysqld.cnf mysqld_safe.cnf |
I believe that I have shortcut to hard-work with a script :
1 | https://gist.github.com/AbhishekGhosh/1abc7680b5679510929ae2cf9d1717ef |
Assuming it is fresh installation, you have to run these :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # just create en empty file touch /etc/mysql/debian.cnf cd ~ # wget my script wget https://gist.githubusercontent.com/AbhishekGhosh/1abc7680b5679510929ae2cf9d1717ef/raw/bcb8760b616afb38ab07037578a796ed1a8f7dca/debian-sys-maint.sh # execute it ls - al chmod +x debian-sys-maint.sh sh debian-sys-maint.sh ## you'll prompted to supply MySQL root password # check what is created cat /etc/mysql/percona-server.conf.d/90-mysqladmin.cnf cp /etc/mysql/percona-server.conf.d/90-mysqladmin.cnf /etc/mysql/debian.cnf # mysql should not have error on restart out of the way service mysql restart service mysql status |
Running cat
on any of those files – /etc/mysql/debian.cnf
or /etc/mysql/percona-server.conf.d/90-mysqladmin.cnf
will give you the password :
1 2 3 4 5 | [mysqladmin] host = localhost user = debian-sys-maint password = SaXHChx4gGwGrVQe socket = /var/run/mysqld/mysqld.sock |
Then check login as debian-sys-maint
:
1 | mysql -u debian-sys-maint -p |
Exit.
Check the function :
1 | sudo /etc/init.d/mysql restart |
That should go well. The script deliberately not made full automated. Someone can have real settings files there.
How to Remove/Uninstall Percona MySQL 5.7
These are not written properly on docs. Run :
1 2 | sudo service mysql stop sudo apt-get remove percona-server-server-5.7* |
If you want to remove everything (including logs) then :
1 | sudo apt-get purge percona-server-server-5.7* |
The command is percona-server-server-5.7*
not percona-server*
. If you run :
1 | sudo apt-get remove percona-server* |
It will say there is no such package for particular Ubuntu version.
Tagged With how to install mysql 5 7 on ubuntu 18 04 , mysql ubuntu 18 04 , install percona server on ubuntu , https://www wikihow com/Use-LinkedIn yandex ru , https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1832 -FpXm6WZrAb15ebQr2YrXcjOETB1QPedBCNJrtfyB5n8PHPLT9JYCH8P3KT5KsyZ 875f316c72fd843fe993be6aacaf36cb668bda0f&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme , https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1829 B-S3XfD0neTCg0GhaR_gItomrSVAkQuu0Kda8pmbqxSaOyOSCfhQX0aAZ5VHs1nL 25bde24a3dcdc7045a935c81f17979320c7e3c4b&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme , windows mysql conf , https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1826 kMY2bhLNnr-G3H4zTPoUghOBRj7fTRj51r9WMaK40NAJdm7o43nHiDt1L3abLErO 50858ae4c8b5533603df8f5ef1dbaa848a75797c&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme , https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1825 Y55WHsoIihM6EarEUGlMqHfZ7DkoOxQ7ctV6wKniLybNggmXPMYy18VSDi3aaFf7 6e96e956944a80e5c1edad596f08327f00884087&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme , how to customize mysql ubuntu