数据库的常用命令

建表:

CREATE TABLE student (
    -> id INT(4),
    -> name VARCHAR(20),
    -> sex CHAR(1));

插入数据:

insert into student(student_no,name,age) values(101,"Alice",18);

查找数据:

select * from student where id = 5;

查看当前事物级别:

SELECT @@tx_isolation;

设置mysql的隔离级别:

set session transaction isolation level 
//设置read uncommitted级别:
set session transaction isolation level read uncommitted;

//设置read committed级别:
set session transaction isolation level read committed;

//设置repeatable read级别:
set session transaction isolation level repeatable read;

//设置serializable级别:
set session transaction isolation level serializable;

怎么查看空闲连接列表?

show processlist;

你可能感兴趣的:(数据库的常用命令)