MySQL資料庫操作相關

2021-09-03 02:36:11 字數 692 閱讀 4261

(1)mysql資料庫設定自增序號,刪除表中資料序號錯亂重新排序

alter table tablename drop column id;

alter table tablename add id mediumint(8) not null primary key auto_increment first;

或alter table tablename auto_increment=0

(2)執行建立表的sql語句設定預設編碼格式

create table `school` (

`id` int(11) not null auto_increment,

`name` varchar(64) character set utf8 collate utf8_unicode_ci not null,

`acttime` datetime not null,

primary key (`id`)

) engine=innodb default charset=latin1;

character set utf8 collate utf8_unicode_ci

設定預設編碼utf-8,不區分大小寫ci不區分大小寫,cs區分大小寫

Mysql資料庫相關操作

檢視約束 show indexes from tab name 檢視索引 show index from tab name 檢視資料表的列 show columns from tab name 檢視資料表 show tables 檢視資料庫 show databases 刪除列alter table...

MySQL資料庫相關操作

mysql是乙個關係型資料庫管理系統,目前屬於oracle。採用sql標準化語言,並且體積小 速度快 成本低和開源的特點,搭配php apache可組成良好的開發環境。create table t user id int primary key auto increament comment 自增主...

MySQL資料庫(一)庫相關操作

mysql資料庫 零 ubuntu安裝mysql以及運維相關 注意,安裝之後的預設資料庫有4個,可以通過show databases 檢視 mysql不支援直接更改資料庫名,可以先建立新庫,再把舊庫的表依次移過去 create database new db name 建立新庫 rename tab...