How to install MySQL 8 on Kali Linux

In this article, we will see how to install MySQL 8 on Kali Linux.

We’ll use the available MySQL APT repository to install MySQL 8.0 on Kali Linux. Ensure this repository is added to our system by running the commands 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

Continue reading How to install MySQL 8 on Kali Linux

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

In this article, we will see the solution for below error.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

ERROR 2002 HY000 Cant connect to local MySQL server through socket varrunmysqldysqld.sock 2

Reasons:

1. MySQL is not started.
2. MySQL not installed on your machine.

Solution:

1. Lets verify the status of mysql server whether it is started or not.
Continue reading ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

How to Install MySQL 8 on CentOS

In this article, we will see How to Install MySQL 8 on CentOS 7.

MySQL 8 Installation on CentOS step by step:

Following are the commands used to install MySQL on CentOS:

1. wget https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm

2. yum install mysql80-community-release-el7-3.noarch.rpm

3. yum repolist enabled | grep “mysql.*-community.*”
Continue reading How to Install MySQL 8 on CentOS

How to Rename a Database in MySQL

In this article, we will see how to Rename a Database in MySQL. In previous versions of MySQL, RENAME DATABASE is used to rename database. From all newer versions, RENAME DATABASE has been removed to avoid security risks.
We can rename database in MySQL using dump and restore process.

Steps to Rename a Database in MySQL:

mysqldump syntax:

mysqldump –u [UserName] –p[Password] –R [DB_Name] > [DB_Name].sql

Replace [UserName] and [Password] with the actual credentials for the database, and replace [DB_Name] with the exact name of the database you’re changing. There should be no space between -p and the password. The -R flag indicates that the dump file should retain all stored procedures and functions.

1) Create dump using mysqldump tool. Here r2schools is the database name.

mysqldump -u root -p -R r2schools > r2schools.sql

Continue reading How to Rename a Database in MySQL

How to Lock and Unlock MySQL User Account

Lock and unlock is administrator day to day activity. ALTER USER privileges required to lock and unlock MySQL Server User. In the following example, we provided the check the status of MySQL User, lock and unlock the User account.

1. Create MySQL User.

CREATE USER harry IDENTIFIED BY 'Harry@321';

2. Check the status of the MySQL Server whether it is locked or not by running the query.
Continue reading How to Lock and Unlock MySQL User Account