Skip to content

RootDBA

DBA expertise: PostgreSQL, SQL Server & MySQL

Menu
  • Home
  • blog
  • PostgreSql
  • MySql
  • Sql Server
  • About AHMED – Root DBA
Menu

MySQL installation and removing

Posted on September 2, 2025 by AHMED

installing Mysql 8 community edition involve below steps

1.Add MySQL Repository package.
2. Install MySQL Community Server from the repository.
3. Enable MySQL server to auto-start.
4. Start MySQL server.
5 .Verify if MySQL is running.
Follow the steps in the provided link to add the repository and install MySQL.
click here

installing MySQL percona edition

Percona Server for MySQL indeed offers additional features and enhancements beyond what is available in the MySQL Community Edition. These additions are designed to improve performance, scalability, and manageability of MySQL databases. While Percona Server for MySQL aims to provide enterprise-level functionality, it remains an open-source solution, distinguishing itself from MySQL Enterprise Edition, which is proprietary software provided by Oracle.

Feature Percona Server for MySQL MySQL Community Edition
Performance Improvements Often includes performance optimizations not found in MySQL Community Edition May lack some of the performance optimizations present in Percona Server
Feature Differences May include additional features or enhancements beyond those found in MySQL Community Edition Standard features and functionalities of MySQL
Storage Engines Supports multiple storage engines, may include enhancements specific to certain engines Supports multiple storage engines, including InnoDB, MyISAM, etc.
Monitoring and Management Tools May come bundled with additional monitoring and management tools for performance analysis, query profiling, etc. Lacks additional monitoring and management tools provided by Percona
Support and Maintenance Offers commercial support options including consulting, training, and technical support subscriptions Relies primarily on community support, though commercial support is available through Oracle
Licensing Distributed under the terms of the GNU General Public License (GPL), may offer additional commercial licensing options Distributed under the terms of the GNU GPL, primarily open-source with commercial support available
Community and Ecosystem Has its own community and ecosystem, including forums, blogs, and events focused on Percona products and technologies Benefits from a large and active community of developers, contributors, and users

installing percona MySQL edition

the first step is to add percona repo by using the below command

steps below are based on this link from official percona site

also you can use the following link for more deep steps

$ sudo yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm

b4150d9bf4fba9d0060c30ea420d10a8.png

We initiate the setup process by executing the following command:

sudo percona-release setup ps-80

053c4cb45ba25bfa482a41e1b51a1ca9.png

final step is to starting the instalation

sudo yum install percona-server-server

1c8e46c52e721cb164d95373b26cb14b.png
e7322aad71fb94bcee2a056521478d5c.png
note: there some dependency that are required such as perl
need to check you repo if it have this dependcay

post installation check

after the installation there are some additional steps which include enable daemon for mysql
and starting up daemon for MySQL

1.start and enable Mysql daemon
use the below to enable mysql daemon to start auto during OS boot

sudo systemctl enable mysqld.service

e926d25a8d4cad4cf5a97619f8b69d79.png
next start mysql daemon

sudo systemctl start mysqld.service

now final step is to check the status of mysql services make sure that they are running
systemctl status mysqld

7cafab5bd87b1fbed22cb293113f463b.png

2.VERIFICATION

last is to check and confirm that MySQL is processes are running

We’ll first utilize the pidof utility to check if the MySQL server process is running:

pidof mysqld

2a63546a8bdeb2ee13144f93c16d402a.png

Next, we’ll utilize the netstat command to confirm that MySQL is listening for connections on port 3306
netstat -ntlp | grep 3306

38f14711160fce585eb06ce63f016b64.png

Finally, we’ll employ the lsof command to inspect the files currently open by the MySQL server process:
sudo lsof -u mysql

839298e2e445653b68bc9dfc92acdaab.png

configure root user

after the installation you to setup the root user so you will able to connect to MySQL
the steps involve Restart the server with the –skip-grant-tables option to allow access without a password. This option is insecure. This option also disables remote connections.

$ sudo systemctl stop mysqld
$ sudo systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
$ sudo systemctl start mysqld 
$ mysql

