1、通過命令列連線mysql:2、顯示資料庫、表:
3、命令列查詢表結構show
databases
;//顯示存在的資料庫
use test;
//test為相對應的資料庫名稱,表示使用某個資料庫
show
tables
;//顯示此資料庫的所有表
4、執行增刪改查:1、desc tabl_name;(查詢表結構資訊)
2、select
*from information_schema.
columns
where table_schema =
'db'
#表所在資料庫 and table_name = 'tablename' ; #你要查的表(查詢表結構資訊)
3、select column_name, column_comment from information_schema.
columns
where table_schema =
'db'
and table_name =
'tablename'
;(只查詢列名、注釋資訊)
4、select table_name,table_comment from information_schema.
tables
where table_schema =
'db'
and table_name =
'tablename'(檢視表的注釋)
5、使用者授權:create
database test;
//建資料庫。名字為test
create
table
user
(id int(4
)not
null
primary
keyauto_increment
,username char(20
)not
null
,password char(20
)not
null);
//建立資料庫,名為user
insert
into
user(1
,'duoduo'
,'921012');
//插入一條資料
select
*from
user
;//查詢所有的資訊
grant
selecton*
.*to'reader'@'%
' identified by '
123456' with
grant
option
flush privileges
mysql 命令列 回車 mysql命令列操作
顯示資料庫 show databases 當前資料庫 select database 顯示表show tables 更改表名稱 alter table 原表名 rename 新錶名 rename table 原表名 to 新錶名 檢視系統支援的引擎 show engines 檢視表的引擎 show ...
命令列操作mysql
一 從命令列登入mysql資料庫伺服器 1 登入使用預設3306埠的mysql usr local webserver mysql bin mysql u root p 2 通過tcp連線管理不同埠的多個mysql 注 mysql4.1以上版本才有此項功能 usr local webserver m...
MySQL命令列操作
一 連線mysql。格式 mysql h主機位址 u使用者名稱 p使用者密碼 1 例1 連線到本機上的mysql。首先在開啟dos視窗,然後進入目錄 mysqlbin,再鍵入命令mysql uroot p,回車後提示你輸密碼,如果剛安裝好mysql,超級使用者root是沒有密碼的,故直接回車即可進入...