Posted in MySQL, MySQL Shell

Create New User with admin rights on MySQL Shell

Creating new user through MySQL Shell commands below, grant access to the user then connect to MySQL (through Workbench or Shell) with that user:

MySQL JS> \sql

MySQL JS> \connect root@localhost

 

Then enter password and Y (to save the password). Or root@{ip address or hostname).

 

MySQL  localhost:33060+ ssl  SQL >  CREATE USER ‘user’@’serverhostname’ IDENTIFIED BY ‘password’;

MySQL  localhost:33060+ ssl  SQL >  GRANT ALL PRIVILEGES ON *.* TO ‘user’@’serverhostname’ WITH GRANT OPTION;

MySQL  localhost:33060+ ssl  SQL >  CREATE USER ‘user’@’%’ IDENTIFIED BY ‘password’;

MySQL  localhost:33060+ ssl  SQL > GRANT ALL PRIVILEGES ON *.* TO ‘user’@’%’ WITH GRANT OPTION;