mysql³öÏÖunauthenticated user¼òµ¥·ÖÎöÒÔ¼°½â¾ö
µ±ÓÃshow processlist;¿´µ½ÈçÏÂÐÅϢʱ:
LL | login | NULL |
| 697 | unauthenticated user | 218.26.219.186:26944 | NULL | Connect | NULL | login | NULL |
| 699 | unauthenticated user | 218.204.126.130:41099 | NULL | Connect | NULL | login | NULL |
| 700 | unauthenticated user | 201.91.135.204:43806 | NULL | Connect | NULL | login | NULL |
¾¹ý²éÖ¤,²»¹ÜÁ¬½áµÄµÄ·½Ê½ÊǾ¹ý hosts »òÊÇ IP µÄģʽ,Ëû¶¼»á¶Ô DNS ×ö·´²é
mysqld »á³¢ÊÔÈ¥·´²é IP -> dns ,ÓÉÓÚ·´²é½âÎö¹ýÂý,ÎÞ·¨Ó¦¸¶¿ìËÙ¶àÁ¿µÄ²éѯ
½â¾ö°ì·¨:
1¡¢ÐÞ¸Ämy.iniÎļþ,ÔÚ [mysqld] ÐÐÏÂÌí¼Ó¡¡ –skip-name-resolve ,ÖØÐÂÆô¶¯mysql·þÎñ
2¡¢·ÃÎʵÄÖ÷»úÊÚȨʱÓÃIP,×îºÃ°Ñ¸ÃÖ÷»úµÄIP¼°Ö÷»úÃûдµ½/etc/hostsÎļþÖÐ
¾¹ýÒÔÉϵÄÉ趨¼°ÖØÐÂÆô¶¯¹ýºó,Ö±µ½ÏÖÔÚ»¹Ã»Óп´µ½Ò»¸ö unauthenticated user µÄÇé¿ö·¢Éú
½üÈÕ»¹ÊÇ»á³ÖÐøµÄ¹Û²ì Mysql µÄÔË×÷Çé¿ö,ÈçÓÐÎÊÌ⽫»á³ÖÐøµÄÙ÷±¨¼°½â¾ö
¾¹ýÕâÑù´¦Àíºó,¾ÍÖ»ÄÜͨ¹ýlocalhost·ÃÎÊÊý¾Ý¿â,Èç¹ûÔÚ/etc/hosts¼Ó±ðÃûµ½127.0.0.1 ÊDz»ÐеÄ.»á³öÏÖ±¨´í:
[root@X ~]# mysql -h127.0.0.1 -p
Enter password:
ERROR 1130 (00000): Host '127.0.0.1' is not allowed to connect to this MySQL server
ËùÒÔÈç¹ûÔÚʹÓÃÁ˶à¸öMysql·ÃÎÊÖ÷»úÃûʱ,¼¤»î–skip-name-resolve
¾Í»áµ¼ÖÂϵͳֻÔÊÐí localhost·ÃÎÊ.¶ø127.0.0.1·ÃÎʾͻᱻ¾Ü¾ø.
Ïà¹ØÎĵµ£º
1.±³¾°
֮ǰ´ÓûÓùýhibernate£¬Òò´ËÔÚÍøÉÏËÑÁËÒ»ÏÂhibernate¿ìËÙÈëÃÅ·½ÃæµÄÐÅÏ¢£¬×îºóÎÒ°´ÕÕ¡¶Myeclipse Hibernate ¿ìËÙÈëÃÅ ÖÐÎÄ°æ¡·£¨CSDN£¬°Ù¶ÈÎĿⶼÓУ©Ò»ÎÄ¿ªÊ¼ÁËÎÒµÄhibernateÖ®Âã¨ÎªÏîÄ¿×ö¼¼Êõ×¼±¸£©¡£
ÏÂÃ ......
ÎÒÓõÄÊÇmysql5.0£¬
ÎÒ³ÌÐòÖÐÓõ½ÁËÒ»¾äsqlÊÇ
SQL code
select count(DISTINCT id) from Policyinfo p where p.filename not in
(select p2.filename from Policyreadinfo p2 where p2.reader='test')
µ«ÊÇÿ´ÎÔÚ³ÌÐòÖÐÿ´ÎÖ´ÐÐÕâ¾äsqlʱÍøÒ³¾ÍÌØÂý£¬Òª10¶àÃ룬¶øÕâ2¸ö±íµÄ¼Ç¼ÐÐÊýÒ²¾Í1000¶à¶øÒÑ£¬ÎÒ°ÑÕâ¾äsqlµ¥¶ÀÄ ......
²éѯÊÇÊý¾Ý¿â¼¼ÊõÖÐ×î³£ÓõIJÙ×÷¡£²éѯ²Ù×÷µÄ¹ý³Ì±È½Ï¼òµ¥£¬Ê×ÏÈ´Ó¿Í»§¶Ë·¢³ö²éѯµÄSQLÓï¾ä£¬Êý¾Ý¿â·þÎñ¶ËÔÚ½ÓÊÕµ½ÓÉ¿Í»§¶Ë·¢À´µÄSQLÓï¾äºó£¬ Ö´ÐÐÕâÌõSQLÓï¾ä£¬È»ºó½«²éѯµ½µÄ½á¹û·µ»Ø¸ø¿Í»§¶Ë¡£ËäÈ»¹ý³ÌºÜ¼òµ¥£¬µ«²»Í¬µÄ²éѯ·½Ê½ºÍÊý¾Ý¿âÉèÖ㬶ԲéѯµÄÐÔÄܽ«»áÓкÜÔÚµÄÓ°Ïì¡£
Òò´Ë£¬±¾ÎľÍÔÚMySQLÖг£ÓõIJéѯÓÅ»¯¼¼Êõ½ ......
1¡¢¿ØÖÆÃæ°åÀïµÄÔö¼Óɾ³ý³ÌÐòÄÚ½øÐÐɾ³ý
2¡¢É¾³ýMySQLÎļþ¼ÐϵÄmy.iniÎļþ£¬Èç¹û±¸·ÝºÃ£¬¿ÉÒÔÖ±½Ó½«Îļþ¼ÐÈ«²¿É¾³ý
3¡¢¿ªÊ¼->ÔËÐÐ-> regedit ¿´¿´×¢²á±íÀïÕ⼸¸öµØ·½É¾³ýûÓÐ
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog\Application\MySQL Ŀ¼ɾ³ý
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\S ......
ÎҵijÌÐòÊÇÓÃADOÀ´Á¬½ÓMysqÊý¾Ý¿âµÄ£¬ÕâÊÇÔÏÈдºÃÓÃÔÚMSSQLÉϵģ¬¸ÄÁËÏÂÁ¬½Ó×Ö·û´®£¬ËùÒÔÒ²¾ÍûÓÐÓÃMySql C++ APIÀ´ÖØÐÂдÁË¡£¸Õ¿ªÊ¼Ê¹ÓÃMySql£¬Óöµ½µÄÎÊÌâ×ÜÊÇÌرðµÄ¶à£¬ÏÖÔÚÓÖÓöµ½Ò»¸öÖ÷Òªsql×Ö·û´®ÖÐÓÐÖÐÎľͱ¨´íµÄÎÊÌ⣬ûÓÐÖÐÎÄÒ»ÇÐÕý³££¬ÕûÕûŪÁËÒ»¸öÉÏÎ磬ÔÚÍøÉÏÒ²ÕÒÁ˺ܶà×ÊÁÏ£¬·¢ ......