Home  >  Article  >  Database  >  MYSQL入门之一_数据库常用命令_MySQL

MYSQL入门之一_数据库常用命令_MySQL

WBOY
WBOYOriginal
2016-06-01 13:38:24878browse

bitsCN.com


MYSQL入门之一_数据库常用命令

 

 1.        登录    

$ mysql--user=root --password=xxxxxx

 

2.        数据库操作

列出所有数据库

mysql> show databases;

创建数据库

mysql> create database x123;

删除数据库

mysql> drop database x123;

连接使用数据库

mysql> use x123;

 

3.        数据表操作

显示数据表

mysql> show tables;

创建数据表

mysql> create table mytable (name VARCHAR(20),sex CHAR(1), birth DATE); 

显示表头

mysql> describe mytable;

向表中插入数据

mysql> insert into mytable values('xieyan','f','1980-01-01');

具体条件查找

mysql> select * from mytable where sex ="f";

模糊条件查找

mysql> select * from mytable where name like"%xie%";

删除数据表

mysql> drop table mytable;

从TXT文件中读取插入数据,SAE不支持load data命令

(TXT文件格式:字段间使用空格分隔,记录间使用换行分隔)

mysql> load data local infile"testme.txt" into table mytable;

bitsCN.com
Statement:
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