MySQL甯歌閿欒鍒嗘瀽涓庤В鍐虫柟娉曟�荤粨

涓�銆丆an't connect to MySQL server on 'localhost' (10061)

缈昏瘧锛氫笉鑳借繛鎺ュ埌 localhost 涓婄殑mysql

鍒嗘瀽锛氳繖璇存槑鈥渓ocalhost鈥濊绠楁満鏄瓨鍦ㄧ殑锛屼絾鍦ㄨ繖鍙版満鍣ㄤ笂鍗存病鎻愪緵MySQL鏈嶅姟銆�

闇�瑕佸惎鍔ㄨ繖鍙版満鍣ㄤ笂鐨凪ySQL鏈嶅姟,濡傛灉鏈哄瓙璐熻浇澶珮娌$┖鐩稿簲璇锋眰涔熶細浜х敓杩欎釜閿欒銆�

瑙e喅:鏃㈢劧娌℃湁鍚姩閭e氨鍘诲惎鍔ㄨ繖鍙版満瀛愮殑mysql銆傚鏋滃惎鍔ㄤ笉鎴愬姛锛屽鏁版槸鍥犱负浣犵殑my.ini閰嶇疆鐨勬湁闂銆傞噸鏂伴厤缃叾鍗冲彲銆�

濡傛灉瑙夊緱mysql璐熻浇寮傚父锛屽彲浠ュ埌mysql/bin 鐨勭洰褰曚笅鎵цmysqladmin -uroot -p123 processlist鏉ユ煡鐪媘ysql褰撳墠鐨勮繘绋嬨��

浜屻�乁nknown MySQL Server Host 'localhosadst' (11001)

缈昏瘧锛氭湭鐭ョ殑MySQL鏈嶅姟鍣� localhosadst

鍒嗘瀽锛氭湇鍔″櫒 localhosasdst 涓嶅瓨鍦ㄣ�傛垨鑰呮牴鏈棤娉曡繛鎺�

瑙e喅锛氫粩缁嗘鏌ヨ嚜宸辫鍧涗笅闈㈢殑 ./config.inc.php鎵惧埌$dbhost閲嶆柊璁剧疆涓烘纭殑mysql 鏈嶅姟鍣ㄥ湴鍧�銆�

涓夈�丄ccess denied for user: 'roota@localhost' (Using password: YES)

缈昏瘧锛氱敤鎴� roota 璁块棶 localhost 琚嫆缁濓紙娌℃湁鍏佽閫氳繃锛�

鍒嗘瀽锛氶�犳垚杩欎釜閿欒涓�鑸暟鎹簱鐢ㄦ埛鍚嶅拰瀵嗙爜鐩稿mysql鏈嶅姟鍣ㄤ笉姝g‘

瑙e喅锛氫粩缁嗘鏌ヨ嚜宸辫鍧涗笅闈㈢殑 ./config.inc.php 鎵惧埌$dbuser銆�$dbpw鏍稿疄鍚庨噸鏂拌缃繚瀛樺嵆鍙��

鍥涖�丄ccess denied for user: 'red@localhost' to database 'newbbs'

缈昏瘧锛氱敤鎴� red 鍦╨ocalhost 鏈嶅姟鍣ㄤ笂娌℃湁鏉冮檺鎿嶄綔鏁版嵁搴搉ewbbs

鍒嗘瀽锛氳繖涓彁绀哄拰闂涓夋槸涓嶅悓鐨勩�傞偅涓槸鍦ㄨ繛鎺ユ暟鎹簱鐨勬椂鍊欏氨琚樆姝簡锛岃�岃繖涓敊璇槸鍦ㄥ鏁版嵁搴撹繘琛屾搷浣滄椂寮曡捣鐨勩�傛瘮濡傚湪select update绛夌瓑銆傝繖涓槸鍥犱负璇ョ敤鎴锋病鏈夋搷浣滄暟鎹簱鐩稿簲鐨勬潈鍔涖�傛瘮濡俿elect 杩欎釜鎿嶄綔鍦╩ysql.user.Select_priv閲岃褰� Y 鍙互鎿嶄綔N 涓嶅彲浠ユ搷浣溿��

瑙e喅锛氬鏋滄槸鑷繁鐨勭嫭绔嬩富鏈洪偅涔堟洿鏂癿ysql.user 鐨勭浉搴旂敤鎴疯褰曪紝姣斿杩欓噷瑕佹洿鏂扮殑鐢ㄦ埛涓簉ed 銆傛垨鑰呯洿鎺ヤ慨鏀� ./config.inc.php 涓哄叾閰嶇疆涓�涓叿鏈夊鏁版嵁搴撴搷浣滄潈闄愮殑鐢ㄦ埛

鎴栬�呴�氳繃濡備笅鐨勫懡浠ゆ潵鏇存柊鎺堟潈grant all privileges on dbname.* to 'user'@'localhost' identified by 'password鈥�

鎻愮ず锛氭洿鏂颁簡mysql搴撲腑鐨勮褰曚竴瀹氳閲嶅惎mysql鏈嶅姟鍣ㄦ墠鑳戒娇鏇存柊鐢熸晥

FLUSH PRIVILEGES;

浜斻�丯o Database Selected

缈昏瘧锛氭病鏈夋暟鎹簱琚�夋嫨涓�

鍒嗘瀽锛氫骇鐢熺殑鍘熷洜鏈変袱绉�

config.inc.php 閲岄潰$dbname璁剧疆鐨勪笉瀵广�傝嚧浣挎暟鎹簱鏍规湰涓嶅瓨鍦紝鎵�浠ュ湪 $db->select_db($dbname); 鏃惰繑鍥炰簡false

鍜屼笂闈㈤棶棰樺洓鏄竴鏍风殑锛屾暟鎹簱鐢ㄦ埛娌℃湁select鏉冮檺锛屽悓鏍蜂細瀵艰嚧杩欐牱鐨勯敊璇�傚綋浣犲彂鐜癱onfig.inc.php鐨勮缃病鏈変换浣曢棶棰橈紝浣嗚繕鏄彁绀鸿繖涓敊璇紝閭d竴瀹氬氨鏄繖绉嶆儏鍐典簡銆�

瑙e喅锛氬鐥囦笅鑽�

鎵撳紑config.inc.php 鎵惧埌$dbname鏍稿疄閲嶆柊閰嶇疆骞朵繚瀛�

鍚岄棶棰樺洓鐨勮В鍐虫柟娉�

鍏�丆an't open file: 'xxx_forums.MYI'. (errno: 145)

缈昏瘧锛氫笉鑳芥墦寮�xxx_forums.MYI

闂鍒嗘瀽锛�

杩欑鎯呭喌鏄笉鑳芥墦寮� cdb_forums.MYI 閫犳垚鐨勶紝寮曡捣杩欑鎯呭喌鍙兘鐨勫師鍥犳湁锛�

1銆佹湇鍔″櫒闈炴甯稿叧鏈猴紝鏁版嵁搴撴墍鍦ㄧ┖闂村凡婊★紝鎴栦竴浜涘叾瀹冩湭鐭ョ殑鍘熷洜锛屽鏁版嵁搴撹〃閫犳垚浜嗘崯鍧忋��

2銆佺被 unix 鎿嶄綔绯荤粺涓嬬洿鎺ュ皢鏁版嵁搴撴枃浠舵嫹璐濈Щ鍔ㄤ細鍥犱负鏂囦欢鐨勫睘缁勯棶棰樿�屼骇鐢熻繖涓敊璇��

瑙e喅鏂规硶锛�

1銆佷慨澶嶆暟鎹〃

鍙互浣跨敤涓嬮潰鐨勪袱绉嶆柟寮忎慨澶嶆暟鎹〃锛氾紙绗竴绉嶆柟娉曚粎閫傚悎鐙珛涓绘満鐢ㄦ埛锛�

1锛変娇鐢� myisamchk 锛孧ySQL 鑷甫浜嗕笓闂ㄧ敤鎴锋暟鎹〃妫�鏌ュ拰淇鐨勫伐鍏� 鈥斺�� myisamchk 銆傛洿鏀瑰綋鍓嶇洰褰曞埌 MySQL/bin 涓嬮潰锛屼竴鑸儏鍐典笅鍙湁鍦ㄨ繖涓笅闈㈡墠鑳借繍琛� myisamchk 鍛戒护銆傚父鐢ㄧ殑淇鍛戒护涓猴細myisamchk -r 鏁版嵁鏂囦欢鐩綍/鏁版嵁琛ㄥ悕.MYI锛�

2锛夐�氳繃 phpMyAdmin 淇锛� phpMyAdmin 甯︽湁淇鏁版嵁琛ㄧ殑鍔熻兘锛岃繘鍏ュ埌鏌愪竴涓〃涓悗锛岀偣鍑烩�滄搷浣溾�濓紝鍦ㄤ笅鏂圭殑鈥滆〃缁存姢鈥濅腑鐐瑰嚮鈥滀慨澶嶈〃鈥濆嵆鍙��

娉ㄦ剰锛氫互涓婁袱绉嶄慨澶嶆柟寮忓湪鎵ц鍓嶄竴瀹氳澶囦唤鏁版嵁搴撱��

2銆佷慨鏀规枃浠剁殑灞炵粍锛堜粎閫傚悎鐙珛涓绘満鐢ㄦ埛锛�

1锛夊鍒舵暟鎹簱鏂囦欢鐨勮繃绋嬩腑娌℃湁灏嗘暟鎹簱鏂囦欢璁剧疆涓� MySQL 杩愯鐨勫笎鍙峰彲璇诲啓锛堜竴鑸�傜敤浜�Linux鍜� FreeBSD 鐢ㄦ埛锛夈��

涓冦�乀able 'test.xxx_sessions' doesn't exist

缈昏瘧锛歺xxxx琛ㄤ笉瀛樺湪

鍒嗘瀽锛氬湪鎵цsql璇彞鏃舵病鏈夋壘鍒拌〃锛屾瘮濡傦細SELECT * FROM xxx_members WHERE uid=鈥橷X鈥� 杩欓噷濡傛灉琛▁xx_members涓嶅瓨鍦ㄤ簬$dbname搴撻噷锛岄偅涔堝氨浼氭彁绀鸿繖涓敊璇�傚叿浣撳彲鍒嗕负浠ヤ笅涓夌鎯呭喌鏉ヨ璁猴細

瀹夎鎻掍欢鎴栬�卙ack鏃朵慨鏀逛簡绋嬪簭鏂囦欢锛岃�屽繕璁颁簡瀵规暟鎹簱浣滅浉搴旂殑鍗囩骇銆�

鍚庡彴浣跨敤浜嗕笉瀹屽叏澶囦唤锛屽鍏ユ暟鎹椂娌℃湁瀵煎叆鍒板凡缁忓畨瑁呬簡鐩稿簲鐗堟湰鐨勮鍧涚殑鏁版嵁搴撲腑銆�

瑙e喅锛� 鍚屾牱瀵圭棁涓嬭嵂锛屼笉鍚岀殑鍘熷洜涓嶅悓鐨勫鐞嗘柟娉曘��

浠旂粏瀵圭収鎻掍欢浣滆�呮彁渚涚殑瀹夎璇存槑锛屾妸閬楁紡鐨勫鏁版嵁搴撶殑鎿嶄綔琛ヤ笂锛屽鏋滀粛鐒朵笉鑳借В鍐抽棶棰橈紝閭d箞搴旇鎬�鐤戣鎻掍欢鐨勫彲鐢ㄦ�т簡銆傚幓鍜ㄨ涓�涓嬫彃浠朵綔鑰咃紝鎴栬�呭皢鍏跺嵏杞姐��

涓嶈寮犲啝鏉庢埓锛屽澶х殑鑴氬氨绌垮澶х殑闉嬨�傛�讳箣浣垮緱绋嬪簭鏂囦欢鍜屾暟鎹簱閰嶅鍗冲彲.

鍏�乁nknown column 'column_name' in 'field list'

缈昏瘧锛氭湭鐭ョ殑瀛楁鍚� column_name

鍒嗘瀽锛氬湪鎵цsql璇彞鏄嚭鐜颁簡鎸囧畾琛ㄤ腑娌℃湁鐨勫瓧娈靛悕绉帮紝灏变細鍑虹幇杩欎釜閿欒銆傚叿浣撳鑷寸殑鍘熷洜鍙垎涓轰互涓嬩袱绉�

瀹夎鎻掍欢鎴栬�卙ack鏃朵慨鏀逛簡绋嬪簭鏂囦欢锛岃�屽繕璁颁簡瀵规暟鎹簱浣滅浉搴旂殑鍗囩骇銆�

绋嬪簭鏂囦欢鍜屾暟鎹簱涓嶉厤濂楋紝姣斿d2.5鐨勬暟鎹簱閰嶇疆缁檇4.1鐨勭▼搴忔潵鐢ㄨ偗瀹氫細鍑虹幇杩欎釜閿欒銆�

瑙e喅锛� 瀵艰嚧鐨勫師鍥犲拰闂鍏殑1鍜� 3鏄浉鍚岀殑锛屾墍浠ヨВ鍐虫柟娉曚篃涓�鏍枫��

涔濄�乊ou have an error in your SQL syntax

缈昏瘧锛氭湁涓�涓娉曢敊璇湪浣犵殑sql涓�

鍒嗘瀽锛氳鍧涙爣鍑嗙殑绋嬪簭鏄病鏈塻ql璇硶閿欒鐨勩�傛墍浠ラ�犳垚杩欎釜閿欒鐨勫師鍥犱竴鑸氨涓ょ被

瀹夎鎻掍欢鎴栨搮鑷慨鏀圭▼搴忋��

涓嶅悓鐨勬暟鎹簱鐗堟湰鏁版嵁搴撳鍑哄鍏ワ紝姣斿MySQL4.1鐨勬暟鎹湪瀵煎嚭鐨勮鍙ュ寘鍚簡MySQL4.0娌℃湁鐨勫姛鑳斤紝鍍忓瓧绗﹂泦鐨勮瀹氾紝杩欐椂濡傛灉灏嗚繖浜泂ql瀵煎叆鍒癕ySQL4.0鐨勬椂鍊欏氨浼氫骇鐢焥ql璇硶閿欒銆�

瑙e喅锛�

浠旂粏妫�鏌ョ湅鍒板簳鏄摢閲岀殑閿欒锛屽皢鍏朵慨姝o紝瀹炲湪涓嶈灏辩敤鏍囧噯绋嬪簭鎶婂嚭閿欑殑绋嬪簭鏇挎崲銆�

鍦ㄦ暟鎹簱澶囦唤鐨勬椂鍊欒鐣欐剰锛屽鏋滀笉鎵撶畻鍊掑叆鍒板叾浠栫増鏈殑mysql涓垯涓嶇敤鐗规畩鑰冭檻锛屽弽涔嬭鐗规畩鐨勮瀹氥�備娇鐢―Z4.1鐨勫悗鍙版暟鎹浠斤紝鍙互鎸夌収鎻愮ず鍘昏瀹氭兂瑕佺殑鏍煎紡銆傜嫭绔嬩富鏈虹殑涔熷彲浠ュ湪鍒板鐨勬椂鍊欏皢鍏跺鍑轰负mysql4.0鐨勬牸寮忋��

mysqldump -uroot -p --default-character-set=latin1 --set-charset=gbk --skip-opt databse > test.sql

鍗併�丏uplicate entry 'xxx' for key 1

缈昏瘧锛氭彃鍏� xxx 浣跨储寮�1閲嶅

鍒嗘瀽锛氱储寮曞鏋滄槸primary unique杩欎袱涓ょ锛岄偅涔堟暟鎹〃鐨勬暟鎹搴旂殑杩欎釜瀛楁灏卞繀椤讳繚璇佸叾姣忔潯璁板綍鐨勫敮涓�鎬с�傚惁鍒欏氨浼氫骇鐢熻繖涓敊璇��

涓�鑸彂鐢熷湪瀵规暟鎹簱鍐欐搷浣滅殑鏃跺�欙紝渚嬪Discuz!4.1璁哄潧绋嬪簭瑕佹眰鎵�鏈変細鍛樼殑鐢ㄦ埛鍚島sername蹇呴』鍞竴锛屽嵆username鐨勭储寮曟槸 unique锛岃繖鏃跺鏋滃己琛屽線cdb_members琛ㄩ噷鎻掑叆涓�涓凡鏈夌殑username鐨勮褰曞氨浼氬彂涓婅繖涓敊璇紝鎴栬�呭皢涓�鏉¤褰曠殑username鏇存柊 涓哄凡鏈夌殑涓�涓猽sername銆�

鏀瑰彉琛ㄧ粨鏋勭殑鏃跺�欎篃鏈夊彲鑳藉鑷磋繖涓敊璇�備緥濡� Discuz!4.0璁哄潧鐨勬暟鎹簱涓璫db_members.username 鐨勭储寮曠被鍨嬫槸index杩欎釜鏃跺�欐槸鍏佽鏈夌浉鍚寀sername鐨勮褰曞瓨鍦ㄧ殑锛屽湪鍗囩骇鍒�4.1鐨勬椂鍊欙紝鍥犱负瑕佸皢username鐨勭储寮曠敱鍘熸潵鐨刬ndex鍙� 涓簎nique銆傚鏋滆繖鏃禼db_members閲屽瓨鍦ㄦ湁鐩稿悓鐨剈sername鐨勮褰曪紝閭d箞灏变細寮曞彂杩欎釜閿欒銆�

瀵煎嚭鏁版嵁鎹椂鏈夋椂浼氬洜涓轰竴浜涘師鍥狅紙浣滆�呯洰鍓嶈繕涓嶆竻妤氾級瀵艰嚧鍚屼竴鏉¤褰曡閲嶅瀵煎嚭锛岄偅涔堣繖涓浠芥暟鎹湪瀵煎叆鐨勬椂鍊欏嚭鐜拌繖涓敊璇槸鍦ㄦ墍闅惧厤鐨勪簡銆�

淇敼浜哸uto_increment鐨勫�硷紝鑷翠娇鈥滀笅涓�涓� Autoindex鈥濅负涓�鏉″凡缁忓瓨鍦ㄧ殑璁板綍

瑙e喅锛� 涓ょ鎬濊矾锛屼竴鏄牬鍧忔帀鍞竴鎬х殑绱㈠紩銆備簩鏄妸閲嶅鐨勬暟鎹褰曞共鎺夛紝鍙繚鐣欎竴鏉°�傚緢鏄剧劧绗竴绉嶆�濊矾鏄笉鍙彇鐨勩�傞偅涔堟寜鐓т簩鐨勬�濊矾鎴戜滑寰楀嚭浠ヤ笅鍑犵瑙e喅鏂规硶锛屽搴斾笂闈㈢殑i ii iii

鐣�

鎸夌収閿欒鎻愮ず閲岀殑淇℃伅鍒版暟鎹簱涓皢閲嶅鐨勮褰曞垹闄わ紝浠呬繚鐣欎竴鏉″嵆鍙�備箣鍚庣户缁墽琛屽崌绾ф搷浣溿��

杩欑鎯呭喌鍙戠敓鐨勬鐜囧緢灏忥紝鍙互鐢ㄦ枃鏈紪杈戝櫒鎵撳紑澶囦唤鏂囨。锛屾煡鎵鹃噸澶嶇殑淇℃伅銆傚皢鍏跺浣欑殑鎷挎帀锛屼粎淇濈暀涓�鏉″嵆鍙��

鏌ヨ鍑鸿〃涓璦uto_increment鏈�澶х殑涓�鏉¤褰曪紝璁剧疆auto_incerment姣斿叾澶т竴鍗冲彲銆�

PS锛歳epaire table "琛ㄥ悕鈥滐紝鍙互鏆傛椂瑙e喅闂銆�

鍗佷竴銆� Duplicate key name 'xxx'

缈昏瘧锛氱储寮曞悕閲嶅

鍒嗘瀽锛氳鍒涘缓鐨勭储寮曞凡缁忓瓨鍦ㄤ簡锛屽氨浼氬紩鍙戣繖涓敊璇紝杩欎釜閿欒澶氬彂鐢熷湪鍗囩骇鐨勬椂鍊欍�傚彲鑳芥槸宸茬粡鍗囩骇杩囩殑锛岄噸澶嶅崌绾у紩璧风殑閿欒銆備篃鏈夊彲鑳芥槸涔嬪墠鐢ㄦ埛鎿呰嚜鍔犵殑绱㈠紩锛屽垰濂戒笌鍗囩骇鏂囦欢涓殑鎵�浠ョ浉鍚屼簡銆�

瑙e喅锛� 鐪嬬湅宸茬粡瀛樺湪鐨勭储寮曞拰瑕佹坊鍔犵殑绱㈠紩鏄惁涓�鏍凤紝涓�鏍风殑璇濆彲浠ヨ烦杩囪繖鏉ql璇彞锛屽鏋滀笉涓�鏍烽偅涔堢幇鍒犻櫎宸插瓨鍦ㄧ殑鎵�浠ワ紝涔嬪悗鍐嶆墽琛屻��

鍗佷簩銆� Duplicate column name 'xxx'

缈昏瘧锛氬瓧娈靛悕xxx閲嶅

鍒嗘瀽锛氭坊鍔犵殑瀛楁xxx宸茬粡瀛樺湪锛屽鍙戠敓鍦ㄥ崌绾ц繃绋嬩腑锛屼笌闂鍗佷簩鐨勪骇鐢熸槸涓�鏍风殑銆�

瑙e喅锛� 鐪嬩竴涓嬪凡缁忓瓨鍦ㄧ殑瀛楁鏄惁鍜屽皢瑕佹坊鍔犵殑瀛楁灞炴�у畬鍏ㄧ浉鍚岋紝濡傛灉鐩稿悓鍒欏彲浠ヨ烦杩囦笉鎵ц杩欏彞sql锛屽鏋滀笉涓�鏍峰垯鍒犻櫎鎺夎繖涓瓧娈点�備箣鍚庣户缁墽琛屽崌绾х▼搴忋��

鍗佷笁銆� Table 'xxx' already exists

缈昏瘧锛氭暟鎹〃xxx宸茬粡瀛樺湪

鍒嗘瀽锛歺xx琛ㄥ凡缁忓瓨鍦ㄤ簬搴撲腑锛屽啀娆¤瘯鍥惧垱寤鸿繖涓悕瀛楃殑琛ㄥ氨浼氬紩鍙戣繖涓敊璇�傚悓鏍峰鍙戠敓鍦ㄨ鍧涚殑鍗囩骇涓�傜被浼间簬闂鍗佷簩銆�

瑙e喅锛� 鐪嬬湅宸茬粡瀛樺湪鐨勮〃鏄惁鍜屽皢瑕佸垱寤虹殑琛ㄥ畬鍏ㄤ竴鏍凤紝涓�鏍风殑璇濆彲浠ヨ烦杩囦笉鎵ц杩欎釜sql锛屽惁鍒欒灏嗗瓨鍦ㄧ殑琛ㄥ厛鍒犻櫎锛屼箣鍚庣户缁墽琛屽崌绾ф枃浠躲��

鍗佸洓銆� Can't create database 'xxx'. Database exists

缈昏瘧锛氫笉鑳藉垱寤烘暟鎹簱xxx锛屾暟鎹簱宸茬粡瀛樺湪

鍒嗘瀽锛氫竴涓猰ysql涓嬮潰鐨勬暟鎹簱鍚嶇О蹇呴』淇濊瘉鍞竴鎬э紝鍚﹀垯灏变細鏈夎繖涓敊璇��

瑙e喅锛氭妸宸茬粡瀛樺湪鐨勬暟鎹簱鏀瑰悕鎴栬�呮妸灏嗚鍒涘缓鐨勬暟鎹簱鏀瑰悕锛屾�讳箣涓嶈浠栦滑鐨勫悕绉板啿绐併��

鍗佷簲銆� 灏忕粨锛堥拡瀵归棶棰� 11\12\13\14\15锛�

姝ょ被闂閿欒鎻愮ず涓兘鏆楄棌涓�涓叧閿瘝duplicate锛堥噸澶嶏級

閭d箞瀵逛簬mysql鏁版嵁搴撴潵璇翠粈涔堜笢瑗挎槸涓嶈兘閲嶅鐨勫憿锛�

鏁版嵁搴� database

鍚屼竴涓暟鎹簱涓嬫暟鎹〃 table

鍚屼竴涓暟鎹〃涓嬪瓧娈� column

鍚屼竴涓暟鎹〃涓嬬储寮� key

鍚屼竴涓暟鎹〃鍦ㄧ储寮曞敮涓�锛圲NIQUE PRIMARY锛夌殑鎯呭喌涓嬭褰曚腑鐨勮繖浜涘瓧娈典笉鍙互閲嶅

鍗佸叚銆乁nknown system variable 'NAMES'

缈昏瘧锛氭湭鐭ョ殑绯荤粺鍙橀噺NAMES

鍒嗘瀽锛歁ysql鐗堟湰涓嶆敮鎸佸瓧绗﹂泦璁惧畾锛屾鏃跺己琛岃瀹氬瓧绗﹂泦灏变細鍑虹幇杩欎釜閿欒銆�

瑙e喅锛� 灏唖ql璇彞涓殑SET NAMES 鈥榵xx鈥� 璇彞鍘绘帀

鍗佷竷銆� Lost connection to MySQL server during query

缈昏瘧锛歁ySQL鏈嶅姟鍣ㄥけ鍘昏繛鎺ュ湪鏌ヨ鏈熼棿

鍒嗘瀽锛氳繙绋嬭繛鎺ユ暟鎹簱鏄湁鏃朵細鏈夎繖涓棶棰樸�侻ySQL鏈嶅姟鍣ㄥ湪鎵ц涓�鏉ql璇彞鐨勬椂鍊欏け鍘讳簡杩炴帴閫犳垚鐨勩��

瑙e喅锛� 涓�鑸笉闇�瑕佹�庝箞鍘诲鐞嗭紝濡傛灉棰戠箒鐨勫嚭鐜伴偅涔堣�冭檻鏀瑰杽纭欢鐜銆�

鍗佸叓銆乁ser 'red' has exceeded the 'max_updates' resource (current value: 500)

缈昏瘧锛歮sql鐢ㄦ埛red宸茬粡瓒呰繃浜�'max_updates'锛堟渶澶ф洿鏂版鏁帮級锛�'max_questions'锛堟渶澶ф煡璇㈡鏁帮級锛�'max_connections'锛堟渶澶ц繛鎺ユ暟锛夛紝褰撳墠璁惧畾涓�500

鍒嗘瀽锛氬湪mysql鏁版嵁搴撶殑涓嬫湁涓�涓簱涓簃ysql锛屽畠鍏朵腑鏈変竴涓〃涓簎ser杩欓噷闈㈢殑绾綍姣忎竴鏉¢兘瀵瑰簲涓轰竴涓猰ysql鐢ㄦ埛鐨勬巿鏉冦�傚叾涓瓧娈� max_questions max_updates max_connections鍒嗗埆璁板綍鐫�鏈�澶ф煡璇㈡鏁� 鏈�澶ф洿鏂版暟 鏈�澶ц繛鎺ユ暟锛屽綋鐩墠鐨勪换浣曚竴涓弬鏁板ぇ浜庝换浣曚竴涓瀹氱殑鍊煎氨浼氫骇鐢熻繖涓敊璇��

瑙e喅锛� 鐙珛涓绘満鐢ㄦ埛鍙互鐩存帴淇敼鎺堟潈琛ㄣ�備慨鏀瑰畬涔嬪悗閲嶅惎mysql鎴栬�呰窡鏂版巿鏉冭〃锛岃繘鍏ysql鎻愮ず绗︿笅鎵ц

