Create user in MySQL using command line?

create user in mysql
Create user in MySQL using Command Line

In this tutorial i will show you how to create user in MySQL using the cli. It is easy to create user so let’s get started.

Read Also: How to backup postgresql database?

Read Also: How to backup and restore MySQL database?

For creating user in MySQL we will need root user and password:

Step 1: Login with root user

mysql -u root -p

Step 2: Create mysql user

We’ll create a user with name testuser and password testpasswd..

CREATE USER 'testuser'@'localhost' IDENTIFIED BY 'testpasswd';

Read Also: How to create mysql database and table?

Step 3: View list of users in MySQL

SELECT User,Host FROM mysql.user;

If you have any problem using this tutorial please feel free to comment below..

Leave a Reply

Your email address will not be published.


*