创建用户的 3 方法: 1 .create user userName identifed by 'yourPassword'; 2. grant select on *.* to userName@'host' identified by 'yourpassword'; 3. insert into mysql.user(Host,User,Password) values('%','A',password('yourPassword')); 修改用户的密码: set password for…
服务器上好多库,为了不让某用户误操作别人的数据库,给他单独建个用户并授权. insert into mysql.user(Host,User,Password, ssl_cipher, x509_issuer, x509_subject) values("192.168.1.2","test",password("123"), '', '', ''); FLUSH PRIVILEGES; grant all privileges on test.…
昨日内容回顾 外键的变种三种关系: 多对一: 左表的多 对右表一 成立 左边的一 对右表多 不成立 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…
一.数据库概述 1.什么是数据(Data) 描述事物的符号记录称为数据,描述事物的符号既可以是数字,也可以是文字.图片,图像.声音.语言等,数据由多种表现形式,它们都可以经过数字化后存入计算机. 在计算机中描述一个事物,就需要抽取这一事物的典型特征,组成一条记录,如: 1,alex,male,18,1999 单纯的一条记录并没有任何意义,如果我们按逗号分隔,依次定义各个字段的意思,相当于定义表的标题,如下表格: id name sex age birth 1 alex female 19 199…