MySQL的基本入門操作

2021-09-12 11:52:43 字數 2342 閱讀 2905

首先讓我們介紹一下mysql的基本入門操作,熟悉一下mysql,接下來都有詳細步驟

建立乙個資料庫

建立乙個資料表

檢視該資料表,看看是否成功

接下來我們來做mysql修改,要注意每乙個步驟:

1.將c_contact欄位插入到c_birth欄位後面。

檢查是否成功修改,請記住每一步都是關鍵,方便你錯誤後容易檢查是**出錯

將c_name欄位資料型別改為 varchar(70)

觀察該資料表的變化

將c_contact欄位改名為c_phone

觀察該資料表的變化

增加c_gender欄位,資料型別為char(1)《預設新增在已有字段後面》

alter table customers add c_gender char(1);
觀察該資料表的變化

desc customers;
將表名修改為customer_info

alter table customers rename to customer_info;
觀察該資料表名的變化

desc customer_info;
刪除欄位c_city

alter table customer_info drop c_city;
觀察該資料表的變化

desc customer_info;
刪除資料表的儲存引擎為myisam.《內鍵需要》

alter table customer_info engine=myisam;
檢視資料表引擎的變化

show create table (表名)

show create table customer_info;
這期完

mysql入門基本操作

1 開啟資料庫服務 net start mysql 停止資料庫服務 net stop mysql 解除安裝 sc delete mysql 詳細說明 登入到 mysql 當 mysql 服務已經執行時,我們可以通過mysql自帶的客戶端工具登入到mysql資料庫中,首先開啟命令提示符,輸入以下格式的...

mysql基本操作 MySQL基本操作

mysql中新增使用者,新建資料庫,使用者授權,刪除使用者,修改密碼 注意每行後邊都跟個 表示乙個命令語句結束 1.新建使用者 1.1 登入mysql mysql u root p 密碼 1.2 建立使用者 mysql insert into mysql.user host,user,passwor...

mysql 基本操作 mysql基本操作

mysql 建立表,並設定主鍵自增 create table log logid int 4 primary key not null auto increment,logtitle varchar 32 not null logcontent varchar 160 not null logtim...