9554706f187d03c55f6a3347a6191b0c.png
next we need to setup the password for root user to be able to connect normally from local host

also we need to reload grant tables to that we can run alter command

mysql> FLUSH PRIVILEGES;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Awersdfzxc.1';

643d6fc66e3c7d095a8ace6e2eadad06.png

now stop and run command to start MySQL in normal mode without option –skip-grant-tables

$ sudo systemctl stop mysqld 
$ sudo systemctl unset-environment MYSQLD_OPTS 
$ sudo systemctl start mysqld

067ef95cb8c9349d8981f70b5a002e75.png

now try to login to MySQL engin using the password you setup for root and it should connect normaly

mysql -u root -p
2540acfc04e8e44cf6dd6c219fabb760.png

removing MySQL server

the steps are done as follow

  1. remove MySQL related repo packages
  2. remove all MySQL packages
  3. remove MySQL user from OS
  4. remove any left-over MySQL files
  5. verfiyy MySQL is not persent at all on OS

STEP 1. SEARCH FOR REPOSITORY PACKAGES ⭐️

using rpm we will search for repo for MySQL , and using grepto filter for our target repo using unqaie pattern
rpm -qa | grep -i mysql

61e6163a01abe36a0159d3387aaea6e4.png

STEP 2. REMOVE REPO

we have located the full name of MySQL repo now we will use yum to remove the repo from repo list

sudo yum -y remove mysql80-community-release-el7-3.noarch

041c3ed7edfb2e3164c42e05a07bc6c5.png

3. SEARCH FOR INSTALLED MYSQL PACKAGES

next steps is to locate all MySQL packages installed by using the below , this important as MySQL has a lot of packages installed other that MySQL community server .

using the below grep command will help locate all these packages.

rpm -qa | grep -i mysql
200be6720099d4906f2e5dcdb372f3ca.png

STEP 4. REMOVE MYSQL PACKAGES

now we will start by removing the packages using yum remove and then specifying the list of mysql we have found

 yum remove mysql-community-server-8.0.36-1.el8.x86_64 mysql-community-client-8.0.36-1.el8.x86_64 mys
ql-community-client-plugins-8.0.36-1.el8.x86_64 mysql-community-libs-8.0.36-1.el8.x86_64 mysql-community-icu-data-files-8.0.36-1.e
l8.x86_64 mysql80-community-release-el8-9.noarch mysql-community-common-8.0.36-1.el8.x86_64

6477cfda3c6418b40c002601cd534468.png

a2ce3351e9428c43ff6295dcdabe7ccb.png

STEP 5. REMOVE MYSQL USER

To remove the MySQL user that was added during the MySQL installation process, you can utilize the userdel command.
First, to verify if the MySQL user still exists within the operating system, the grep command can be used to search for the MySQL user in the passwd file. Once confirmed, you can proceed to delete the user. The userdel command facilitates this process. You have the option to run userdel followed by the username to initiate an interactive user deletion wizard.
Alternatively, for a more direct approach, you can use userdel -r [username] to not only delete the user but also remove their home directory and any assigned mailbox, if applicable. The -r option ensures that both the user’s home directory and their mailbox (if they have one) are deleted alongside the user account.

grep mysql /etc/passwd
sudo userdel
sudo userdel -r mysql

8092c14912391b7c75661e32eefc43dc.png
eebe6efa6d1fa5abbd198876b1bc8c59.png
you can ignore the error regarding mail spool since MySQL don’t have mailbox

26c6b51c6806a20d177387b4354e1883.png

STEP 6. REMOVE OTHER LEFTOVER FILES

now we have remove MySQL packages and deleted the user , next steps is to remove all left over directory created by MySQL installation

normally there will be data directory located in /var/lib
and log file for MySQL located in /var/log
search for MySQL file using ls and if there is still some MySQL leftovers proceed with deleting these files
ls /var/lib ls /var/log

03279d7e61070d60f5cad9d4ca040de4.png

VERIFICATION

last steps is to confirm that we have successfully remove MySQL from the OS

while run the below command , nothing should popup for the below command

