Whenever you create a new user in MySQL it wiil stored in the User table of mysql database. There are two ways to create users:
- Create user statement:
CREATE USER username@hostname
IDENTIFIED BY 'password'
For example:
CREATE USER root@localhost
IDENTIFIED BY 'root'
It will create a user 'root' in localhost with 'root' as password.
- Using INSERT statement:
use mysql;
INSERT INTO user (host,user,password)
VALUES('username','username',PASSWORD('password'));
For example:
INSERT INTO user (host,user,password)
VALUES('localhost','root',PASSWORD('root'));
It will create a user 'root' in localhost with 'root' as password.
0 Comment(s)