首页 > 代码库 > 【SQL篇章--基于MySQL5.7--创建用户】
【SQL篇章--基于MySQL5.7--创建用户】
SQL:
创建用户:>=MySQL5.7.6
查看用户:
mysql> select user,host,authentication_string from mysql.user;
ALTER USER:
ALTER USER [IF EXISTS]USER() IDENTIFIED BY ‘auth_string‘;
ADDING USER ACCOUNT:
CREATE USER ‘finley‘@‘localhost‘ IDENTIFIED BY ‘some_pass‘; GRANT ALL PRIVILEGES ON *.* TO ‘finley‘@‘localhost‘ WITH GRANT OPTION;
CREATE USER ‘finley‘@‘%‘ IDENTIFIED BY ‘some_pass‘; GRANT ALL PRIVILEGES ON *.* TO ‘finley‘@‘%‘ WITH GRANT OPTION;
mysql> CREATE USER ‘admin‘@‘localhost‘ IDENTIFIED BY ‘admin_pass‘;
mysql> GRANT RELOAD,PROCESS ON *.* TO ‘admin‘@‘localhost‘;
mysql> CREATE USER ‘dummy‘@‘localhost‘;
mysql> SHOW CREATE USER ‘admin‘@‘localhost‘\G
*************************** 1. row ***************************
CREATE USER for admin@localhost:
CREATE USER ‘admin‘@‘localhost‘ IDENTIFIED WITH ‘mysql_native_password‘ AS ‘*67ACDEBDAB923990001F0FFB017EB8ED41861105‘ REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK
DROP USER:
DROP USER ‘jeffrey‘@‘localhost‘;
【SQL篇章--基于MySQL5.7--创建用户】
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。