MySQL 建立外來鍵報錯Can't write; duplicate key in table
mysql> create table orders2(id int auto_increment primary key, customer_id int, description varchar(50), constraint fk_orders foreign key (customer_id) references customer(id));
ERROR 1105 (HY000): Can't write; duplicate key in table 'orders2'
報錯原因:
外來鍵名稱已經存在,更換一個外來鍵名稱
mysql> create table orders2(id int auto_increment primary key, customer_id int, description varchar(50), constraint fk_orders2 foreign key (customer_id) references customer2(id));
Query OK, 0 rows affected (0.22 sec)
ERROR 1105 (HY000): Can't write; duplicate key in table 'orders2'
報錯原因:
外來鍵名稱已經存在,更換一個外來鍵名稱
mysql> create table orders2(id int auto_increment primary key, customer_id int, description varchar(50), constraint fk_orders2 foreign key (customer_id) references customer2(id));
Query OK, 0 rows affected (0.22 sec)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26506993/viewspace-2144449/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MYSQL報1022錯誤:Can't write;duplicate key in table '.....'MySql
- MySQL報錯Table 'plugin' is read only [ERROR] Can't open the mysql.plugin table.MySqlPluginError
- Can't use function return value in write context 使用empty遇到報錯FunctionContext
- [ERROR] Can't open the mysql.plugin tableErrorMySqlPlugin
- Mysql報錯Fatal error:Can't open and lock privilege tablesMySqlError
- mysql建立外來鍵語句MySql
- mysql 使用foreign key(外來鍵)MySql
- MySQL 啟動報錯 Table 'mysql.plugin' doesn't existMySqlPlugin
- 外來鍵刪除(T-SQL Drop Foreign Key)SQL
- mysql中You can’t specify target table for update in FROM clMySql
- Mysql update in報錯 [Err] 1093 - You can't specify target table 'company_info' for update in FROM clauseMySql
- MySQL 5.5 原始碼安裝報錯"[ERROR] Can't start server"MySql原始碼ErrorServer
- Mysql truncate table時解決外來鍵關聯MySql
- eslint --fix 報錯 can't not find modulesEsLint
- MongoDB報錯:"assertion" : "can't map file memory"MongoDB
- mysql [ERROR] InnoDB: ./ibdata1 can't be opened in read-write modeMySqlError
- Mysql 外來鍵(FOREIGN KEY)使用注意事項MySql
- mysql匯入報錯Variable 'sql_notes' can't be set to the value of 'NULL'MySqlNull
- MySQL 5.5 關閉資料庫報錯"Can't connect to local MySQL server through socket"MySql資料庫Server
- Java中List集合轉Map集合報錯:Duplicate keyJava
- mysql 刪除老是報外來鍵約束MySql
- MySQL報錯'ERROR 2002 (HY000): Can't connect to local MySQL server through'MySqlErrorServer
- mysql INSERT ... ON DUPLICATE KEY UPDATEMySql
- MYSQL的外來鍵MySql
- mysql 啟動報錯Can't connect to local MySQL server through socket '/data/mysql/mysql/mysql.sock'(111)MySqlServer
- 【MySQL】ERROR 1005 (HY000): Can't create table' (errno: 150)MySqlError
- Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist解決辦法ErrorMySql
- Can't find keyplane that supports type 4 for keyboard iPhone PortraitTiPhoneAI
- You can‘t specify target table ‘Person‘ for update in FROM clause
- mysql報CanMySql
- MySQL_插入更新 ON DUPLICATE KEY UPDATEMySql
- [轉] mysql 外來鍵(Foreign Key)的詳解和例項MySql
- mysql中的外來鍵MySql
- 連線MySQL錯誤:Can't connect to MySQL server (10060)MySqlServer
- vue報錯之Duplicate keys detected: '0'. This may cause an update error.VueError
- MySQL insert on duplicate key update 死鎖MySql
- MySQL錯誤1042-Can't get hostname for your addressMySql
- Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock錯誤MySqlServer