自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

MySQL基本操作,新手入門寶典

數(shù)據(jù)庫 MySQL
此文章主要向大家描述的是MySQL基本操作的具體內(nèi)容,如果你對MySQL基本操作有一定的興趣的話,以下的文章你一定不要錯(cuò)過。

以下的文章主要向大家描述的是MySQL基本操作,MySQL在實(shí)際操作中是經(jīng)常被用到的,所以對MySQL的基本內(nèi)容的了解也是一件很重要的事項(xiàng),以下的文章就是對MySQL基本操作的詳細(xì)描述。

登陸數(shù)據(jù)庫

 

D:\phpStudy\MySQL\bin>MySQL -uroot -proot

 

查看數(shù)據(jù)庫

MySQL> show databases;

 

選擇數(shù)據(jù)庫

MySQL> use bugfree;

 

設(shè)置字符集

MySQL> set names 'gbk';

 

查詢數(shù)據(jù)庫中的表

MySQL> show tables;

 

MySQL基本操作創(chuàng)建表

MySQL> create table test(

 

-> tid int(10) not null,

 

-> tname varchar(100) not null,

 

-> tdate datetime not null default '0000-00-00',

 

-> primary key (tid));

 

查看表結(jié)構(gòu)

MySQL> desc test;

 

添加列

MySQL> alter table test add(tage int(3));

 

修改原表結(jié)構(gòu)

MySQL> alter table test modify tage int(5) not null;

 

修改列的默認(rèn)值

MySQL> alter table test alter tage set default '0';

 

去掉列的默認(rèn)值

MySQL> alter table test alter tage drop default;

 

刪除列

MySQL> alter table test drop column tage;

 

插入數(shù)據(jù)

MySQL> insert into test(tid,tname,tdate) value(1,'yangjuqi','2008-03-21');

 

查詢數(shù)據(jù)

MySQL> select * from test;

 

模糊查詢

MySQL> select * from test where tname like '%楊%';

 

修改數(shù)據(jù)

MySQL> update test set tname='張三' where tid='2';

 

MySQL基本操作刪除數(shù)據(jù)

MySQL> delete from test where tid='2';

 

刪除表

MySQL> drop table test;

 

重命名表

MySQL> alter table test rename testbak;

 

分頁查詢(limit 起始行,取多少行)

MySQL> select * from testbak limit 2,1;

 

刷新數(shù)據(jù)庫

MySQL> flush privileges;

 

顯示數(shù)據(jù)庫版本

MySQL> select version();

 

顯示當(dāng)前時(shí)間

MySQL> select current_date;

 

修改用戶密碼

D:\phpStudy\MySQL\bin>MySQLadmin -uroot -proot password yangjuqi

 

將查詢出的數(shù)據(jù)寫入文件

MySQL> select * from testbak into outfile "d:/test.txt" fields terminated by ",";

 

查看數(shù)據(jù)庫狀態(tài)

MySQL> status;

 

MySQL基本操作查看所有編碼

MySQL> show variables like 'character_set_%';

 

導(dǎo)入sql文件命令

MySQL>source d:/MySQL.sql;

 

 【編輯推薦】

  1. MySQL數(shù)據(jù)庫備份的命令實(shí)際應(yīng)用
  2. MySQL 5.5.3 發(fā)布情況介紹
  3. MySQL使用備忘的實(shí)際操作步驟概述
  4. MySQL數(shù)據(jù)庫服務(wù)啟動(dòng)不了的解決方案
  5. MySQL數(shù)據(jù)庫的基本操作演示
責(zé)任編輯:佚名 來源: 博客園
相關(guān)推薦

2013-12-24 10:04:01

PostgreSQL

2011-02-21 17:51:39

Zimbra入門新手

2011-01-10 14:36:00

新手linux基礎(chǔ)

2011-05-31 16:47:47

SEO

2010-06-08 16:22:20

2011-05-18 09:52:28

2013-09-02 10:23:14

2009-01-22 10:31:28

2010-05-14 18:31:17

MySQL 定時(shí)數(shù)據(jù)備

2010-06-10 10:31:36

MySQL出錯(cuò)代碼列表

2010-06-23 15:00:50

Fix協(xié)議

2011-03-22 11:06:52

Nagios安裝

2010-09-09 13:40:19

XML DOM

2018-04-17 11:00:13

數(shù)據(jù)庫MySQL命令大全

2009-06-16 11:11:00

基本規(guī)則Java程序

2010-06-21 15:27:38

Linux apt-g

2011-06-30 17:41:46

SEO

2010-06-19 13:47:39

AMF協(xié)議

2009-07-16 09:07:46

Linux使用技巧Linux入門Linux開發(fā)

2010-05-17 09:52:55

虛擬化VMware Play
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)