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

MySQL數(shù)據(jù)庫的基本操作演示

數(shù)據(jù)庫 MySQL
此文章主要是向大家講述的是MySQL數(shù)據(jù)庫的基本操作,如果你是其方面的新手,那么以下的文章對你而言一定很有意義。

以下的文章主要向大家描述的是MySQL數(shù)據(jù)庫的基本操作,提及MySQL數(shù)據(jù)庫我們大家對其可能都會有一定的了解,今天我們就和大家一起討論一下MySQL數(shù)據(jù)庫的基本操作,望你能有所收獲。

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

 

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

 

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

MySQL> show databases;

 

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

MySQL> use bugfree;

 

設置字符集

MySQL> set names 'gbk';

 

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

MySQL> show tables;

 

MySQL數(shù)據(jù)庫的基本操作 ;創(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));

 

查看表結構

MySQL> desc test;

 

添加列

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

 

修改原表結構

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

 

修改列的默認值

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

 

去掉列的默認值

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 '%楊%';

 

MySQL數(shù)據(jù)庫的基本操作 :修改數(shù)據(jù)

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

 

刪除數(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();

 

顯示當前時間

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> show variables like 'character_set_%';

 

導入sql文件命令

以上的相關內(nèi)容就是對MySQL數(shù)據(jù)庫的基本操作的介紹,望你能有所收獲。

【編輯推薦】

  1. MySQL修改root密碼的3種方法介紹
  2. MySQL存儲過程中的語法學習
  3. MySQL存儲過程中的基本函數(shù)描述
  4. MySQL數(shù)據(jù)庫內(nèi)存調(diào)優(yōu)實操
  5. Python編程語言操作MySQL數(shù)據(jù)庫實戰(zhàn)演習
責任編輯:佚名 來源: 博客園
相關推薦

2010-06-12 09:53:19

2010-05-12 18:41:34

MySQL數(shù)據(jù)庫

2019-11-07 15:39:36

數(shù)據(jù)庫MySQL文章

2010-06-09 17:36:45

MySQL數(shù)據(jù)庫同步

2010-06-04 09:33:28

連接MySQL數(shù)據(jù)庫

2010-06-12 17:55:23

MySQL數(shù)據(jù)庫同步

2010-06-04 10:40:55

AJAX MySQL

2010-05-13 14:07:39

MySQL數(shù)據(jù)庫

2010-06-07 16:22:55

MySQL數(shù)據(jù)庫

2010-06-02 11:34:23

MySQL 數(shù)據(jù)庫導入

2010-03-04 13:47:13

Python操作Acc

2010-06-01 14:42:55

連接MySQL數(shù)據(jù)庫

2010-05-25 14:05:52

MySQL數(shù)據(jù)庫

2011-06-27 12:56:28

2010-05-25 08:49:33

連接MySQL

2010-05-26 14:24:24

MySQL數(shù)據(jù)庫

2010-05-28 13:21:48

MySQL數(shù)據(jù)庫

2019-10-21 13:52:14

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

2010-06-01 12:51:23

MySQL數(shù)據(jù)庫

2010-06-04 15:32:18

MySQL數(shù)據(jù)庫
點贊
收藏

51CTO技術棧公眾號