FLUSH PRIVILEGES;

璁板緱鍚庨潰瑕佹湁鍒嗗彿鈥�;鈥�

铏氭嫙涓绘満鐨勭敤鎴峰鏋滄�绘槸鍑虹幇杩欎釜闂鍙壘绌洪棿鍟嗗崗鍟嗚В鍐炽��

鍗佷節銆乀oo many connections (1040)閾炬帴杩囧

缈昏瘧锛氳揪鍒版渶澶ц繛鎺ユ暟

闂鍒嗘瀽锛�

杩炴帴鏁拌秴杩囦簡mysql璁剧疆鐨勫�硷紝涓巑ax_connections 鍜寃ait_timeout 閮芥湁鍏崇郴銆倃ait_timeout鐨勫�艰秺澶э紝杩炴帴鐨勭┖闂茬瓑寰呭氨瓒婇暱锛岃繖鏍峰氨浼氶�犳垚褰撳墠杩炴帴鏁拌秺澶�

瑙e喅鏂规硶锛�

1.铏氭嫙涓绘満鐢ㄦ埛璇疯仈绯荤┖闂村晢浼樺寲 MySQL 鏈嶅姟鍣ㄧ殑閰嶇疆锛�

2.鐙珛涓绘満鐢ㄦ埛璇疯仈绯绘湇鍔″櫒绠$悊鍛樹紭鍖� MySQL 鏈嶅姟鍣ㄧ殑閰嶇疆锛屽彲鍙傝�冿細

淇敼 MySQL 閰嶇疆鏂囦欢 my.ini 鎴栬�� my.cnf 涓殑鍙傛暟锛�

max_connections= 1000

wait_timeout = 10

淇敼鍚庨噸鍚� MySQL 锛屽鏋滅粡甯告�х殑鎶ユ閿欒锛岃鍋氫竴涓嬫湇鍔″櫒鐨勬暣浣撲紭鍖栥��

浜屽崄銆乀here is no such grant defined for user '%s' on host '%s'

閿欒缂栧彿锛�1141

闂鍒嗘瀽锛�

MySQL 褰撳墠鐢ㄦ埛鏃犳潈璁块棶鏁版嵁搴撱��

瑙e喅鏂规硶锛�

1銆佽櫄鎷熶富鏈虹敤鎴疯鑱旂郴绌洪棿鍟嗭紝纭缁欎綘鎻愪緵鐨勫笎鍙锋槸鍚︽湁鎺堟潈鏁版嵁搴撶殑鏉冮檺銆�

2銆佺嫭绔嬩富鏈虹敤鎴疯鑱旂郴鏈嶅姟鍣ㄧ鐞嗗憳锛岀‘璁ょ粰鎮ㄦ彁渚涚殑鏁版嵁搴撳笎鍙锋槸鍚︽湁绠$悊姝ゆ暟鎹簱鐨勬潈闄愩��

浜屽崄涓�銆丒rror on rename of '%s' to '%s' (errno: %d)

error.:1025

闂鍒嗘瀽锛�

璇锋鏌ヤ竴涓嬫偍鐨勭▼搴忔槸鍚︽湁淇敼鏁版嵁搴撹〃鍚嶇殑璇彞銆�

瑙e喅鏂规硶锛�

1.璇锋鏌ユ偍鐨勭▼搴忎腑鍝簺鍦版柟闇�瑕佷慨鏀规暟鎹簱琛ㄥ悕锛�

2.濡傛灉鎮ㄧ殑瀹為檯搴旂敤纭疄闇�瑕佷慨鏀瑰埌鏁版嵁搴撹〃鍚嶇殑璇濓紝璇疯仈绯荤┖闂村晢鎴栬�呮湇鍔″櫒绠$悊鍛樼粰鎮ㄥ紑鏀句慨鏀瑰簱鍚嶇殑鏉冮檺鍜屾湇鍔″櫒鏈韩鏄惁姝e父銆�

浜屽崄浜屻�丒rror reading file '%s' (errno: %d)

error.:1023

闂鍒嗘瀽锛�

鏁版嵁搴撴枃浠朵笉鑳借璇诲彇銆�

瑙e喅鏂规硶锛�

1.铏氭嫙涓绘満鐢ㄦ埛璇疯仈绯荤┖闂村晢鏌ョ湅鏁版嵁搴撴槸鍚﹀畬濂姐��

2.鐙珛涓绘満鐢ㄦ埛璇疯仈绯绘湇鍔″櫒绠$悊鍛樻鏌ヤ竴涓� MySQL 鏈韩鏄惁姝e父锛� MySQL 鏄惁鍙互璇诲彇鏂囦欢锛孡inux 鐢ㄦ埛鍙互妫�鏌ヤ竴涓� MySQL 鐨勬暟鎹簱鏂囦欢鐨勫睘涓绘槸鍚︽纭互鍙婃湰韬殑鏂囦欢鏄惁鎹熷潖銆�

浜屽崄涓夈�丠ost '*****' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'

error.:1129

闂鍒嗘瀽锛�

鏁版嵁搴撳嚭鐜板紓甯革紝璇烽噸鍚暟鎹簱銆�

瑙e喅鏂规硶锛�

