安裝
一路next 需要注意的是:編碼utf-8 設(shè)置密碼
cmd必須以管理員身份運行
net start mysql
net stop mysql
查看服務(wù)進程
- services.msc
登陸(sql命令都以分號結(jié)束)
mysql -uroot -pxw
show databases//查看當前目錄下有哪些數(shù)據(jù)庫
;回車
//會顯示系統(tǒng)已有的數(shù)據(jù)庫,默認有4個
create database test_1; //創(chuàng)建數(shù)據(jù)庫
顯示版本號
select version();
其是不用記這么多sql語句,有個工具sqlyod可以幫你解決所有事情
數(shù)據(jù)庫的使用
show databases;
use test_1;//使用數(shù)據(jù)庫
show tables;//
create table students(id varchar(20),name varchar(50));//創(chuàng)建表,并給它2個字段 id name
show create table students; //查看建表的語句
desc students;// 顯示表
insert into students values('0001','zhangsan');
insert into students values('0002','lisi');
insert into students values('0003','wangwu');
insert into students values('0004','liwu');
select * from students;//查看表中所有類容
select * from students where id='0001';
select * from students where id='0002' and name='lisi';//有時候id一樣
那我想查所有姓李的
select * from students where name like '%li%'; 以什么開頭什么結(jié)束
select * from students where name like '%li%' limit 1;