mysql 常用,使用經驗

2021-09-08 22:53:05 字數 442 閱讀 2968

mysql default  boolean

字段 `enable` char(1) not null default '1' comment '啟(禁)用',

結果: this.enable ? "1" : "0";

***************===

net start mysql

net stop mysql

***************=

mysql中如果表和表之間建立的外來鍵約束,則無法刪除表及修改表結構。

解決方法是在mysql中取消外來鍵約束:  set foreign_key_checks=0;  

然後將原來表的資料匯出到sql語句,重新建立此表後,再把資料使用sql匯入,

然後再設定外來鍵約束: set foreign_key_checks=1;  

===

Mysql使用經驗集錦

建立資料庫 create database 資料庫名 default character set utf8 collate utf8 bin 建立使用者 create user username identified by password create user username ip ident...

mysql 經驗 mysql經驗

uuid 獲取方法 replace uuid 將uuid 中的 去掉,即替換成空串 此外upper replace uuid 用於將字元轉換為大寫 去除重複 distinct select distinct pwd from t core resident user where empi 8a41b...

Mysql優化常用經驗總結

適當使用查詢快取 當查詢結果確定不大於1行時,使用limit 1 列有固定可選值時,使用enum而不是varchar 為搜尋欄位建索引 join表使用相同的型別,並建立索引 使用explain來優化語句 避免select 永遠為每張表設定id 盡可能使用notnull prepared statem...