首先下载MySql,下载地址为https://dev.mysql.com/downloads/windows/installer/5.7.html
MySQL安装成功后,需要配置到环境变量,配置成功后,就可以登录到MySQL了,客户端登录的命令具体为:
mysql -h localhost -u root -p
database:数据库
table:表 表里面存储数据都是行列的模式
数据类型:
1、varchar(20)
2、int
3、double
create database databaseName;
show databases;
drop database databaseName;
use databaseName;
select database();
select version();
status;
select now();
select now() as 当前时间
show variables like '%connection%';
show variables like '%timeout%';
show tables;
create table tableName(Field Type(size));
desc tableName;
show create table tableName \G;
show create table tableName \g;
create table user(name varchar(20),age int,address varchar(80))ENGINE=InnoDB DEFAULT CHARSET=utf8;
rename table oldTableName to newTableName;
alter table tableName add addFiled type first; desc tableName;
alter table user add addFiled type after existFiled; desc tableName;
alter table user add addFiled type; desc tableName;
alter table tableName change oldFiled newFiled type; desc tableName;
alter table tableName modify Field newType;
alter table tableName drop Field;
create table user(Field type comment "注释");
alter table tableName modify Field type comment "注释";
insert into std_info(name) values("zhangsan"); select * from std_info;
insert into std_info values("zhangsan",10); select * from std_info;
insert into std_info values("zhangsan",10),("lisi",20),("wangwu",30); select * from std_info;