If you are a tech professional, you must know about relational databases. Both MySQL and MariaDB belong to this category. You have to execute several commands to perform some functions in both cases. 

We are here to explain the method to remove an anonymous user from MySQL and MariaDB! Let’s begin!

How to remove anonymous users from MySQL or MariaDB?

When you install MySQL, there is a default root user and an anonymous user, both with a blank password. Blank passwords are highly insecure. You must set a password for the root user and remove the anonymous user for security purposes. 

Additionally, this anonymous user account permits anyone to connect with MySQL Server without the user account. The primary purpose of this account is for testing, and it shall be removed at a later stage. 

To remove the anonymous user from MySQL or MariaDB, type in the following command:

Open the terminal on your device and follow these steps.

Step 1: As the root user, open MySQL.

$ mysql -u root -p


$ sudo mysql

Step 2: Now, use the DROP USER command as given below:

mysql> DROP USER 'abc’@'localhost';

After you execute this command, MySQL raises a QUERY OK. You will notice that the user is not available in your database anymore.

Additionally, here are some steps if you wish to create a user in MySQL or MariaDB!

How to create a user in MySQL or MariaDB?

The create user statement helps develop new accounts and enables authentication, password management properties, etc., for the new accounts. 

To create a MySQL user account, execute the following command:

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'user_password';

Additionally, if you wish to establish a connection as a user with any host, you can use the ‘%’ wildcard. Here is the usage:

CREATE USER 'newuser'@'%' IDENTIFIED BY 'user_password';

Lastly, you can also grant privileges to a user account by following the below-stated commands in various instances.

To grant the privileges on a particular database: 

GRANT ALL PRIVILEGES ON database_name.* TO 'database_user'@'localhost';

To grant multiple privileges on a specific database:

GRANT SELECT, INSERT, DELETE ON database_name.* TO database_user@'localhost’;

To grant privileges to a user account in all the databases:

GRANT ALL PRIVILEGES ON *.* TO 'database_user'@'localhost';


The world of MySQL, an open-source relational DBMS, lets you execute plenty of commands for different purposes. It helps you to create various user accounts and grant privileges according to the requirement. This article assists you to understand some of the basic commands that further helps you to remove an anonymous user as well as create a user.  Also If you're looking to secure your online activities with utmost privacy and anonymity, consider buying anonymous VPS hosting from the renowned brand 1gbits. With their top-notch services, you can ensure your data remains confidential and your online presence remains untraceable, granting you peace of mind in today's interconnected world.

We hope that the information will halt all your ambiguities related to the topic. Keep learning, keep practising!