简体   繁体   English

MySQL查询是否有限制?

[英]Is there a limit to MySQL queries?

I am trying to insert 10,000+ fields into my database? 我想在数据库中插入10,000多个字段? Is there a limit? 有限制吗?

$sql = 'INSERT INTO `_'.$test.'` (`user`, `pass`) VALUES ' . preg_replace($test, $replace, $final_check) . ';';
mysql_query($sql) or die(mysql_error());

Every time I try to insert the data, it fails. 每当我尝试插入数据时,它都会失败。

I believe it's your query. 我相信这是您的查询。 Make sure you are importing the right data, and it shouldn't fail. 确保您导入的数据正确,并且不会失败。
Echo the $sql to test it. 回显$ sql进行测试。

echo $sql

There is a packet size limit in the MySQL protocol. MySQL协议中有一个数据包大小限制。 If your SQL statement exceeds that, it can't send it to the server. 如果您的SQL语句超出该范围,它将无法将其发送到服务器。 The limit was for a very long time 16Mb, but fairly recent versions have raised it higher. 限制时间很长,为16Mb,但是相当新的版本将其提高了。

Also, check that you are enclosing each row's worth of data in it's own parentheses. 另外,请检查是否将每行的数据包含在其自己的括号中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM