首页 > 代码库 > mysql 创建新用户

mysql 创建新用户

mysql -version

mysqladmin  Ver 8.42 Distrib 5.7.12, for Win64 on x86_64

使用时用insert 的方式创建新用户,报错:

 insert into user
    -> (host,user,authentication_string)
    -> VALUES(‘localhost‘,‘hupi‘,PASSWORD(‘123456‘));
ERROR 1364 (HY000): Field ‘ssl_cipher‘ doesn‘t have a default value

后用以下方式创建成功

 grant usage on *.* to ‘hupi‘@‘localhost‘ identified by ‘123456‘ with grant option;

用户名 hupi ,密码 123456

赋予权限

grant all privileges on *.* to hupi@localhost identified by ‘123456‘;

flush privileges;

 

mysql 创建新用户