Create MySQL User Using Command Line

Managing MySQL database is not hard, and if you are familiar with some SQL queries, that would be really an advantages. This is how you can create MySQL user using command line on Windows or terminal on Linux, the commands will work the same.

1. Login to MySQL using root user, and by default the root password would be blank:

mysql -u root -p;

2. After successfully logged in, create new user using command: create user 'newuser'@'localhost' identified by 'password';

Using these command, you can create a new MySQL user.

3. Grant privileges new created user using: 

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

You must grant privileges new created MySQL user to make it your new created user have some privileges, but in this command we can simply by just using "." (dot) to make all privileges to this user.

4. Flush privileges MySQL system:

flush privileges;

You need to flush privileges, to refresh MySQL server system user data.


Popular posts from this blog

Flixify Video Streaming Platform

How To Make Sitemap in Blogger

How To Connect To Server Using FTP