mysql常用命令orderby_MySQL常用命令总结
MySQL数据库对大小写不敏感,如id和ID,select和SELECT.。
1.数据库
create database 创建数据库
use 连接数据库
注:use表示当前连接上了哪个数据库,并不会影响对其他数据库的访问
如: use db_1;
select * from db_2.logs
drop database 删除数据库,不会提箱
drop database if exists 如果存在,删除数据库
show databases 查询所有数据库
select version() 查询数据库版本
select database() 查询数据库名称
2.表
show tables 查询所有表
create table ( [,... ] ) 创建数据库
drop table 删除表
drop table if exist 如果存在,删除表
rename table to
delete from where 删除表中数据
insert into [([,.. ])] values ( 值1 )[, ( 值n )] 插入数据
update set 字段=值, ... where 更新表中数据
select from where order by limit m,n group by having 查询
alert table add [... 其他] 给表增加字段
alert table drop 删除表中的字段
alert table change 修改表中字段
show index from 查询索引
show keys from 查询索引
alert table add index () 给表添加索引
alert table add unique () 给表添加唯一索引
alert table add primary key () 给表中的主键添加索引
3.备份
mysqldump -u -p > 导出的文件名 导出数据库,导出文件默认在mysql/bin目录下
mysqldump -u -p > 导出的文件名
总结
以上是生活随笔为你收集整理的mysql常用命令orderby_MySQL常用命令总结的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 3个字的游戏名字249个
- 下一篇: 卸载linux下的mysql数据库实例_