Mysql笔记

来源:互联网 发布:麻依坊服装淘宝 编辑:程序博客网 时间:2024/06/05 18:20



mysql -u root进入mysql

\s 查看状态

show variables ;  查看被指文件中的变量


show variables like 'time_zone'; 查看时区


show variables like 'port';  查看端口




接收集合作为输入,以集合作为输出,可以嵌套

DDL(定义和管理数据对象,创建库,创建表)

create database 库名; 创建数据库

create table 表明;  use库名


drop database 库名 ; 删除数据库

drop table 表名;

DML(对数据进行处理,插入,更新,删除)

insert into users(id ,name) values('1','zhangsan');

update users set name ='aa', age ='10' while id='1';

delete from 表名 where id='2';

DQL(查询数据)


DCL(数据控制,管理权限和数据的更改)


\s 看状态

show databases 看所有库

show tables 看所有表

desc 看表结构

show variables 配置文件中的变量


帮助的使用:

? 

0 0