Install Percona Server for MySQL and create a database on Ubuntu¶
Use the Percona repositories to install Percona Server for MySQL with APT.
Quickstart path: Step 1, Install. Next: Work with a database is step two.
For step-by-step command explanations, HTTPS (--scheme) details, non-interactive installs, and debconf guidance, see Use an APT repository to install Percona Server for MySQL.
The percona-release tool is a command-line utility that simplifies the management and installation of Percona software packages, providing access to the latest versions and ensuring consistency across environments. For more information, refer to the Percona Software Repositories Documentation.
Prerequisites¶
-
Run commands as the root user or with
sudo. -
Confirm stable internet access.
Installation steps¶
To install the server, complete the following steps:
-
Update the package index:
sudo apt update -
Install curl:
sudo apt install -y curl -
Download and install the
percona-releaserepository package:curl -O https://repo.percona.com/apt/percona-release_latest.generic_all.deb sudo apt install -y gnupg2 lsb-release ./percona-release_latest.generic_all.deb -
Configure the Percona Server for MySQL 9.7 repository. This step prepares the repository configuration and is intentionally separate from step 5:
sudo percona-release setup ps-97-lts --scheme https -
Enable the Percona Server for MySQL release repository:
sudo percona-release enable ps-97-lts release --scheme https sudo apt update -
Install Percona Server for MySQL:
sudo apt install -y percona-server-serverDuring installation, the package manager prompts you to complete the following actions:
-
Enter a root password. Use
<strong-password>as a placeholder for a value you choose. -
Confirm the password.
The package manager may ask additional debconf questions depending on the package and distribution. On 9.7, password-based authentication defaults to
caching_sha2_password. Themysql_native_passwordplugin is not available on MySQL 9.x. See Authentication methods. -
-
[Optional] Secure the installation:
Run the
mysql_secure_installationscript to improve security. The script helps you:-
Set a password for the root user
-
Select a password validation policy level
-
Remove anonymous users
-
Disable root login remotely
-
Remove the test database
-
Reload the privilege table
sudo mysql_secure_installation -
-
Check the service status and restart if needed:
sudo systemctl status mysql sudo systemctl restart mysql -
Log in to the server using the password you set during installation:
mysql -uroot -p Enter password:
Work with a database¶
The following steps create a database and run basic queries. You can also open the Work with a database script on its own page.
Troubleshooting¶
-
Connection issues
-
Check that the MySQL service is running:
sudo systemctl status mysql -
If the service is not active, start it:
sudo systemctl start mysql -
Try connecting with the password you set during installation:
mysql -uroot -p Enter password:
-
-
Permission errors
If MySQL reports that a user lacks permission to perform an action, grant the needed privilege. For example, to allow a user to create databases from the MySQL shell:
GRANT CREATE ON *.* TO 'username'@'localhost'; FLUSH PRIVILEGES;Replace
usernamewith your MySQL user name. -
Package installation issues
Check the system log for errors during installation:
sudo journalctl -u mysql -n 50For specific error messages, see the Percona Server for MySQL documentation or the Percona community forum.
Security best practices¶
-
Strong passwords: Use complex and unique passwords for all accounts, including the root account.
-
Minimize permissions: Grant each user only the privileges required for their tasks.
-
Disable unnecessary accounts: Remove test accounts and unused accounts.
-
Regular backups: Run consistent backup routines to protect data.
-
Keep software updated: Apply security patches to Percona Server and related packages.
-
Monitor server activity: Use tools such as Percona Monitoring and Management and server logs to detect suspicious behavior.