1. 鐢变簬瀛樺湪寰堝杩炴帴閿欒锛屼富鏈�'****'琚睆钄斤紝铏氭嫙涓绘満鐢ㄦ埛璇疯仈绯荤┖闂村晢澶勭悊锛岀嫭绔嬩富鏈虹敤鎴疯鑱旂郴鏈嶅姟鍣ㄧ鐞嗗憳锛屽湪 MySQL 鐨勫懡浠ゆ帶鍒跺彴涓嬫墽琛�'mysqladmin flush-hosts'瑙i櫎灞忚斀鍗冲彲锛屾垨鑰呴噸鍚� MySQL 鏁版嵁搴�

浜屽崄鍥涖�乨ropping database (can't delete '%s', errno: %d)

error.:1009

闂鍒嗘瀽锛�

涓嶈兘鍒犻櫎鏁版嵁搴撴枃浠讹紝瀵艰嚧鍒犻櫎鏁版嵁搴撳け璐ャ��

瑙e喅鏂规硶锛�

1.妫�鏌ユ偍浣跨敤鐨勬暟鎹簱绠$悊甯愬彿鏄惁鏈夋潈闄愬垹闄ゆ暟鎹��

2.妫�鏌ユ暟鎹簱鏄惁瀛樺湪銆�

浜屽崄浜斻�丟ot error 28 from table handler

error.:1030

闂鍒嗘瀽锛�

鏁版嵁搴撴墍鍦ㄧ鐩樼┖闂村凡婊°��

瑙e喅鏂规硶锛�

1.铏氭嫙涓绘満鐢ㄦ埛璇疯仈绯荤┖闂村晢澧炲姞 MySQL 鎵�鍦ㄧ殑纾佺洏绌洪棿鎴栬�呮竻鐞嗕竴浜涙棤鐢ㄦ枃浠讹紱

2.鐙珛涓绘満鐢ㄦ埛璇疯仈绯绘湇鍔″櫒绠$悊鍛樺鍔� MySQL 鎵�鍦ㄧ殑纾佺洏绌洪棿鎴栬�呮竻鐞嗕竴浜涙棤鐢ㄦ枃浠�

浜屽崄鍏�丆an't create a new thread; if you are not out of available memory, you can consult the manual for a possible OS-dependent bug銆�

error.:11/35

闂鍒嗘瀽锛�

鏁版嵁搴撴湇鍔″櫒闂锛屾暟鎹簱鎿嶄綔鏃犳硶鍒涘缓鏂扮嚎绋嬨�備竴鑸槸涓や釜鍘熷洜锛�

1.鏈嶅姟鍣ㄧ郴缁熷唴瀛樻孩鍑恒��

2.鐜杞欢鎹熷潖鎴栫郴缁熸崯鍧忋��

瑙e喅鏂规硶锛�

1.铏氭嫙涓绘満鐢ㄦ埛璇疯仈绯讳笅绌洪棿鍟嗘暟鎹簱鏈嶅姟鍣ㄧ殑鍐呭瓨鍜岀郴缁熸槸鍚︽甯搞��

2.鐙珛涓绘満鐢ㄦ埛璇疯仈绯绘湇鍔″櫒绠$悊鍛樻鏌ユ湇鍔″櫒鐨勫唴瀛樺拰绯荤粺鏄惁姝e父锛屽鏋滄湇鍔″櫒鍐呭瓨绱у紶锛岃妫�鏌ヤ竴涓嬪摢浜涜繘绋嬫秷鑰椾簡鏈嶅姟鍣ㄧ殑鍐呭瓨锛屽悓鏃惰�冭檻鏄惁澧炲姞鏈嶅姟鍣ㄧ殑鍐呭瓨鏉ユ彁楂樻暣涓殑璐熻浇鑳藉姏銆�

浜屽崄涓冦�丒rror: Client does not support authentication protocol requested by server; consider upgrading MySQL client

error.:1251

闂鍒嗘瀽锛�

濡傛灉浣犲崌绾� MySQL 鍒� 4.1 浠ヤ笂鐗堟湰鍚庨亣鍒颁互涓婇棶棰�,璇峰厛纭畾浣犵殑 MySQL Client 鏄� 4.1 鎴栬�呮洿楂樼増鏈�(Windows涓嬫湁闂浣犲氨鐩存帴璺冲埌涓嬮潰鐪嬭В鍐虫柟娉曚簡锛屽洜涓� MySQL 鍦� Windows 鏄� client 鍜� server 涓�璧疯涓婁簡鐨�)銆�

瑙e喅鏂规硶锛�

1. Windows 骞冲彴

涓昏鏄敼鍙樿繛鎺� MySQL 鐨勫笎鎴风殑鍔犲瘑鏂瑰紡锛孧ySQL 4.1/5.0 鏄�氳繃 PASSWORD 杩欑鏂瑰紡鍔犲瘑鐨勩�傚彲浠ラ�氳繃浠ヤ笅涓ょ鏂规硶寰楀埌瑙e喅锛�

1) mysql->SET PASSWORD FOR 'some_user'@'some_host'=OLD_PASSWORD('new_password');

2) mysql->UPDATE mysql.user SET Password=OLD_PASSWORD('new_password') WHERE Host='some_host' AND User='some_user';

2. Linux/Unix 骞冲彴

Linux 骞冲彴涓嬮鍏堢‘瀹氭槸鍚﹀畨瑁呰繃 MySQL 鐨勫鎴风锛岃繖涓敤 rpm 瀹夎寰堢畝鍗曪紝Linux 浠g爜涓猴細

rpm -ivh MySQL-client-4.1.15-0.i386.rpm

鐒跺悗鍦ㄧ紪璇� php 鐨勬椂鍊欒鍔犱笂锛�

--with-mysql=/your/path/to/mysql

涓�鑸儏鍐典笅閮藉彲浠ヨВ鍐炽�傚鏋滆繕鍑虹幇杩欑閿欒锛屽彲浠ユ寜鐓т笅闈㈢殑鏂规硶鏉ュ仛锛�

