Ó¦Ó÷ÃÎÊMysqlÓöµ½µÄÁ¬½ÓÎÊÌâ
×î½üÔÚ×öÒ»¸öСÏîÄ¿£¬¿ª·¢»·¾³£ºÊý¾Ý¿âmysql5.0£¬·þÎñÆ÷Tomcat5.5¡£ÏîÄ¿´ò³Éwar²¿ÊðÔÚtomcatÉÏÖ®ºó£¬Í¨¹ýÓ¦ÓýøÐвéѯ²Ù×÷£¬Èç¹û²Ù×÷¹ýÓÚƵ·±£¬ºǫ́»áÅ×ÈçÏÂÒì³££º
javax.servlet.ServletException: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [08S01]; error code [0]; Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: java.net.BindException: Address already in use: connect
STACKTRACE:
java.net.SocketException: java.net.BindException: Address already in use: connect
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2569)
at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionfromDriverManager(DriverManagerDataSource.java:291)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionfromDriverManager(DriverManagerDataSource.java:277
¡£¡£¡£¡£¡£¡£
ÔÚÍøÉϲéÁ˺ܶà×ÊÁÏ£¬Ò²ÔÚÂÛ̳Àï·¢ÌûÌáÎÊ£¬·¢ÏÖÊÇÁ¬½ÓÊýÕ¼ÓõÄÎÊÌâ¡£Ó¦ÓÃÀïÁ¬½Ó²ÉÓõÄÊÇJDBCÖ±Á¬£¬ºóÀ´¸Ä³ÉÁËͨ¹ý»º³å³ØÁ¬½Ó¡£
»»³É»º³å³ØÁ¬½ÓµÄʱºò£¬³ÌÐò´ò°üҪעÒ⣬³ÌÐòlibϵÄnaming-factory.jar£¬naming-factory-dbcp.jar,naming-resources.jar¶¼ÒªÉ¾µô£¬mysqlµÄÁ¬½Ójar°üҲҪɾµô£¬Ö®ºóÔÙ´ò°ü¡£Í¬Ê±»¹
Ïà¹ØÎĵµ£º
ÒÔÏÂÕª×ÔÍøÂç
----------------------------------------
½ñÌìÔÚÓÃÔ¶³ÌÁ¬½ÓMysql·þÎñÆ÷µÄÊý¾Ý¿â£¬²»¹ÜÔõôŪ¶¼ÊÇÁ¬½Ó²»µ½£¬´íÎó´úÂëÊÇ1130£¬ERROR 1130: Host 192.168.2.159 is not allowed to connect to this MySQL server
²ÂÏëÊÇÎÞ·¨¸øÔ¶³ÌÁ¬½ÓµÄÓû§È¨ÏÞÎÊÌâ¡£½á¹ûÕâÑù×Ó²Ù×÷mysql¿â£¬¼´¿É½â¾ö¡£ÔÚ±¾»úµÇÈëmysqlº ......
²âÊÔ»·¾³£ºmysql 5.0.45 ¡¾×¢£º¿ÉÒÔÔÚmysqlÖÐͨ¹ýmysql> SELECT VERSION();À´²é¿´Êý¾Ý¿â°æ±¾¡¿ÕûÀí£ºWebjx.Com Ò»¡¢Á¬½ÓMYSQL¡£¸ñʽ£º mysql -hÖ÷»úµØÖ· -uÓû§Ãû £pÓû§ÃÜÂë 1¡¢Á¬½Óµ½±¾»úÉϵÄMYSQL¡£Ê×ÏÈ´ò¿ªDOS´°¿Ú£¬È»ºó½øÈëĿ¼mysql\bin£¬ÔÙ¼üÈëÃüÁîmysql -u root -p£¬»Ø³µºóÌáʾÄãÊäÃÜÂë.×¢ÒâÓû§ÃûÇ°¿ÉÒÔÓпոñ ......
ÔÚmysqlÖÐÊäÈëSHOW variables like "have_%"²é¿´£¬ÏÔʾÈçÏ£º
mysql> SHOW variables like "have_%";
+-----------------------+----------+
| Variable_name | Value |
+-----------------------+----------+
| have_archive   ......
ÄãʹÓùý±ðÈ˵ı¸·Ý·½°¸À´±¸·ÝÄãµÄMySQLÊý¾ÝÂð?ÄãÓжà¹ØÐÄÄãµÄÊý¾Ý?Äã¸ÒÈ·¶¨ÄãÏÖÔÚÕýÔÚÔËÐеĽű¾¾ÍÊÇ¿É¿¿µÄ£¬¿É»Ö¸´µÄ±¸·Ý£¬¶øÇÒÔÚÔËÐйý³ÌÖв»»áÓ°ÏìÄãµÄ¹Ø¼ü×÷ÒµÂð?ÔڻشðÕâ¸öÎÊÌâ֮ǰ£¬ÏȻشðÏÂÃæÊ®¸öÎÊÌâ°É£º
¡¡¡¡1. ±¸·ÝÒªÇóÍ£Ö¹Êý¾Ý¿âÂð?Èç¹û²»ÐèÒª£¬ÄÇô±¸·ÝµÄʱºò»áÓ°Ïìʲô?¿éÉ豸?I/O¸ºÔØ?»º³å?»òÕßÊÇÆäËû?
¡¡ ......
½ñÌ쿪¶àÒ»¸öÓ¦ÓÃÔÚ APP SERVER ÉÏ£¬±¨¸æÒ»¸ö´íÎó:
ERROR 1040 (00000): Too many connections
Õâµ¹ÊÇ´ÓÀ´Ã»Åöµ½¹ý£¬²»¹ýÔÚ console Ï¿ÉÒÔÓà root µÇ¼ £¨console ÏÂÓÃÆäËûÓû§Ò²²»¿ÉµÇ¼£¬Too many connections£©
mysql -uroot -p
mysql > show processlist;
...
ÕâÀïÁÐÁË100¸öÁ´½Ó£¡£¡ÆäÖÐÖ»ÓÐ2¸öÁ´½ÓÊÇQ ......