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.

Comments

Popular posts from this blog

ERROR 1348 Column Password Is Not Updatable When Updating MySQL Root Password

Flixify Video Streaming Platform, Watch Movies and TV Show Online

JavaFX Email Validation using Jfoenix Textfield

How To Uninstall Angular CLI, The Angular Framework

Push Notification Cordova, FCM And PHP

JavaFX Combo Box with Search Autocomplete