Home > Database > Mysql Tutorial > body text

MySQL最常见的操作语句小结_MySQL

WBOY
Release: 2016-06-01 12:59:47
Original
745 people have browsed it

以下是我这几天一直在用的几个命令,先记下来,以后会整理一份mysql详细的使用文档
注:[]中代表名字,需要用库名或者表名替换
显示所有的库:

show databases;

Copy after login

进入某库:

use [dbname];

Copy after login

显示所有的表:

show tables;

Copy after login

显示某表的字段配置:

describe [tbname];
Copy after login


show full fields from [tbname];
Copy after login

创建库:

create database [dbname];

Copy after login

删除表:

drop database [dbname];

Copy after login

删除表:

drop table [tbname];

Copy after login

导入创建脚本:

mysql -u[user] -p [dbname] < [create.sql] 

Copy after login

(如果没有密码,则不需要-p)

显示每个表的数据存储量等状态:

show table status \G;

Copy after login

 就到这里。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!