How to Delete MySQL Users Accounts

How to Delete MySQL Users Accounts

This tutorial explains how to delete MySQL/MariaDB user accounts. In MySQL you can remove one or more users and assigned privileges with the DROP USER statement.If the user account is no longer needed, it is a good idea to either remove the user privileges or to completely delete the user account.

MySQL allows you to create multiple user accounts and grant appropriate privileges so that the users can connect and manage databases.

If the user account is no longer needed, it is a good idea to either remove the user privileges or to completely delete the user account.

This tutorial explains how to delete MySQL/MariaDB user accounts.

DROP USER Statement

In MySQL, you can remove one or more users and assigned privileges with the DROP USER statement. The general syntax of this statement is as follows:

DROP USER [IF EXISTS] USER_ACCOUNT [, USER_ACCOUNT] ...

For example to remove the [email protected] user account login to the MYSQL shell and run:

DROP USER '[email protected]';

On success the command will return:

Query OK, 0 rows affected (0.00 sec)

To remove multiple user accounts in a single command, run the DROP USER statement followed by the users you want to remove separated by space:

DROP USER '[email protected]' '[email protected]';

If you try to drop a user account that does not exist and the IF EXISTS clause is not used the command will return an error.

If the user you are trying to remove is currently logged in, the user session will not be closed and the user will be able to run queries until the session ends. Once the session is closed the user is removed and it will no longer be able to log in to the MySQL server.

The databases and objects created by the user are not automatically removed.

mysql

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Best MySQL DigitalOcean Performance – ScaleGrid vs. DigitalOcean Managed Databases

Compare ScaleGrid MySQL vs. DigitalOcean Managed Databases - See which offers the best MySQL throughput, latency, and pricing on DigitalOcean across workloads.

Exploring MySQL Binlog Server - Ripple

How MySQL Ripple binlog server can help you improve the performance of your master server by introducing a proxy server between the master and slave servers.MySQL does not limit the number of slaves that you can connect to the master server in a replication topology.

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)の解決

railsでWebアプリケーションを作成しているのですが、rails sでサーバーを起動した際に、Can't connect to local MySQL server through socket  '/var/lib/mysql/mysql.sock' (2) のエラーが出てしまいます

MySQL Tutorial - Learn MySQL from Scratch

Complete MySQL Course: Beginner to Advanced. MySQL Tutorial - Learn MySQL from scratch and go from beginner to advanced in MySQL.

MySQL Tutorial: A Beginners Guide To Learn MySQL

MySQL Tutorial: A Beginners Guide To Learn MySQL - Let's take a look at a very in-depth MySQL tutorial that explores all the operations and commands that you need to explore your databases...