一.mysql安装
1. 双击安装
2. 配置环境变量
C:\Program Files\MySQL\MySQL Server 5.7\bin
3. 初始化
mysqld -install
mysqld --initialize
4. 启动服务器
net start mysql
5. 登录(密码data 文件.err文本文件)
mysql -u root -p
输入密码
6. 修改密码
alter user 'root'@'localhost' identified by '123456';
二.链接mysql
1. 安装 Navica
2. 新建链接
填入链接名与密码
3. 右键打开连接
单词
select 选择(查询)
from 从哪儿
user用户表
where 条件,哪儿
1 true
and 并且
like 像
_ 匹配一个
% 匹配多个
limit 1,2 从第一条截取两条信息
order by 排序
asc 升序
desc 降序
查询所有内容
sleect * from user where 1
查询某个用户
select * from user where name = 'zeng8' and password = 'zmm123'
分数大于500
select * from user where score>500
name zengx的_代表任意一个字符
%代表一个或者多个字符
select * from user where name like 'zeng_'
select * from user where name like 'zeng%'
查询所有用户,从第一条开始截取两条
select * from user where 1 limit 1,2
查询所有用户,按分数排序,升序acs,降序desc
select * from user where 1 order by score asc
查询两个字段
select name,score from user where 1
单词:
insert 插入
into 到
user 表明
value 值
insert into user (name,password,score)
values ('zeng11','zmm123',120)
把zeng8的分数改为2500
update user set score=2500 where name='zeng8'
把zeng_分数改变为2500_代表任意字符
update user set score=2500 where name like 'zeng_'
update 更新
user 表
set 设置
score=2500 分数改为2500
where 条件
name="zeng8"名称等于zeng8
delete from user where id=5
删除user中id为5的行
delete 删除
from 从
user