MySQL is an open-source relational database management system. Its name is a combination of "My", the name of co-founder Michael Widenius's daughter, and "SQL", the abbreviation for Structured Query Language.

Stable release8.0.23 / 18 January 2021; 35 days ago(At the time of this post)
Initial release date23 May 1995
LicenseGPLv2 or proprietary

Since I use Kali Linux 2020.4, I had a problem on MySQL, I tried to resolve this issue but unfortunately I couldn't. So I decided to uninstall it and reinstalling it again.

Here are the steps I followed,

To Remove MySQL:-

$ sudo apt-get remove --purge mysql-server mysql-client mysql-common -y
$ sudo apt-get autoremove -y
$ sudo apt-get autoclean

$ sudo rm -rf /etc/mysql

# Delete all MySQL files on your server:
$ sudo find / -iname 'mysql*' -exec rm -rf {} \;


To Install MySQL in kali Linux

STEP 1

We’ll use the available MySQL APT repository to install MySQL 8.0 on Kali Linux. Ensure this repository is added to your system by running the command below.

$ sudo apt update
$ sudo apt install -y wget
$ wget https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb
$ sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb

As Kali Linux is not officially supported version, choose the Ubuntu Bionic release.

Select <OK>  and press <Enter> key to confirm version installation.

 STEP 2

Once the repo has been added, update apt index and install mysql-server:

sudo apt update
sudo apt install mysql-community-server

Accept license agreement in the next screens to begin installation. Set root password for your MySQL database server.

Confirm your root password

Select the default authentication plugin.

When asked for root password, provide the password and confirm it to set.

sudo systemctl enable --now mysql

Check status using:

$ systemctl  status  mysql
 ● mysql.service - MySQL Community Server
    Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
    Active: active (running) since Sat 2020-03-21 11:15:30 UTC; 2min 31s ago
      Docs: man:mysqld(8)
            http://dev.mysql.com/doc/refman/en/using-systemd.html
  Main PID: 2188 (mysqld)
    Status: "Server is operational"
     Tasks: 38 (limit: 2377)
    Memory: 386.5M
    CGroup: /system.slice/mysql.service
            └─2188 /usr/sbin/mysqld
 Mar 21 11:15:29 deb10 systemd[1]: Starting MySQL Community Server…
 Mar 21 11:15:30 deb10 systemd[1]: Started MySQL Community Server.

Test MySQL 8.0 Database Functionality

You can test if the database server is working fine by creating a test database:

$ sudo mysql -u root -p
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.19 MySQL Community Server - GPL
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> 

mysql> CREATE DATABASE test_db;
Query OK, 1 row affected (0.01 sec)

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| test_db            |
+--------------------+
5 rows in set (0.01 sec)
mysql> EXIT
Bye