How to Remove Root Access in MySQL?
The root user in MySQL has virtually unlimited rights, so the security of their database access is paramount. If for some reason you need to remove root access, follow these instructions.
Step 1: Log in to MySQL as the root User
To begin, open a terminal and enter the command:
mysql -u root -p
You will then be prompted to enter the root user password.
Step 2: Delete the Root User
Now log in to the MySQL database itself using the command:
use mysql;
Select the desired user and remove them from the system:
DELETE FROM mysql.user WHERE User='root';
Do not forget to save the changes with the command:
FLUSH PRIVILEGES;
Step 3: Restart the MySQL Server
For the changes to take effect, you must restart the MySQL server with the command:
sudo systemctl restart mysql
Now root access is removed from the MySQL database.
Follow these instructions carefully so as not to damage the integrity of the data and the security of the database.