Skip to content

Rate this page
Thanks for your feedback
Thank you! The feedback has been submitted.

For help, click the link below to get free database assistance or contact our experts for personalized support.

Install Percona Server for MySQL and create a database on Ubuntu

Use the Percona repositories to install using APT.

Quickstart path: Step 1 — Install. Next: Work with a database (step 2).

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

  • Either use sudo or run as root

  • Stable Internet access

Installation steps

{.power-number}

  1. Update the package index:

    sudo apt update
    
  2. Install curl:

    sudo apt install -y curl
    
  3. Download and install the percona-release repository 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
    
  4. Set up the Percona Server for MySQL 8.4 repository:

    sudo percona-release setup ps-84-lts
    
  5. Enable the Percona Server for MySQL release repository:

    sudo percona-release enable ps-84-lts release
    sudo apt update
    
  6. Install Percona Server for MySQL:

    sudo apt install -y percona-server-server
    

    During installation, you will be prompted to:

    • Enter a root password (use secret for these examples, or choose your own)

    • Confirm the password

    • Choose authentication method (Strong password encryption recommended)

  7. [Optional] Secure the installation:

    Run the mysql_secure_installation script 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
    
  8. Check the service status and restart if needed:

    sudo systemctl status mysql
    sudo systemctl restart mysql
    
  9. Log in to the server using the password you set during installation:

    mysql -uroot -p
    Enter password:
    

Work with a database

The steps below walk you through creating a database and running basic queries. You can also open the Work with a database script in its own page.

Work with a database

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 username with your MySQL user name.

  • Package installation issues

    Check the system log for errors during installation:

    sudo journalctl -u mysql -n 50
    

    For specific error messages, see the Percona Server for MySQL documentation or the Percona community forum.

Security best practices

  • Strong Passwords: Utilize complex and unique passwords for all users, especially the root account.

  • Minimize Permissions: Grant users only the privileges necessary for their tasks.

  • Disable Unnecessary Accounts: Remove test accounts and unused accounts.

  • Regular Backups: Implement consistent backup routines to safeguard your data.

  • Keep Software Updated: Maintain Percona Server and related packages updated with security patches.

  • Monitor Server Activity: Employ tools, like Percona Monitoring and Management , and logs to monitor server activity for suspicious behavior.

Additional resources