1.本地环境 CentOS Linux release 7.5.1804 (Core) mysql Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using EditLine wrapper 2.以root用户登录Mysql mysql -uroot -proot 3.切换到mysql数据库 use mysql 4.添加用户 //只允许指定ip连接 create user '新用户名'@'localhost' identified by '密码'; /…
mysql> GRANT ALL PRIVILEGES ON *.* TO monty@localhost IDENTIFIED BY 'something' WITH GRANT OPTION; mysql> GRANT ALL PRIVILEGES ON *.* TO monty@"%" IDENTIFIED BY 'something' WITH GRANT OPTION; mysql> GRANT RELOAD,PROCESS ON *.* TO admin@…
创建用户 CREATE USER 'test'@'localhost' IDENTIFIED BY '123456'; 赋权 GRANT ALL PRIVILEGES ON *.* TO 'test'@'localhost' GRANT ALL PRIVILEGES ON db.* TO 'test'@'localhost' 刷新权限 FLUSH PRIVILEGES…
文章首发于[博客园-陈树义],请尊重原创保留原文链接. 添加用户 以root用户登录数据库,运行以下命令: create user zhangsan identified by 'zhangsan'; 上面的命令创建了用户zhangsan,密码是zhangsan.在mysql.user表里可以查看到新增用户的信息: 授权 命令格式:grant privilegesCode on dbName.tableName to username@host identified by "password&q…
昨日内容回顾 外键的变种三种关系: 多对一: 左表的多 对右表一 成立 左边的一 对右表多 不成立 foreign key(从表的id) refreences 主表的(id) 多对多 建立第三张表(foreign key) 一对一 foreign key+unique 单表查询: (1) where group by: 分组,通过某个字段 select age,count(1) from user group by age having avg(age)>25; having order by…