Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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 »ò½«Ì×½Ó×Ö·ÅÔÚÆäËûµØ·½¡£ÄãÄÜÓÃÕâ¸öÃüÁ


Ïà¹ØÎĵµ£º

JDBC ¼òµ¥µÄMysqlÁ¬½Ó

/*ÑÝʾһ¸öJDBC³ÌÐò£¬´ÓMysqlµÄLMDÊý¾Ý¿âÖжÁ³ö±íadminµÄÒ»¸öÐÅÏ¢*/
import java.sql.*;
public class TestMysqlConnection {
    public static void main(String[] args) {
        Connection conn = null;
        Statement stmt = ......

MySQL grant Óï·¨µÄÏêϸ½âÎö

ÒÔϵÄÎÄÕÂÊÇMySQL grantÓï·¨µÄÏêϸ½âÎö£¬Èç¹ûÄã¶ÔMySQL grantÓï·¨µÄÏà¹ØµÄʵ¼Ê²Ù×÷ÓÐÐËȤµÄ»°£¬Äã¾Í¿ÉÒÔ¶ÔÒÔϵÄÎÄÕµã»÷¹Û¿´ÁË¡£ÎÒÃÇ´ó¼Ò¶¼ÖªµÀMySQLÊý¾Ý¿â¸³ÓèÓû§È¨ÏÞÃüÁîµÄ¼òµ¥¸ñʽ¿É¸ÅÀ¨Îª£º
grant ȨÏÞ on Êý¾Ý¿â¶ÔÏó to Óû§
Ò»¡¢grant ÆÕͨÊý¾ÝÓû§£¬²éѯ¡¢²åÈë¡¢¸üС¢É¾³ý Êý¾Ý¿âÖÐËùÓбíÊý¾ÝµÄȨÀû¡£
grant ......

LinuxϵÄELFÎļþ¸ñʽ¼ò½é

£¨1£©¸ÅÊö
      Executable and linking format(ELF)ÎļþÊÇx86 LinuxϵͳϵÄÒ»ÖÖ³£ÓÃÄ¿±êÎļþ(object file)¸ñʽ£¬ELFÎļþ¸ñʽ±È½Ï¸´ÔÓ£¬±¾ÎÄÖ»ÊǼòÒª½éÉÜËüµÄ½á¹¹¡£ÓÐÈýÖÖÖ÷ÒªÀàÐÍ£º
(1)ÊÊÓÚÁ¬½ÓµÄ¿ÉÖض¨Î»Îļþ(relocatable file)£¬¿ÉÓëÆäËüÄ¿±êÎļþÒ»Æð´´½¨¿ÉÖ´ÐÐÎļþºÍ¹²ÏíÄ¿±êÎļþ¡£
(2) ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