pidof mysqld netstat -ntlp | grep 3306 sudo lsof -u mysql

2d021617629e17e5ed052e8816161a96.png

Installing Specific Version of MySQL

link for reference steps
When setting up a MySQL environment, particularly for testing purposes, it’s important for database administrators (DBAs) to often install specific versions of MySQL to ensure compatibility with applications. In your scenario, you’re looking to install MySQL version 8.0.26-16.1. Here’s a streamlined guide on how to do this, with an emphasis on downloading the correct version from Percona, as Percona offers optimized versions of MySQL

  1. Visit Percona’s Downloads Section: Start by navigating to Percona’s official downloads page. You can reach it by following this link: Percona Downloads.
  2. Select the MySQL Version: Once on the downloads page, you’ll need to find the MySQL server version you’re interested in, which is MySQL 8.0.26-16.1 in this case. Keep in mind that navigating the Percona website might require you to select not just the version but also the specific distribution and OS you are using, such as Ubuntu, Debian, CentOS, etc.
    35030c4bb1851a139d41fa14e4964106.png
  3. Download the Repository Package: Percona packages its releases in repository packages. You’ll need to download the repository package suitable for your operating system. This might involve selecting your OS version and then downloading a .deb package for Debian-based systems like Ubuntu, or a .rpm package for Red Hat-based systems like CentOS.
    you can use wget to download the repo directly on OS
    wget https://downloads.percona.com/downloads/Percona-Server-8.0/Percona-Server-8.0.16-7/binary/redhat/8/x 86_64/Percona-Server-8.0.16-7-r613e312-el8-x86_64-bundle.tar

dfc09b7e702ea0a78361e493d6d93834.png
one done extract the package and using tar
tar -xvf yourfile.tar

  1. Install the Repository Package: Once the repository package is downloaded, you will need to install it. This step varies depending on your OS. For Debian-based systems, you’d use dpkg to install a .deb file, and for Red Hat-based systems, you’d use rpm to install a .rpm file.
    to speed up the process setup a variable with the version you required

version=8.0.26-16.1 echo $version

7cbe15948385ed4c9230e61bbdc651a2.png

sudo yum install percona-mysql-router-$version.x86_64
sudo yum install mysql-community-client-$version.x86_64

Performing MySQL Secure Installation

Securing a fresh MySQL installation is crucial, and this can be accomplished by running the mysql_secure_installation script. This utility is designed to enhance the security of MySQL in several key ways:

  • It is executed exclusively by the root user to ensure administrative privileges.
  • The script significantly boosts MySQL’s security by prompting you to set a password for the root account, thereby safeguarding it.
  • It prevents the root user from logging in remotely, adding an extra layer of protection.
  • The script also removes anonymous users, eliminating potential unauthorized access points.
  • It deletes the default test database, which is created during the MySQL installation process, to prevent unintended access.
  • Lastly, the script immediately reloads privilege settings, applying these security enhancements without delay to the MySQL environment.
    reference details steps

access the root password

To initiate the mysql_secure_installation process, it’s necessary to obtain the temporary root password generated during the MySQL installation. This password can be found in the /var/log/mysqld.log file. By employing the grep command, you can efficiently filter the contents of this file to exclusively display the root password, using the following command:

sudo grep 'password' /var/log/mysqld.log

This command searches the specified log file for any lines containing the word “password,” effectively isolating and revealing the temporary root password required for proceeding with the secure installation script.

c8a70d5839cbc276fa09736c7ac6c2a7.png

RUN MYSQL_SECURE_INSTALLATION SCRIPT

Next, proceed by executing the mysql_secure_installation command and respond to the prompts as previously outlined. The script will request the root password, which you’ve retrieved from the mysqld.log file.

524a9fc70dc43cce372e7e0852d709a3.png
1495f552ebb0d920426522c2540fa8c0.png

https://www.dragonflydb.io/faq/postgres-delete-cluster

0
Visited 4 times, 1 visit(s) today
Category: mysql

Post navigation

← Basic MySQL Database Administration
Exploring MySQL Server →
© 2025 RootDBA | Powered by Minimalist Blog WordPress Theme