Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Mysql´íÎ󼯽õ£¨Linux£©


 
1£º Can’t connect to [local] MySQL server´íÎó
Ò»¸öMySQL¿Í»§¿ÉÒÔÁ½ÖÖ²»Í¬µÄ·½Ê½Á¬½Ómysqld·þÎñÆ÷£ºUnixÌ×½Ó×Ö£¬Ëüͨ¹ýÔÚÎļþϵͳÖеÄÒ»¸öÎļþ(ȱʡ“/tmp /mysqld.sock”)½øÐÐÁ¬½Ó£»»òTCP/IP£¬Ëüͨ¹ýÒ»¸ö¶Ë¿ÚºÅÁ¬½Ó¡£UnixÌ×½Ó×Ö±ÈTCP/IP¸ü¿ì£¬µ«ÊÇÖ»ÓÐÓÃÔÚÁ¬½Óͬһ̨¼ÆËã»úÉϵķþÎñÆ÷¡£Èç¹ûÄã²»Ö¸¶¨Ö÷»úÃû»òÈç¹ûÄãÖ¸¶¨ÌØÊâµÄÖ÷»úÃûlocalhost£¬Ê¹ÓÃUnixÌ×½Ó×Ö¡£
´íÎó(2002£©Can’t connect to ...ͨ³£Òâζ×ÅûÓÐÒ»¸öMySQL·þÎñÆ÷ÔËÐÐÔÚϵͳÉÏ»òµ±ÊÔͼÁ¬½Ómysqld·þÎñÆ÷ʱ£¬ÄãÕýÔÚʹÓÃÒ»¸ö´íÎóµÄÌ×½Ó×ÖÎļþ»òTCP/IP¶Ë¿Ú¡£  
Óɼì²é(ʹÓÃps)ÔÚÄãµÄ·þÎñÆ÷ÉÏÓÐÒ»¸öÃûΪmysqldµÄ½ø³ÌÆô¶¯£¡Èç¹ûûÓÐÈκÎmysqld¹ý³Ì£¬ÄãÓ¦¸ÃÆô¶¯Ò»¸ö¡£¼û4.15.2 Æô¶¯MySQL·þÎñÆ÷µÄÎÊÌâ¡£
Èç¹ûÒ»¸ömysqld¹ý³ÌÕýÔÚÔËÐУ¬Äã¿ÉÒÔͨ¹ý³¢ÊÔÕâЩ²»Í¬µÄÁ¬½ÓÀ´¼ì²é·þÎñÆ÷(µ±È»£¬¶Ë¿ÚºÅºÍÌ×½Ó×Ö·¾¶Ãû¿ÉÄÜÔÚÄãµÄ°²×°ÖÐÊDz»Í¬µÄ)£º
shell> mysqladmin version
shell> mysqladmin variables
shell> mysqladmin -h `hostname` version variables
shell> mysqladmin -h `hostname` --port=3306 version
shell> mysqladmin -h ’ip for your host’ version
shell> mysqladmin --socket=/tmp/mysql.sock version
 
×¢ÒâhostnameÃüÁîʹÓ÷´ÒýºÅ“`”¶ø·ÇÕýÒýºÅ“’”£»ÕâЩµ¼ÖÂhostnameÊä³ö£¨¼´£¬µ±Ç°Ö÷»úÃû)±»´úÌæ½ømysqladminÃüÁîÖС£
ÕâÊÇ¿ÉÄÜÔì³ÉCan’t connect to local MySQL server´íÎóµÄһЩԭÒò£º  
mysqld²»ÔÚÔËÐС£  
ÄãÕýÔÚʹÓÃMIT-pthreadsµÄÒ»¸öϵͳÉÏÔËÐС£Èç¹ûÕýÔÚÔËÐÐÔÚÒ»¸öûÓÐÔ­ÉúÏ̵߳ÄϵͳÉÏ£¬mysqldʹÓà MIT-pthreads Èí¼þ°ü¡£¼û4.2 ÓÉMySQLÖ§³ÖµÄ²Ù×÷ϵͳ¡£È»¶ø£¬MIT-pthreads²»Ö§³ÖUnixÌ×½Ó×Ö£¬Òò´Ëµ±Óë·þÎñÆ÷Á¬½Óʱ£¬ÔÚÕâÑùÒ»¸öϵͳÉÏ£¬Äã×ÜÊDZØÐëÃ÷È·µØÖ¸¶¨Ö÷»úÃû¡£ÊÔÊÔʹÓÃÕâ¸öÃüÁî¼ì²éµ½·þÎñÆ÷µÄÁ¬½Ó£º
shell> mysqladmin -h `hostname` version
 
ijÈËɾ³ýÁËmysqldʹÓõÄUnixÌ×½Ó×Ö(ȱʡ“/tmp/mysqld.sock”)¡£Äã¿ÉÄÜÓÐÒ»¸öcronÈÎÎñɾ³ýÁËMySQLÌ×½Ó×Ö(ÀýÈ磬һ¸ö°Ñ¾ÉÎļþ´Ó“/tmp”Ŀ¼ÖÐɾ³ýµÄÈÎÎñ)¡£Äã×ÜÊÇ¿ÉÒÔÔËÐÐmysqladmin version²¢ÇÒ¼ì²émysqladminÕýÔÚÊÔͼʹÓõÄÌ×½Ó×Öȷʵ´æÔÚ¡£ÔÚÕâÖÖÇé¿öÏ£¬ÐÞ¸´·½·¨ÊÇɾ³ýcronÈÎÎñ¶ø²»É¾³ý“mysqld.sock »ò½«Ì×½Ó×Ö·ÅÔÚÆäËûµØ·½¡£ÄãÄÜÓÃÕâ¸öÃüÁ


Ïà¹ØÎĵµ£º

Linux+Apache+Mysql+PhpÏêϸ°²×°Îĵµ

ËùÐèÈí¼þÔ´´úÂë°ü£º
httpd-2.2.4.tar.gz   mysql-5.0.27.tar.gz   php-5.2.1.tar.bz2
freetype-2.3.2.tar.gz   gd-2.0.34.tar.gz   jpegsrc.v6b.tar.gz
libpng-1.2.8.tar.bz2   libxml2-2.6.24.tar.bz2  zlib-1.2.2.tar.gz
°²×°Ë³Ðò£ºapache -> mysql ......

mysql ʱ¼ä¶Î²éѯ

24СʱÄڼǼ£¨¼´86400Ã룩
$sql="SELECT video_id,count(id)as n from `rec_down` WHERE UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(add_time)<=86400 group by video_id order by n desc ";
$sql="select a.id,a.title,b.n from video_info a,(".$sql.")b where a.id=b.video_id order by n desc limit 20";
NÌìÄڼǼ ......

mysql ʹÓÃrandËæ»ú²éѯ¼Ç¼ЧÂʲâÊÔ

Ò»Ö±ÒÔΪmysqlËæ»ú²éѯ¼¸ÌõÊý¾Ý£¬¾ÍÓÃ
SELECT
 
*
 
from
 `
table

ORDER
 
BY
 
RAND
() LIMIT 
5
¾Í¿ÉÒÔÁË¡£
µ«ÊÇÕæÕý²âÊÔһϲŷ¢ÏÖÕâÑùЧÂʷdz£µÍ¡£Ò»¸ö15ÍòÓàÌõµÄ¿â£¬²éѯ5ÌõÊý¾Ý£¬¾ÓȻҪ8ÃëÒÔÉÏ
²é¿´¹Ù·½ÊֲᣬҲ˵rand()·ÅÔÚORDER BY ×Ó¾äÖлᱻִÐж ......

java¶ÁÈ¡mysqlÊý¾Ý¿âlatin1±ÜÃâÂÒÂë·½·¨

дÈëʱ£¬ÏÈ×öencode£º
public static String encode(String src) {
String result = null;
try {
result = new String(src.getBytes("gbk"), "ISO-8859-1");
} catch (UnsupportedEncodingException uee) {
System.err.println(uee);
}
return result;
}
¶Á³öʱ£¬ÔÙ×ödecode£º
public static String deco ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