mysql->SET PASSWORD FOR 'some_user'@'some_host'=OLD_PASSWORD('new_password');

mysql->UPDATE mysql.user SET Password=OLD_PASSWORD('new_password') WHERE Host='some_host' AND User='some_user';

浜屽崄鍏�丒rror: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

error.:2002

闂鍒嗘瀽锛�

鍑虹幇杩欎釜閿欒涓�鑸儏鍐典笅鏄洜涓轰笅闈袱涓師鍥狅細

1.MySQL 鏈嶅姟鍣ㄦ病鏈夊紑鍚��

2.MySQL 鏈嶅姟鍣ㄥ紑鍚簡锛屼絾涓嶈兘鎵惧埌 socket 鏂囦欢銆�

瑙e喅鏂规硶锛�

1.铏氭嫙涓绘満鐢ㄦ埛锛岃鑱旂郴绌洪棿鍟嗙‘璁ゆ暟鎹簱鏄惁姝e父鍚姩銆�

2.鐙珛涓绘満鐢ㄦ埛锛岃妫�鏌ヤ竴涓� MySQL 鏈嶅姟鏄惁宸茬粡寮�鍚紝娌℃湁寮�鍚紝璇峰惎鍔� MySQL 鏈嶅姟锛涘鏋滃凡缁忓紑鍚紝骞朵笖鏄� Linux 绯荤粺锛岃妫�鏌ヤ竴涓� MySQL 鐨� socket 鐨勮矾寰勶紝鐒跺悗鎵撳紑 config.inc.php 鎵惧埌

$dbhost = 'localhost'; 鍦� hostname 鍚庨潰鍔犲啋鍙封��:鈥欏拰 MySQL 鐨� socket 鐨勮矾寰勩��

姣斿 MySQL 鏈嶅姟鍣ㄤ负 localhost

MySQL 鐨� socket 鐨勮矾寰勪负 /tmp/mysql.sock

閭d箞灏辨敼鎴愬涓嬶細

$dbhost = 'localhost:/temp/mysql.sock';

浜屽崄涔濄�丆an't connect to MySQL server on 'localhost'

error.:2003

闂鍒嗘瀽锛�

MySQL 鏈嶅姟娌℃湁鍚姩锛屼竴鑸槸鍦ㄥ紓甯哥殑鎯呭喌涓� MySQL 鏃犳硶鍚姩瀵艰嚧鐨勶紝姣斿鏃犲彲鐢ㄧ殑纾佺洏绌洪棿锛宮y.ini 閲� MySQL 鐨� basedir 璺緞璁剧疆閿欒绛夈��

瑙e喅鏂规硶锛�

1.妫�鏌ョ鐩樼┖闂存槸鍚﹁繕鏈夊墿浣欏彲鐢ㄧ┖闂达紝灏介噺淇濇寔鏈夎冻澶熺殑纾佺洏绌洪棿鍙敤銆�

2.妫�鏌� my.ini 閲岀殑 basedir 绛夊弬鏁拌缃槸鍚︽纭紝鐒跺悗閲嶆柊鍚姩涓� MySQL 鏈嶅姟銆�

涓夊崄銆丩ost connection to MySQL server during query

error.:2013

闂鍒嗘瀽锛�

鏁版嵁搴撴煡璇㈣繃绋嬩腑涓㈠け浜嗕笌 MySQL 鏈嶅姟鍣ㄧ殑杩炴帴銆�

瑙e喅鏂规硶锛�

1.璇风‘璁ゆ偍鐨勭▼搴忎腑鏄惁鏈夋晥鐜囧緢浣庣殑绋嬪簭锛屾瘮濡傛煇浜涙彃浠讹紝鍙互鍗歌浇鎺夋彃浠讹紝妫�鏌ヤ竴涓嬫湇鍔″櫒鏄惁姝e父锛�

2.鏈嶅姟鍣ㄦ湰韬祫婧愮揣寮狅紝铏氭嫙涓绘満鐢ㄦ埛璇疯仈绯荤┖闂村晢纭锛岀嫭绔嬩富鏈虹敤鎴疯鑱旂郴鏈嶅姟鍣ㄧ鐞嗗憳锛屾鏌ヤ竴涓嬫湇鍔″櫒鏄惁姝e父銆�

涓夊崄涓�銆丟ot a packet bigger than \'max_allowed_packet\' bytes

閿欒缂栧彿锛�1153

闂鍒嗘瀽锛氳皟鏁翠簡 Mantis 鐨勪笂浼犻檮浠剁殑澶у皬鍗存病鏈夎皟鏁� MySQL 鐨勯厤缃枃浠躲��

瑙e喅鍔炴硶锛�

1銆佺嫭绔嬩富鏈虹敤鎴疯鎸夌収浠ヤ笅鏂规硶璋冩暣锛�

鏌ユ壘 MySQL 鐨勯厤缃枃浠讹紙my.cnf 鎴栬�� my.ini锛�

鍦� [mysqld] 閮ㄥ垎娣诲姞涓�鍙ワ紙濡傛灉瀛樺湪锛岃皟鏁村叾鍊煎氨鍙互锛夛細

max_allowed_packet=10M

閲嶅惎 MySQL 鏈嶅姟灏卞彲浠ヤ簡銆傝繖閲岃缃殑鏄� 10MB銆�

2銆佽櫄鎷熶富鏈虹敤鎴疯鑱旂郴绌洪棿鍟嗚皟鏁存鍙傛暟銆�

你可能感兴趣的:(MySQL甯歌閿欒鍒嗘瀽涓庤В鍐虫柟娉曟�荤粨)