mysql错误:超过每小时的最大连接数

时间:2013-09-26 17:19:14

标签: php mysql sql

我在同一个域上为Wordpress网站运行php脚本时遇到错误:

Could not connect: User 'abc' has exceeded the 'max_connections_per_hour' resource (current value: 10)

MySql数据库的限制是什么?我现在应该连接数据库吗?

1 个答案:

答案 0 :(得分:3)

你超过了mysql的限制,看看mysql doc,你可以看到:

mysql> GRANT ALL ON customer.* TO 'francis'@'localhost'
->     IDENTIFIED BY 'frank'
->     WITH MAX_QUERIES_PER_HOUR 20
->          MAX_UPDATES_PER_HOUR 10
->          MAX_CONNECTIONS_PER_HOUR 5;

你只需要增加MAX_CONNECTIONS_PER_HOUR或删除限制,只需使用:

mysql> GRANT USAGE ON *.* TO 'francis'@'localhost'
->     WITH MAX_CONNECTIONS_PER_HOUR 0;

要在WordPress上允许持久连接,请看一下这篇文章(我没有测试过自己):http://www.mydigitallife.info/using-php-mysql-persistent-connections-to-run-wordpress-blog/