mysql create user

mysql 5.7

1.grant all privileges on *.* to 'username'@'%' identified by 'username123';

select * from mysql.user;

localhost    root
localhost    mysql.sys
%  username

mysql8

1.create user 'username'@'%' identified by 'username123';

2.grant all privileges on *.* to 'username'@'%';

select * from mysql.user;

localhost    root
localhost    mysql.sys
localhost       mysql.infoschema
%  username

 

 

remark:

for 5.7 version: can create user by grant privileges  one sql at once;

for 5.8 version: must create user first and then grant privileges;

你可能感兴趣的:(mysql)