mysql常用命令

2021-09-25 09:06:34 字數 415 閱讀 8336

show databases ; 顯示所有資料庫

use database_name; 進入對應資料庫

show tables; 顯示表

desc table_name; 顯示表字段

show create table 表名; 顯示建立表關係sql語句

\q; 退出mysql資料庫操作

alter table 資料庫名.表名 modify column 欄位名 varchar(32) not null; 修改表字段長度

alter table 表名 add column 欄位名2 int not null default 0 after 欄位名1; 在欄位名1後面新增欄位名2

alter table 表名 change 舊欄位名 新欄位名 not null comment 『備註』; 修改欄位名

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...