---
title: "用SQL语句不能设置外键——error  1452(23000):cannot add or update a child row:...."
author: "nick714"
date: "2010-08-20T16:08:05Z"
tags: []
categories: ["数据库"]
slug: "sql-error-1452-23000-cannot-add-or-update-a-child-row"
draft: false
lastmod: "2010-08-20T16:08:05Z"
id: 743375
url: "https://nick714.iteye.com/blog/743375"
---

呵呵，今天又遇到一个错误啦，在做项目的时候出现了这个问题，不知道什么原因。想想是不是因为因为数据库相应的表有值啊？将对应的表清空了后，问题就解决了！呵呵