Creating MySQL users

You can create MySQL users either from Command Prompt or by using MySQL Workbench:

  1. To execute SQL and other commands from Command Prompt, open the Terminal and type the following command:
mysql -u root -p<root_password> 
  1. Once logged in successfully, you will see the mysql Command Prompt:
mysql>  
  1. To create a user, first select the mysql database:
mysql>use mysql;
Database changed
mysql>create user 'user1'@'%' identified by 'user1_pass';  mysql>grant all privileges on *.* to 'user1'@'%' with grant option

The preceding command will create a user named 'user1' with password 'user1_pass' having all privileges, for example to insert, update, and select from the database. And because we have specified the host as '%', this ...

Get Java EE 8 Development with Eclipse now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.