com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establish

因为你的mysql安装目录下的my.ini中设定的并发连接数太少或者系统繁忙导致连接数被占满


解决方式:

打开MYSQL安装目录打开MY.INI找到max_connections(在大约第93行)默认是100 一般设置到500~1000比较合适,重启mysql,这样1040错误就解决啦。

max_connections=1000


(2)

今天在写sql时遇到一个说在MySQL4.1中子查询是不能使用LIMIT的,手册中也明确指明 This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME subquery

解决办法:这样的语句是不能正确执行的。 
select * from table where id in (select id from table limit 10);

 

但是,只要你再来一层就行。如:

select * from table where id in (select t.id from (select * from table limit 10)as t)

你可能感兴趣的:(mysql)