《Mysql必讀mysql 基本操作》要點(diǎn):
本文介紹了Mysql必讀mysql 基本操作,希望對(duì)您有用。如果有疑問(wèn),可以聯(lián)系我們。
在window下,啟動(dòng)、停止mysql服務(wù)
啟動(dòng)mysql數(shù)據(jù)庫(kù)
net start mysql
停止mysql數(shù)據(jù)庫(kù)
net stop mysql
重新啟動(dòng)mysql數(shù)據(jù)庫(kù)
net restart mysql
命令行形式,mysql基本命令的使用 1、命令的取消
\c
2、退出mysql窗口
exit;或quit;或ctrl+c
3、查看數(shù)據(jù)庫(kù)版本號(hào)
select version();
4、顯示當(dāng)前存在的數(shù)據(jù)庫(kù)
show databases;
5、選擇test數(shù)據(jù)庫(kù)
use test;
6、查看選擇的數(shù)據(jù)庫(kù)
select database();
7、設(shè)置數(shù)據(jù)庫(kù)中文編碼
set names utf8;
8、創(chuàng)建一個(gè)test數(shù)據(jù)庫(kù)
create database test
9、創(chuàng)建一張mtest表
create table mtest(
id tinyint(2) unsigned not null auto_increment,
name varchar(20),
sex char(1),
email varchar(50),
birth datetime,
primary key (id)
);
10、向mtest表中插入一條數(shù)據(jù)
insert into mtest(`name`,`sex`,`email`,`birth`) values ('zhangsan','1','zhangsan@163.com',now());
11、查詢(xún)mtest表中name為張三的信息
select * from mtest where name='zhangsan';
12、按照id號(hào)降序輸出
select * from mtest order by id desc;
13、顯示第11至20條數(shù)據(jù)信息
select * from mtest id limit 10,10;
轉(zhuǎn)載請(qǐng)注明本頁(yè)網(wǎng)址:
http://www.fzlkiss.com/jiaocheng/5162.html