Mysql常用命令

2021-05-24 01:43:01 字數 1136 閱讀 5854

《資料庫名》

例如:建立乙個名為xhkdb的資料庫   mysql> create database xhkdb;   2、顯示所有的資料庫   命令:show databases (注意:最後有個s)   mysql> show databases;   3、刪除資料庫   命令:drop database

《資料庫名》

例如:刪除名為 xhkdb的資料庫   mysql> drop database xhkdb;   4、連線資料庫   命令: use

《資料庫名》

《表名》

( 《欄位名1>

《型別1>

[,..

《欄位名n>

《型別n>

]);   mysql> create table myclass(   > id int(4) not null primary key auto_increment,   > name char(20) not null,   > *** int(4) not null default '0',   > degree double(16,2));   2、獲取表結構   命令: desc 表名,或者show columns from 表名   mysql>describe myclass   mysql> desc myclass;   mysql> show columns from myclass;   3、刪除表   命令:drop table

《表名》

例如:刪除表名為 myclass 的表   mysql> drop table myclass;   4、插入資料   命令:insert into

《表名》

[( 《欄位名1>

[,..

《欄位名n>

])] values ( 值1 )[,   ( 值n )]   例如,往表 myclass中插入二條記錄, 這二條記錄表示:編號為1的名為tom的成績   為96.45, 編號為2 的名為joan 的成績為82.99,編號為3 的名為wang 的成績為   96.5.   mysql> insert into myclass values(1,'tom',96.45),(2,'joan',82.99),   (2,'wang', 96.59);   5、查詢表中的資料   1)、查詢所有行   命令: select

《欄位1,欄位2,...>

mysql基本常用命令 MySQL常用命令(一)

cmd提示框中的mysql基礎命令 一 命令 連線mysql伺服器 mysql h localhost u root p 展示所有資料庫 show databases 選擇資料庫 use database 展示所選資料下所有表 show tables 設定資料庫編碼 set names gbk 用s...

mysql巡檢常用命令 mysql 常用命令

客戶端連線 進入命令列,windows cmd,連線 mysql u 使用者名稱 p密碼 h 伺服器ip位址 p 伺服器端mysql埠號 d 資料庫名 注意 1 伺服器端口標誌 p一定要大些以區別於使用者 p,如果直接連線資料庫標誌 d也要大寫 2 如果要直接輸入密碼 p後面不能留有空格如 pmyp...

mysql常用命令總結 mySql常用命令總結

總結一下自己常用的mysql資料庫的常用命令 mysql u root p 進入mysql bin目錄後執行,回車後輸入密碼連線。資料庫操作 1 create database dbname 建立資料庫,資料庫名為dbname 2 create database todo default chara...