站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > MySQL 5.1参考手册中文版

Chapter聽2.聽Installing MySQL - MySQL 5.1参考手册中文版

绗2绔狅細瀹夎MySQL

鐩綍

2.1. 涓鑸畨瑁呴棶棰
2.1.1. MySQL鏀寔鐨勬搷浣滅郴缁
2.1.2. 閫夋嫨瑕佸畨瑁呯殑MySQL鍒嗗彂鐗
2.1.3. 鎬庢牱鑾峰緱MySQL
2.1.4. 閫氳繃MD5鏍¢獙鍜屾垨GnuPG楠岃瘉杞欢鍖呯殑瀹屾暣鎬
2.1.5. 瀹夎甯冨眬
2.2. 浣跨敤浜岃繘鍒跺垎鍙戠増鐨勬爣鍑哅ySQL瀹夎
2.3. 鍦╓indows涓婂畨瑁匨ySQL
2.3.1. Windows绯荤粺瑕佹眰
2.3.2. 閫夋嫨瀹夎杞欢鍖
2.3.3. 鐢ㄨ嚜鍔ㄥ畨瑁呭櫒瀹夎MySQL
2.3.4. 浣跨敤MySQL瀹夎鍚戝
2.3.5. 浣跨敤閰嶇疆鍚戝
2.3.6. 閫氳繃闈炲畨瑁匷ip鏂囦欢瀹夎MySQL
2.3.7. 鎻愬彇瀹夎妗f鏂囦欢
2.3.8. 鍒涘缓閫夐」鏂囦欢
2.3.9. 閫夋嫨MySQL鏈嶅姟鍣ㄧ被鍨
2.3.10. 棣栨鍚姩鏈嶅姟鍣
2.3.11. 浠嶹indows鍛戒护琛屽惎鍔∕ySQL
2.3.12. 浠indows鏈嶅姟鏂瑰紡鍚姩MySQL
2.3.13. 娴嬭瘯MySQL瀹夎
2.3.14. 鍦╓indows鐜涓嬪MySQL瀹夎鐨勬晠闅滆瘖鏂笌鎺掗櫎
2.3.15. 鍦╓indows涓嬪崌绾ySQL
2.3.16. Windows鐗圡ySQL鍚孶nix鐗圡ySQL瀵规瘮
2.4. 鍦↙inux涓嬪畨瑁匨ySQL
2.5.鍦∕ac OS X涓畨瑁匨ySQL
2.6. 鍦∟etWare涓畨瑁匨ySQL
2.7. 鍦ㄥ叾瀹冪被Unix绯荤粺涓畨瑁匨ySQL
2.8. 浣跨敤婧愮爜鍒嗗彂鐗堝畨瑁匨ySQL
2.8.1. 婧愮爜瀹夎姒傝堪
2.8.2. 鍏稿瀷閰嶇疆閫夐」
2.8.3. 浠庡紑鍙戞簮鐮佹爲瀹夎
2.8.4. 澶勭悊MySQL缂栬瘧闂
2.8.5. MIT-pthreads娉ㄦ剰浜嬮」
2.8.6. 鍦╓indows涓嬩粠婧愮爜瀹夎MySQL
2.8.7. 鍦╓indows涓嬬紪璇慚ySQL瀹㈡埛绔
2.9. 瀹夎鍚庣殑璁剧疆鍜屾祴璇
2.9.1. Windows涓嬪畨瑁呭悗鐨勮繃绋
2.9.2. Unix涓嬪畨瑁呭悗鐨勮繃绋
2.9.3. 浣垮垵濮婱ySQL璐︽埛瀹夊叏
2.10. 鍗囩骇MySQL
2.10.1. 浠5.0鐗堝崌绾
2.10.2. 鍗囩骇鎺堟潈琛
2.10.3. 灏哅ySQL鏁版嵁搴撴嫹璐濆埌鍙︿竴鍙版満鍣
2.11. 闄嶇骇MySQL
2.12. 鍏蜂綋鎿嶄綔绯荤粺鐩稿叧鐨勬敞鎰忎簨椤
2.12.1. Linux娉ㄦ剰浜嬮」
2.12.2. Mac OS X娉ㄦ剰浜嬮」
2.12.3. Solaris娉ㄦ剰浜嬮」
2.12.4. BSD娉ㄦ剰浜嬮」
2.12.5. 鍏跺畠Unix娉ㄦ剰浜嬮」
2.12.6. OS/2娉ㄦ剰浜嬮」
2.13. Perl瀹夎娉ㄦ剰浜嬮」
2.13.1. 鍦║nix涓畨瑁匬erl
2.13.2. 鍦╓indows涓嬪畨瑁匒ctiveState Perl
2.13.3. 浣跨敤Perl DBI/DBD鎺ュ彛鐨勯棶棰

鏈珷鎻忚堪鎬庢牱鑾峰緱骞跺畨瑁MySQL

1.    瑕佷簡瑙f敮鎸佸摢浜涘钩鍙銆傝娉ㄦ剰骞堕潪鎵鏈夋敮鎸佺殑骞冲彴鍚岀瓑閫傚悎杩愯MySQL銆傚湪閮ㄥ垎骞冲彴涓婁細姣斿叾瀹冨钩鍙版洿鏈夋晥銆佺ǔ瀹氥傝鎯呰鍙傝2.1.1鑺傦紝鈥淢ySQL鏀寔鐨勬搷浣滅郴缁熲

2.    纭畾浣犲簲璇ヤ娇鐢ㄧ殑鍒嗗彂鐨勭増鏈銆傚彲鑾峰緱MySQL鐨勫涓増鏈紝澶ч儴鍒嗘湁澶氱鍒嗗彂鐗堛備綘鍙互閫夋嫨鍖呭惈浜岃繘鍒讹紙棰勭紪璇戯級浠g爜鎴栨簮鐮佸舰寮忕殑棰勬墦鍖呭垎鍙戙傚鏋滀笉鑳界‘瀹氾紝鍒欎娇鐢ㄤ簩杩涘埗鍒嗗彂鐗堛傚浜庢兂鐪嬫垜浠殑鏈鏂板紑鍙戝苟甯姪鎴戜滑娴嬭瘯鏂颁唬鐮佺殑鐢ㄦ埛锛屾垜浠彁渚涗簡鍏叡璁块棶鎺ュ彛锛屽彲浠ヨ闂垜浠渶鏂扮殑婧愮爜鏍戙備负浜嗙‘瀹氫綘搴旇浣跨敤鐨勫垎鍙戠殑鐗堟湰鍜岀被鍨嬶紝璇峰弬瑙2.1.2鑺傦紝鈥滈夋嫨瑕佸畨瑁呯殑MySQL鍒嗗彂鐗堚

3.    涓嬭浇鎯冲畨瑁呯殑鍒嗗彂鐗瀵逛簬鑳戒粠鍏惰幏寰MySQL鐨勭珯鐐瑰垪琛紝璇峰弬瑙2.1.3鑺傦紝鈥滄庢牱鑾峰緱MySQL鈥銆傜敤鏉ラ獙璇佸垎鍙戠増瀹屾暣鎬х殑鎸囦护鍙傝2.1.4鑺傦紝鈥滈氳繃MD5鏍¢獙鍜屾垨GnuPG楠岃瘉杞欢鍖呯殑瀹屾暣鎬

4.    瀹夎鍒嗗彂鐗閽堝浜岃繘鍒朵唬鐮佸拰婧愮爜鍒嗗彂鐗堢殑瀹夎璇存槑鍦2.2鑺傦紝鈥滀娇鐢ㄤ簩杩涘埗鍒嗗彂鐗堢殑鏍囧噯MySQL瀹夎鈥涓杩般傞拡瀵逛簩杩涘埗浠g爜鍜屾簮鐮佸垎鍙戠増鐨勫畨瑁呰鏄庡湪2.8鑺傦紝鈥滀娇鐢ㄦ簮鐮佸垎鍙戠増瀹夎MySQL鈥涓杩般

閲婏細濡傛灉浣犳兂瑕佸皢褰撳墠鐗堟湰鐨MySQL鍗囩骇鍒版渶鏂扮増鏈紝鑰屼笉鏄娆″畨瑁MySQL锛屽叧浜庡崌绾ц繃绋嬪拰鍗囩骇鍓嶅簲鑰冭檻鐨勯棶棰樿鍙傝2.10鑺傦紝鈥滃崌绾ySQL鈥

濡傛灉閬囧埌瀹夎闂锛2.12鑺傦紝鈥滃叿浣撴搷浣滅郴缁熺浉鍏崇殑娉ㄦ剰浜嬮」鈥涓彁渚涗簡瑙e喅骞冲彴鐩稿叧闂鐨勪俊鎭

5.    杩涜瀹夎鍚庣殑璁剧疆銆瀹夎MySQL鍚庯紝璇烽槄璇2.9鑺傦紝鈥滃畨瑁呭悗鐨勮缃拰娴嬭瘯鈥銆傛湰鑺備粙缁嶄簡閲嶈鐨勪俊鎭紝鍙互纭繚MySQL鏈嶅姟鍣ㄦ纭伐浣溿傛湰鑺傝繕鎻忚堪浜嗗浣曚娇灏氭湭鏈夊瘑鐮佺殑鍒濆MySQL鐢ㄦ埛璐︽埛鐨勫畨鍏ㄣ備笉绠′綘鏄敤浜岃繘鍒朵唬鐮佽繕鏄簮鐮佸垎鍙戠増鏉ュ畨瑁MySQL锛岃繖浜涜繃绋嬪潎閫傜敤銆

濡傛灉瑕佽繍琛MySQL鍩哄噯鑴氭湰锛屽繀椤讳娇鐢ㄦ敮鎸MySQLPerl銆傝鍙傝2.13鑺傦紝鈥淧erl瀹夎娉ㄦ剰浜嬮」鈥

2.1. 涓鑸畨瑁呴棶棰

鍦ㄥ畨瑁MySQL鍓嶏紝浣犲簲璇ワ細

1.    纭畾鏄惁MySQL灏嗚繍琛屽湪浣犵殑骞冲彴涓娿

2.    閫夋嫨瀹夎鐨勫垎鍙戠増銆

3.    涓嬭浇鍒嗗彂鐗堝苟楠岃瘉鍏跺畬鏁存с

鏈妭鍖呭惈鎵ц涓婅堪姝ラ蹇呴渶鐨勪俊鎭備箣鍚庯紝浣犲彲浠ユ寜鐓ф湰绔犱腑鍚庨潰鍑犺妭鐨勮鏄庢潵瀹夎閫夋嫨鐨勫垎鍙戠増銆

2.1.1. MySQL鏀寔鐨勬搷浣滅郴缁

鏈妭鍒楀嚭浜嗗彲浠ヨ繍琛MySQL鐨勬搷浣滅郴缁熴

鎴戜滑浣跨敤GNU Autoconf锛屽洜姝ゅ皢MySQL绉绘鍒版墍鏈変娇鐢Posix绾跨▼鍜C++缂栬瘧鍣ㄧ殑鐜颁唬绯荤粺鏄彲鑳界殑銆(瑕佹眰鏈嶅姟鍣ㄦ敮鎸佺嚎绋嬨傚鏋滃彧鏄紪璇戝鎴风浠g爜锛屽垯鍙渶瑕C++缂栬瘧鍣)銆傛垜浠富瑕佸湪Linux(SuSERed Hat)FreeBSDSun Solaris(鐗堟湰89)涓婁娇鐢ㄥ苟寮鍙戞湰杞欢銆

宸茬粡鎶ュ憡MySQL鍙互鍦ㄤ笅鍒楁搷浣滅郴缁/绾跨▼鍖呯殑缁勫悎涓婃垚鍔熷湴杩涜缂栬瘧銆傛敞鎰忥紝瀵逛簬寰堝鎿嶄綔绯荤粺锛屽師鐢熺殑绾跨▼浠呮敮鎸佹渶鏂扮殑鐗堟湰銆

         鏈夊師鐢熺嚎绋嬬殑AIX 4.x5.x銆傝鍙傝2.12.5.3鑺傦紝鈥淚BM-AIX娉ㄦ剰浜嬮」鈥

         Amiga

         鍖呮嫭MIT-pthreads鍖呯殑BSDI 2.x銆傝鍙傝2.12.4.4鑺傦紝鈥淏SD/OS 2.x鐗堟敞鎰忎簨椤光

         鏈夊師鐢熺嚎绋嬬殑BSDI3.0,3.14.x銆傝鍙傝2.12.4.4鑺傦紝鈥淏SD/OS 2.x鐗堟敞鎰忎簨椤光

         鏈夊師鐢熺嚎绋嬬殑Digital Unix 4.x銆傝鍙傝2.12.5.5鑺傦紝鈥淎lpha-DEC-UNIX(Tru64)鐗堟敞鎰忎簨椤光.銆

         鍖呮嫭MIT-pthreads鍖呯殑FreeBSD 2.x銆傝鍙傝2.12.4.1鑺傦紝鈥淔reeBSD娉ㄦ剰浜嬮」鈥

         鏈夊師鐢熺嚎绋嬬殑FreeBSD 3.x4.x銆傝鍙傝2.12.4.1鑺傦紝鈥淔reeBSD娉ㄦ剰浜嬮」鈥

         LinuxThreadsFreeBSD 4.x銆傝鍙傝2.12.4.1鑺傦紝鈥淔reeBSD娉ㄦ剰浜嬮」鈥

         DCE绾跨▼鎴MIT-pthreads鍖呯殑HP-UX 10.20銆傝鍙傝2.12.5.1鑺傦紝鈥淗P-UX 10.20鐗堟敞鎰忎簨椤光

         鏈夊師鐢熺嚎绋嬬殑HP-UX 11.x銆傝鍙傝2.12.5.2鑺傦紝鈥淗P-UX 11.x鐗堟敞鎰忎簨椤光

         LinuxThreads 0.7.1+glibc 2.0.7+锛岄傚悎鍚勭CPULinux 2.0+銆傝鍙傝2.12.1鑺傦紝鈥淟inux娉ㄦ剰浜嬮」鈥

         Mac OS X銆傝鍙傝2.12.2鑺傦紝鈥淢ac OS X娉ㄦ剰浜嬮」鈥

         NetBSD 1.3/1.4 IntelNetBSD 1.3 Alpha(闇瑕GNU make)銆傝鍙傝2.12.4.2鑺傦紝鈥淣etBSD娉ㄦ剰浜嬮」鈥

         Novell NetWare 6.0銆傝鍙傝2.6鑺傦紝鈥滃湪NetWare涓畨瑁匨ySQL鈥

         鏈夊師鐢熺嚎绋嬬殑OpenBSD > 2.5銆傚寘鎷MIT-pthreads鍖呯殑OpenBSD < 2.5銆傝鍙傝2.12.4.3鑺傦紝鈥淥penBSD 2.5鐗堟敞鎰忎簨椤光

         OS/2 Warp 3, FixPack 29OS/2 Warp 4, FixPack 4. 鍙傝2.12.6鑺傦紝鈥淥S/2娉ㄦ剰浜嬮」鈥

         鏈夋渶鏂FSU Pthreads绉绘鍖呯殑SCO OpenServer 5.0.X銆傝鍙傝2.12.5.8鑺傦紝鈥淪CO UNIX鍜孫penServer 5.0.x鐗堟敞鎰忎簨椤光

         SCO UnixWare 7.1.x銆傝鍙傝2.12.5.9鑺傦紝鈥淪CO UnixWare 7.1.x鍜孫penUNIX 8.0.0鐗堟敞鎰忎簨椤光

         SCO Openserver 6.0.x銆傝鍙傝2.12.5.10鑺傦紝鈥淪CO OpenServer 6.0.x鐗堟敞鎰忎簨椤光

         鏈夊師鐢熺嚎绋嬬殑SGI Irix 6.x銆傝鍙傝2.12.5.7鑺傦紝鈥淪GI Irix娉ㄦ剰浜嬮」鈥

         SPARCx86涓婃湁鍘熺敓绾跨▼鐨Solaris 2.5鍜屼互涓婄増鏈傝鍙傝2.12.3鑺傦紝鈥淪olaris娉ㄦ剰浜嬮」鈥

         鍖呮嫭MIT-pthreads鍖呯殑SunOS 4.x銆傝鍙傝2.12.3鑺傦紝鈥淪olaris娉ㄦ剰浜嬮」鈥

         Tru64 Unix銆傝鍙傝2.12.5.5鑺傦紝鈥淎lpha-DEC-UNIX(Tru64)鐗堟敞鎰忎簨椤光

         Windows 9xMeNT2000XP2003銆傝鍙傝2.3鑺傦紝鈥滃湪Windows涓婂畨瑁匨ySQL鈥

骞堕潪鎵鏈夋敮鎸佺殑骞冲彴鍚岀瓑閫傚悎杩愯MySQL銆傛牴鎹互涓嬪洜绱犵‘瀹氭煇涓钩鍙伴傚悎楂樿礋鑽峰叧閿换鍔MySQL鏈嶅姟鍣ㄧ殑绋嬪害锛

         绾跨▼搴撶殑绋冲畾鎬с傚彲鑳芥煇涓钩鍙扮殑鍙嶅簲涓嶉敊锛屼絾MySQL鐨勭ǔ瀹氭у彇鍐充簬瀹冩墍璋冪敤鐨勭嚎绋嬪簱锛屼笉绠″叾瀹冮儴鍒嗘槸鍚﹀畬鍠勩

         鍐呮牳鍜岀嚎绋嬪簱鍒╃敤鍧囪 澶氬鐞嗗櫒(SMP)绯荤粺鐨勮兘鍔涖傛崲鍙ヨ瘽璇达紝褰撹繘绋嬪垱寤轰竴涓嚎绋嬫椂锛屽簲鍏佽绾跨▼杩愯鍘熻繘绋嬫墍杩愯CPU涔嬪鐨勫叾瀹冨鐞嗗櫒銆

         鍐呮牳鍜岀嚎绋嬪簱杩愯鍦ㄧ煭鑼冨洿棰戠箒鑾峰彇鍜岄噴鏀句簰鏂ヤ綋鑰屼笉闇瑕佽繃澶氬湴浜ゆ崲鍐呭鐨勫涓嚎绋嬬殑鑳藉姏銆傚鏋滄墽琛pthread_mutex_lock()鏃朵骇鐢熺殑CPU鏃堕棿澶煭锛屽垯浼氫弗閲嶅奖鍝MySQL銆傚鏋滀笉鍏虫敞璇ラ棶棰橈紝澧炲姞杩囧鐨CPU瀹為檯浼氶檷浣MySQL鐨勯熷害銆

         甯歌鏂囦欢绯荤粺鐨勭ǔ瀹氭у拰鎬ц兘銆

         濡傛灉鏁版嵁搴撹〃寰堝ぇ锛屾枃浠剁郴缁熷鐞嗗ぇ鏂囦欢鐨勮兘鍔涘拰澶勭悊鏁堢巼銆

         鎴戜滑鍦ㄨ骞冲彴涓婁娇鐢MySQL AB鐨勭粡楠屾按骞炽傚鏋滄垜浠啛鎮変竴涓钩鍙帮紝鎴戜滑鍙互瀵瑰叿浣撳钩鍙拌繘琛屼紭鍖栧苟鍥哄畾缂栬瘧鏃堕棿銆傛垜浠繕鍙互鎻愪緵寤鸿濡備綍鏇村ソ鍦颁负MySQL閰嶇疆绯荤粺銆

         鎴戜滑鍦ㄧ被浼奸厤缃笅鎵瀹屾垚鐨勫唴閮ㄦ祴璇曠殑鏁伴噺銆

         鍦ㄥ悓涓骞冲彴绫讳技閰嶇疆涓嬫垚鍔熻繍琛MySQL鐨勭敤鎴锋暟銆傚鏋滆鏁板瓧寰堥珮锛屽垯璇存槑閬囧埌鍏蜂綋骞冲彴闂鐨勫嚑鐜囪灏忓緱澶氥

鏍规嵁鍓嶉潰鐨勬爣鍑嗭紝鍏佽MySQL鐨勬渶濂界殑骞冲彴鏄x86,瀹夎SuSE Linux锛屼娇鐢2.42.6鍐呮牳锛屽拰ReiserFS(鎴栫被浼Linux鍒嗗彂鐗)鍜屽畨瑁呬簡 Solaris(2.7-9)SPARCFreeBSD鎺掔涓変綅锛屼絾鎴戜滑鐪熸甯屾湜涓鏃︾嚎绋嬪簱寰楀埌鏀硅繘锛屽畠涔熷彲浠ユ彁楂樻帓鍚嶃備粠鏌愪竴瑙傜偣鎴戜滑杩樺笇鏈涙彁楂樺叾瀹MySQL鐩墠姝e湪涓婇潰缂栬瘧銆佸厑璁哥殑骞冲彴鐨勬帓鍚嶏紝浣嗙ǔ瀹氭у拰鎬ц兘涓婂彲浠ヨ姹備笉鍚岀瓑绾с傝繖闇瑕佹垜浠笌MySQL鎵渚濊禆鐨勬搷浣滅郴缁熷拰搴撶粍浠跺紑鍙戜汉鍛樺叡鍚屽姫鍔涖傚鏋滀綘瀵规敼杩涙煇涓粍浠舵劅鍏磋叮锛屽彲鑳藉奖鍝嶅叾寮鍙戯紝闇瑕佹洿澶氱殑鍏充簬MySQL濡備綍鑳借繍琛屽緱鏇村ソ鐨勮鏄庯紝璇峰悜鎴戜滑鐨MySQL internals鍙戦侀偖浠躲傝鍙傝1.7.1.1鑺傦紝鈥淭he MySQL閭欢鍒楄〃鈥

璇锋敞鎰忓墠闈㈢殑瀵规瘮骞朵笉鏄涓涓搷浣滅郴缁熸讳綋涓婃瘮鍙︿竴涓搷浣滅郴缁熻濂姐傛垜浠彧鏄璁洪夋嫨涓涓OS鏉ヤ笓闂ㄨ繍琛MySQL銆傝浣忎簡杩欎竴鐐癸紝濡傛灉鑰冭檻鏇村鐨勫洜绱狅紝瀵规瘮缁撴灉鍙兘浼氫笉鍚屻傚湪鏌愪簺鎯呭喌涓嬶紝涓涓OS姣斿彟涓涓OS濂界殑鍘熷洜鍙槸鎴戜滑宸茬粡涓哄叿浣撳钩鍙板仛鍑轰簡鏇村鐨勫姫鍔涙潵杩涜娴嬭瘯鍜屼紭鍖栥傛垜浠彧鏄檲杩版垜浠殑瑙傜偣甯姪浣犻夋嫨杩愯MySQL鐨勫钩鍙般

2.1.2. 閫夋嫨瑕佸畨瑁呯殑MySQL鍒嗗彂鐗

鍑嗗瀹夎MySQL鏃讹紝浣犲簲纭畾浣跨敤鍝釜鐗堟湰銆MySQL鐨勫紑鍙戞湁鍑犱釜鍙戝竷绯诲垪锛屽彲浠ラ夋嫨鏈閫傚悎浣犺姹傜殑涓涓増鏈傜‘瀹氫簡瀹夎鐨勭増鏈悗锛屼究鍙互閫夋嫨鍒嗗彂鐗堛傛湁浜岃繘鍒舵垨婧愮爜鍙戝竷鏍煎紡銆

2.1.2.1. 閫夋嫨瑕佸畨瑁呯殑MySQL鐗堟湰

棣栧厛瑕佷綔鍑哄喅绛栵紝浣犳槸鍚︽兂瑕佷娇鐢ㄦ渶鏂扮殑寮鍙戠増鏈垨鏈缁堢殑绋冲畾鐗堟湰銆傚湪MySQL寮鍙戣繃绋嬩腑锛屽悓鏃跺瓨鍦ㄥ涓彂甯冪郴鍒楋紝姣忎釜鍙戝竷澶勫湪鎴愮啛搴︾殑涓嶅悓闃舵锛

         MySQL 5.2鏄渶鏂板紑鍙戠殑鍙戝竷绯诲垪锛屾槸灏嗘墽琛屾柊鍔熻兘鐨勭郴鍒椼備笉涔呯殑灏嗘潵鍙互浣跨敤Alpha鍙戣锛屼互渚挎劅鍏磋叮鐨勭敤鎴疯繘琛屽箍娉涚殑娴嬭瘯銆

         MySQL 5.1鏄綋鍓嶇ǔ瀹(浜у搧璐ㄩ噺)鍙戝竷绯诲垪銆傚彧閽堝婕忔礊淇閲嶆柊鍙戝竷锛涙病鏈夊鍔犱細褰卞搷绋冲畾鎬х殑鏂板姛鑳姐

         MySQL 5.0鏄墠涓绋冲畾(浜у搧璐ㄩ噺)鍙戝竷绯诲垪銆傚彧閽堝涓ラ噸婕忔礊淇鍜屽畨鍏ㄤ慨澶嶉噸鏂板彂甯冿紱娌℃湁澧炲姞浼氬奖鍝嶈绯诲垪鐨勯噸瑕佸姛鑳姐

         MySQL 4.03.23鏄棫鐨勭ǔ瀹(浜у搧璐ㄩ噺)鍙戝竷绯诲垪銆傝鐗堟湰涓嶅啀浣跨敤锛屾柊鐨勫彂甯冨彧鐢ㄦ潵淇鐗瑰埆涓ラ噸鐨勬紡娲烇紙浠ュ墠鐨勫畨鍏ㄩ棶棰橈級銆

鎴戜滑涓嶈涓烘湁瀹屽叏鐨勫喕缁撶増锛屽洜涓轰换浣曠増鏈潎闇瑕佸婕忔礊杩涜淇鍜屽叾瀹冧慨澶嶃傚浜庘滄煇绉嶇▼搴︾殑鍐荤粨鈥濓紝鎴戜滑鏄寚鎴戜滑鍙互鍦ㄤ骇鍝佸彂甯冧腑澧炲姞涓浜涗笉浼氬奖鍝嶅綋鍓嶅伐浣滅殑灏忎笢瑗裤傝嚜鐒讹紝鍓嶄竴绯诲垪鐨勭浉鍏虫紡娲炰慨澶嶄細绉绘鍒板悗闈㈢殑绯诲垪銆

閫氬父, 濡傛灉浣犳槸绗竴娆″紑濮嬩娇鐢MySQL鎴栨兂瑕佸皢瀹冪Щ妞嶅埌涓浜涜繕娌℃湁浜岃繘鍒跺垎鍙戠増鐨勭郴缁熶笂锛屾垜浠帹鑽愪娇鐢ㄦ渶缁堢殑绋冲畾鐗堟湰銆傜洰鍓嶆槸MySQL 5.1銆傛垜浠凡缁忎娇鐢MySQL鍩哄噯瀵规墍鏈MySQL鍙戝竷杩涜浜嗘鏌ワ紝鍖呮嫭鏉ヨ嚜寮鍙戠郴鍒楃殑鍙戝竷锛屽湪鍙戝竷鍓嶈繕浣跨敤鍩哄噯濂椾欢鏉ユ祴璇曞畠銆

濡傛灉浣犳鍦ㄨ繍琛屼竴涓佺殑绯荤粺骞朵笖鎯宠鍗囩骇锛屼絾鏄張涓嶆兂鍐掗櫓杩涜闈炴棤缂濆崌绾э紝搴旇鍗囩骇鍒版渶鏂扮増鏈腑浣犳浣跨敤鐨勭浉鍚岀殑鍙戝竷绯诲垪锛堝彧鏈夌増鏈彿鐨勬渶鍚庨儴鍒嗘瘮浣犱娇鐢ㄧ殑鏂帮級銆傛垜浠凡缁忚瘯鐫浠呬慨澶嶈嚧鍛界己闄凤紝瀵归偅涓増鏈繘琛屼簡寰堝皬鐨勭浉瀵瑰畨鍏ㄧ殑鏀瑰姩銆

濡傛灉浣犳兂瑕佷娇鐢ㄤ骇鍝佸彂甯冪郴鍒椾腑鎵娌℃湁鐨勬柊鍔熻兘锛屼綘鍙互浣跨敤寮鍙戠郴鍒楃殑鐗堟湰銆傝娉ㄦ剰寮鍙戝彂甯冧笉濡備骇鍝佸彂甯冪ǔ瀹氥

濡傛灉浣犳兂瑕佷娇鐢ㄥ寘鍚墍鏈夋渶鏂拌ˉ涓佸拰婕忔礊淇鐨勬渶鏂版簮鐮侊紝鍙互浣跨敤鎴戜滑鐨BitKeeper搴撱傝繖浜涘簱杩樻病鏈夊彂甯冿紝浣嗗彲浠ラ瑙堜唬鐮侊紝灏嗘潵鐨勫彂甯冨熀浜庤繖浜涗唬鐮併

MySQL鐨勫懡鍚嶆満鍒朵娇鐢ㄧ敱3涓暟瀛楀拰涓涓悗缂缁勬垚鐨勭増鏈彿銆備緥濡傦紝鍍mysql-5.0.9-beta鐨勭増鏈彿杩欐牱瑙i噴锛

         1涓暟瀛(5)鏄富鐗堟湰鍙凤紝鎻忚堪浜嗘枃浠舵牸寮忋傛墍鏈夌増鏈5鐨勫彂琛岄兘鏈夌浉鍚岀殑鏂囦欢鏍煎紡銆

         2涓暟瀛(0)鏄彂琛岀骇鍒備富鐗堟湰鍙峰拰鍙戣绾у埆缁勫悎鍒颁竴璧蜂究鏋勬垚浜嗗彂琛屽簭鍒楀彿銆

         3涓暟瀛(9)鏄湪姝ゅ彂琛岀郴鍒楃殑鐗堟湰鍙凤紝闅忔瘡涓柊鍒嗗彂鐗堥掑銆傞氬父浣犻渶瑕佸凡缁忛夋嫨鐨勫彂琛(release)鐨勬渶鏂扮増鏈(鐗堟湰)

姣忔鏇存柊鍚庯紝鐗堟湰瀛楃涓茬殑鏈鍚庝竴涓暟瀛楅掑銆傚鏋滅浉瀵逛簬鍓嶄竴涓増鏈鍔犱簡鏂板姛鑳芥垨鏈夊井灏忕殑涓嶅吋瀹规э紝瀛楃涓茬殑绗簩涓暟瀛楅掑銆傚鏋滄枃浠舵牸寮忔敼鍙橈紝绗竴涓暟瀛楅掑銆

鍚庣紑鏄剧ず鍙戣鐨勭ǔ瀹氭х骇鍒傞氳繃涓绯诲垪鍚庣紑鏄剧ず濡備綍鏀硅繘绋冲畾鎬с傚彲鑳界殑鍚庣紑鏈夛細

         alpha琛ㄦ槑鍙戣鍖呭惈澶ч噺鏈褰诲簳娴嬭瘯鐨勬柊浠g爜銆傚凡鐭ョ殑缂洪櫡搴旇鍦ㄦ柊闂诲皬鑺傝璁板綍銆傝鍙傝闄勫綍D锛MySQL鍙樻洿鍙銆傚湪澶у鏁alpha鐗堟湰涓篃鏈夋柊鐨勫懡浠ゅ拰鎵╁睍銆alpha鐗堟湰涔熷彲鑳芥湁涓昏浠g爜鏇存敼绛夊紑鍙戙備絾鎴戜滑鍦ㄥ彂甯冨墠涓瀹氬鍏惰繘琛屾祴璇曘

         beta鎰忓懗鐫璇ョ増鏈姛鑳芥槸瀹屾暣鐨勶紝骞朵笖鎵鏈夌殑鏂颁唬鐮佽娴嬭瘯浜嗭紝娌℃湁澧炲姞閲嶈鐨勬柊鐗瑰緛锛屽簲璇ユ病鏈夊凡鐭ョ殑缂洪櫡銆傚綋alpha鐗堟湰鑷冲皯涓涓湀娌℃湁鍑虹幇鎶ュ鐨勮嚧鍛芥紡娲烇紝骞朵笖娌℃湁璁″垝澧炲姞瀵艰嚧宸茬粡瀹炴柦鐨勫姛鑳戒笉绋冲畾鐨勬柊鍔熻兘鏃讹紝鐗堟湰鍒欎粠alpha鐗堝彉涓beta鐗堛

鍦ㄤ互鍚庣殑beta鐗堛佸彂甯冪増鎴栦骇鍝佸彂甯冧腑锛屾墍鏈API銆佸閮ㄥ彲瑙嗙粨鏋勫拰SQL鍛戒护鍒楀潎涓嶅啀鏇存敼銆

         rc鍙戝竷浠h〃锛鏄竴涓彂琛屼簡涓娈垫椂闂寸殑beta鐗堟湰锛岀湅璧锋潵搴旇杩愯姝e父銆傚彧澧炲姞浜嗗緢灏忕殑淇銆(鍙戝竷浠h〃鍗充互鍓嶆墍绉扮殑gamma )

         濡傛灉娌℃湁鍚庣紑锛岃繖鎰忓懗鐫璇ョ増鏈凡缁忓湪寰堝鍦版柟杩愯涓娈垫椂闂翠簡锛岃屼笖娌℃湁闈炲钩鍙扮壒瀹氱殑缂洪櫡鎶ュ憡銆傚彧澧炲姞浜嗗叧閿紡娲炰慨澶嶄慨澶嶃傝繖灏辨槸鎴戜滑绉颁负涓涓骇鍝侊紙绋冲畾锛夋垨鈥滈氱敤鈥濈増鏈殑涓滆タ銆

MySQL鐨勫懡鍚嶆満鍒朵簬鍏跺畠浜у搧绋嶆湁涓嶅悓銆備竴鑸儏鍐碉紝鎴戜滑鍙互寰堟斁蹇冨湴浣跨敤宸茬粡鎶曟斁甯傚満涓ゅ懆鑰屾病鏈夎鐩稿悓鍙戝竷绯诲垪鐨勬柊鐗堟湰鎵浠f浛鐨勭増鏈

MySQL鎵鏈夌増鏈兘缁忚繃鎴戜滑鐨勬爣鍑嗘祴璇曞拰鍩哄噯娴嬭瘯杩愯锛屼互淇濊瘉瀹冧滑鍙浉褰撳畨鍏ㄥ湴浣跨敤銆傚洜涓烘爣鍑嗘祴璇曚笉鏂墿鍏呬互妫娴嬩互鍓嶅彂鐜扮殑缂洪櫡锛屾祴璇曞浠朵竴鐩村湪鏀硅繘涔嬩腑銆

鎵鏈夌増鏈兘鑷冲皯宸茬粡鐢ㄤ笅鍒楀浠惰繘琛屼簡娴嬭瘯锛

         涓涓唴閮ㄦ祴璇曞浠

mysql-test鐩綍鍖呭惈涓鏁村娴嬭瘯妗堜緥銆傛垜浠拡瀵规瘡涓簩杩涘埗鏈嶅姟鍣ㄨ繘琛岃繖浜涙祴璇曘傚叧浜庤娴嬭瘯濂椾欢鐨勮缁嗕俊鎭弬瑙27.1.2鑺傦紝鈥淢ySQL娴嬭瘯濂椾欢鈥

         MySQL鍩哄噯濂椾欢

瀹冭繍琛屼竴瀹氳寖鍥寸殑鏅氭煡璇€傚畠涔熸槸涓涓祴璇曪紝妫娴嬫渶鏂扮殑浼樺寲澶勭悊鏄惁鐪熺殑浣夸唬鐮佹洿蹇傝鍙傝7.1.4鑺傦紝鈥淢ySQL鍩哄噯濂椾欢鈥

         crash-me娴嬭瘯

杩欏皾璇曞喅瀹氭暟鎹簱鏀寔浠涔堝姛鑳藉拰瀹冪殑鑳藉姏涓庨檺鍒舵槸浠涔堛傝鍙傝7.1.4鑺傦紝鈥淢ySQL鍩哄噯濂椾欢鈥

鍙︿竴涓祴璇曟槸鍦ㄥ唴閮ㄧ敓浜х幆澧冧腑浣跨敤鏈鏂MySQL鐗堟湰锛岃嚦灏戝湪涓鍙版満鍣ㄤ笂銆傛垜浠湁瓒呰繃100GB鐨勬暟鎹彲渚涗娇鐢ㄣ

2.1.2.2. 閫夋嫨鍒嗗彂鏍煎紡

閫夋嫨浜MySQL鐨勫畨瑁呯増鏈悗锛岃鍋氱殑绗簩椤瑰喅绛栨槸浣犳槸浣跨敤婧愮爜鍒嗗彂鐗堣繕鏄簩杩涘埗鍒嗗彂鐗堛傚ぇ澶氭暟鎯呭喌锛屽鏋滀綘鐨勫钩鍙颁笂宸茬粡鏈変簡涓涓簩杩涘埗鍒嗗彂鐗堬紝浣犲彲鑳戒娇鐢ㄤ簩杩涘埗鍒嗗彂鐗堛傚ぇ澶氭暟骞冲彴鍙互浣跨敤鍘熸牸寮忎簩杩涘埗鍒嗗彂鐗堬紝渚嬪Linux浣跨敤RPM鏂囦欢锛Mac OS X浣跨敤DMG瀹夎杞欢鍖呫備篃鍙互浣跨敤Zip鏂囦欢鎴栧帇缂tar鏂囦欢銆

閫夋嫨浜岃繘鍒跺垎鍙戠増鐨勭悊鐢憋細

         浜岃繘鍒跺垎鍙戠増姣旀簮鐮佸垎鍙戠増鏇村鏄撳畨瑁呫

         涓轰簡婊¤冻涓嶅悓鐢ㄦ埛鐨勯渶姹傦紝鎴戜滑鎻愪緵浜嗕袱绉嶄笉鍚岀殑浜岃繘鍒剁増鏈細涓涓槸缂栬瘧杩囩殑甯﹂潪浜嬪姟鍌ㄥ瓨寮曟搸(灏忕殑蹇熷簱)锛屽彟涓涓厤缃簡鏈閲嶈鐨勬墿灞曢夐」锛屼緥濡備簨鍔″畨鍏ㄨ〃銆備袱涓増鏈潎浠庣浉鍚岀殑婧愮爜鍒嗗彂鐗堢紪璇戣屾潵銆傛墍鏈夋湰鍦MySQL瀹㈡埛绔潎鍙互杩炴帴浠讳竴鐗堟湰鐨MySQL鏈嶅姟鍣ㄣ

鎵╁睍MySQL搴撳垎鍙戠増鏍囨湁-max鍚庣紑锛岄厤缃簡涓mysqld-max鐩稿悓鐨勯夐」銆傝鍙傝5.1.2鑺傦紝鈥渕ysqld-max鎵╁睍MySQL鏈嶅姟鍣ㄢ

濡傛灉鎯宠浣跨敤MySQL-Max RPM锛屽繀椤婚鍏堝畨瑁呮爣鍑MySQL-server RPM

鍦ㄦ煇浜涚幆澧冧笅锛屾渶濂藉畨瑁呮簮鐮佸垎鍙戠増MySQL

         浣犳兂瑕佸湪鏌愪釜鏄庢樉鐨勪綅缃畨瑁MySQL銆傛爣鍑嗕簩杩涘埗鍒嗗彂鐗堝彲浠ュ畨瑁呭埌浠讳綍鍦版柟锛屼絾浣犳兂鏇村姞鐏垫椿鍦板皢MySQL缁勪欢鏀惧埌鏌愪釜鍦版柟銆

         浣犳兂瑕佸皢mysqld閰嶇疆涓浜涙爣鍑嗕簩杩涘埗鍒嗗彂鐗堜腑鏈寘鎷殑涓浜涚壒娈婄壒寰併備笅闈㈡槸涓浜涗綘鎯宠浣跨敤鐨勬渶甯哥敤鐨勯夐」锛

o        --with-innodb(鍦ㄦ墍鏈MySQL 5.1搴撶増鏈腑榛樿浣跨敤)

o        --with-berkeley-db(鍙傚悎閮ㄥ垎骞冲彴)

o        --with-libwrap

o        --with-d-z-libs(閫傚悎閮ㄥ垎浜岃繘鍒)

o        --with-debug[=full]

         浣犳兂瑕佸皢mysqld閰嶇疆涓浜涙爣鍑嗕簩杩涘埗鍒嗗彂鐗堜腑宸茬粡鍖呮嫭鐨勪竴浜涚壒娈婄壒寰併備緥濡傦紝涓鑸紪璇戣繃鐨勫垎鍙戠増鏀寔鎵鏈夊瓧绗﹂泦銆傚鏋滀綘鎯宠涓涓洿灏忕殑MySQL鏈嶅姟鍣紝鍙互閲嶆柊缂栬瘧鍙敮鎸佷綘闇瑕佺殑瀛楃闆嗐

         浣犳湁涓涓笓鐢ㄧ紪璇戝櫒(渚嬪pgcc)鎴栨兂瑕佷娇鐢ㄦ洿濂藉湴浼樺寲閫傜敤浣犵殑澶勭悊鍣ㄧ殑缂栬瘧鍣ㄩ夐」銆備簩杩涘埗鍒嗗彂鐗堢紪璇戠殑閫夐」閫傚悎鍚屼竴澶勭悊鍣ㄦ棌鐨勫悇绉嶅鐞嗗櫒銆

         浣犳兂瑕佷娇鐢BitKeeper搴撲腑鐨勬渶鏂版簮鐮侊紝浠ヨ闂墍鏈夋渶鏂版紡娲炰慨澶嶃備緥濡傦紝濡傛灉浣犲彂鐜颁簡婕忔礊骞跺皢瀹冩姤鍛婄粰MySQL寮鍙戝皬缁勶紝婕忔礊淇浼犻掔粰婧愮爜搴擄紝浣犱究鍙互璁块棶瀹冦傚彂甯冨疄闄呭彂琛屽悗鎵嶄細鍑虹幇婕忔礊淇銆

         濡傛灉浣犳兂瑕侀槄璇(鎴栦慨鏀)鏋勬垚MySQLCC++浠g爜锛屼綘搴旇鎷垮埌婧愮爜鍒嗗彂鐗堛傛簮鐮佹绘槸鏈缁堢殑鎵嬪唽銆

         婧愮爜鍒嗗彂鐗堜篃姣斾簩杩涘埗鐨勫垎鍙戠増鍖呭惈鏇村鐨勬祴璇曞拰瀹炰緥銆

2.1.2.3. 濡備綍鍙戝竷鏇存柊浠ュ強浣曟椂鍙戝竷鏇存柊

MySQL杩涘睍鐨勭浉褰撳揩锛屾垜浠兂瑕佷笌鍏跺畠MySQL鐢ㄦ埛鍒嗕韩瀹冦傚綋鎴戜滑鏈変竴涓湅鏉ュ叾瀹冧汉浼间箮闇瑕佺殑闈炲父鏈夌敤鐨勫姛鑳芥椂锛屾垜浠氨璇曠潃鍒朵綔涓涓彂琛岀増鏈

鎴戜滑涔熷皾璇曞府鍔╅偅浜涢渶瑕佸緢瀹规槗瀹炵幇鐨勫姛鑳界殑鐢ㄦ埛锛屾垜浠篃鍏虫敞鎴戜滑鎺堟潈鐨勭敤鎴锋兂瑕佷粈涔堬紝鎴戜滑鏇寸壒鍒叧娉ㄦ垜浠敮鎸佺殑瀹㈡埛鎯宠浠涔堬紝骞朵笖灏藉姏甯姪浠栦滑銆

娌℃湁浜轰竴瀹氳涓嬭浇涓涓柊鐗堟湰锛屾柊闂诲皬鑺備腑灏嗗憡璇変綘鏂扮増鏈槸鍚︽湁涓浜涗綘纭疄鎯宠鐨勪笢瑗裤傝鍙傝闄勫綍D锛MySQL鍙樻洿鍙

褰撴洿鏂MySQL鏃讹紝鎴戜滑浣跨敤涓嬪垪绛栫暐锛

         灏嗗彂甯冩瘡涓郴鍒椼傛瘡娆″彂甯冩椂锛岀増鏈殑鏈鍚庝竴涓暟瀛椾负鍚屼竴绯诲垪鍓嶄竴鐗堟湰鐨勫熀纭涓婂姞1

         绋冲畾鐨勬祴璇曡繃鐨勪骇鍝佺増鏈瘡骞村噯澶囧嚭鐜1-2娆★紝浣嗘槸濡傛灉鍙戠幇灏忕己闄凤紝鍙湁缂洪櫡淇鐨勪竴涓増鏈皢琚彂琛屻

         宸ヤ綔鐗堟湰/瀵规棫鐗堟湰鐨勬紡娲炰慨澶嶆枃浠舵瘡4-8鍛ㄥ嚭鐜颁竴娆°

         瀵逛竴浜涘钩鍙扮殑浜岃繘鍒跺垎鍙戠増锛屼富瑕佺増鏈敱鎴戜滑鍒朵綔銆傚叾瀹冧汉鍙互涓哄叾瀹冪郴缁熷埗浣滀簩杩涘埗鍒嗗彂鐗堬紝浣嗘槸鍙兘涓嶅瑙併

         鎴戜滑涓鏃﹁瘑鍒苟淇浜嗛潪绱фヤ絾鐑︿汉鐨勭己闄凤紝鍒欑珛鍗冲皢鍏跺彂甯冿紝鍙互浠庡叕鍏BitKeeper搴撲腑绔嬪嵆寰楀埌淇浠g爜锛屽苟灏嗗寘鍚埌涓嬩竴鍙戝竷鐗堜腑銆

  • 鍦ㄤ换浣曟儏鍐典笅锛屽鏋滃湪涓涓彂琛屼腑鏈変竴涓嚧鍛界己闄凤紝鎴戜滑灏嗗敖蹇埗浣滀竴涓柊鐗堟湰鏉ヤ慨澶嶃傦紙鎴戜滑甯屾湜鍏跺畠鍏徃涔熻繖鏍峰仛锛)

2.1.2.4. 鍙戝竷鍘熷垯锛氬彂琛岀増鏈腑娌℃湁宸茬煡鐨勭己闄

鎴戜滑鎶曞叆浜嗗ぇ閲忕殑鏃堕棿鍜屽伐浣滄潵浣挎垜浠殑鍙戝竷娌℃湁缂洪櫡銆傛垜浠粠鏉ユ病鏈夊彂甯冭繃鍚湁宸茬煡鑷村懡閲嶅鎬х己闄风殑鍗曚竴MySQL鐗堟湰銆(鑷村懡鈥濈己闄锋寚鑳藉湪姝e父搴旂敤涓鑷MySQL鐦棯鐨勭己闄凤紝瀵逛簬姝e父鏌ヨ浜х敓閿欒绛旀锛屾垨鏈夊畨鍏ㄩ棶棰橈級

鎴戜滑宸茬粡灏嗘墍鏈夊叕寮闂銆佺己闄峰拰鐢辫璁″喅绛栧喅瀹氱殑浜嬪疁璁板叆鏂囦欢銆傝鍙傝A.8鑺傦紝鈥淢ySQL涓殑宸茬煡浜嬪疁鈥

鎴戜滑鐨勭洰鏍囨槸淇涓鍒囧彲浠ヤ慨澶嶇殑涓滆タ锛岃屼笉浼氫娇绋冲畾鐨MySQL鐗堟湰鍙樺緱涓嶇ǔ瀹氥傚湪鏌愪簺鎯呭喌锛岃繖鎰忓懗鐫鎴戜滑鍙互鍦ㄥ紑鍙戠増鏈腑淇闂锛岃屼笉鏄湪绋冲畾鐨 (浜у搧) 鐗堟湰銆傝嚜鐒讹紝鎴戜滑浼氬皢杩欎簺闂璁板叆鏂囨。锛屼互渚跨敤鎴疯兘鐭ラ亾銆

涓嬮潰鎻忚堪浜嗘垜浠浣曟搷浣滐細

         鎴戜滑閫氳繃鎴戜滑鐨勫鎴锋敮鎸佸垪琛ㄣ佸湪http://bugs.mysql.com/ 缂洪櫡鏁版嵁搴撳拰MySQL澶栭儴閭欢鍒楄〃鏉ョ洃鎺х己闄枫

         褰撳墠鐗堟湰涓墍鏈夎鎶ュ鐨勭己闄疯杈撳叆缂洪櫡鏁版嵁搴撱

         褰撴垜浠慨澶嶇己闄凤紝鎴戜滑鎬绘槸涓哄叾璁捐涓娆℃祴璇曟渚嬶紝骞跺皢鍏跺寘鎷繘娴嬭瘯绯荤粺涓紝浠ョ‘淇濅笉浼氭紡妫浣跨己闄峰啀鐜般(鎵鏈変慨澶嶇殑缂洪櫡涓ぇ绾90%鐨勫叿鏈夋祴璇曟渚嬶級

         涓烘坊鍔犲埌MySQL涓殑鎵鏈夋柊鍔熻兘鍒涘缓娴嬭瘯妗堜緥銆

         鎴戜滑寮濮嬫瀯寤烘柊鐨MySQL鍙戝竷鍓嶏紝鎴戜滑纭繚淇浜MySQL鐗堟湰(3.23.x4.0.x4.1.x5.0.x绛夌瓑)涓墍鏈夎鎶ュ鐨勯噸澶嶆х己闄枫傚鏋滄煇浜涘唴瀹逛笉鑳戒慨澶(鐢变簬MySQL鍐呴儴鐨勪竴浜涜璁″喅绛)锛屾垜浠湪鏈墜鍐屼腑璁板綍涓嬫潵銆傝鍙傝A.8鑺傦紝鈥淢ySQL涓殑宸茬煡浜嬪疁鈥

         鎴戜滑鍦ㄦ墍鏈夋敮鎸佷簩杩涘埗鐨勫钩鍙(15+骞冲彴)涓婃瀯寤哄苟杩愯鎴戜滑鐨勬祴璇曞浠跺拰鍩哄噯濂椾欢銆

         濡傛灉鍦ㄦ煇涓钩鍙颁笂娴嬭瘯鎴栧熀鍑嗗浠跺け璐ワ紝鎴戜滑涓嶄細鍏竷浜岃繘鍒躲傚鏋滈棶棰樻槸鐢变簬婧愮爜涓殑鏅氱己闄凤紝鎴戜滑灏嗚繘琛屼慨澶嶅苟鍦ㄦ墍鏈夌郴缁熶笂鏋勫缓骞舵祴璇曘

         鏋勫缓鍜屾祴璇曡繃绋嬮渶瑕2-3澶┿傚鏋滃湪璇ヨ繃绋嬩腑鎴戜滑鏀跺埌鑷村懡缂洪櫡鐩稿叧鎶ュ憡(渚嬪锛屼細閫犳垚鍐呮牳杞偍)锛屾垜浠皢淇璇ラ棶棰樺苟閲嶆柊鍚姩鏋勫缓杩囩▼銆

         http//dev.mysql.com/涓婂叕甯冧簩杩涘埗鍚庯紝鎴戜滑鍒欏悜mysql鍙戝嚭鍏憡娑堝苟announce閭欢鍒楄〃銆傝鍙傝1.7.1.1鑺傦紝鈥淭he MySQL閭欢鍒楄〃鈥銆傚叕鍛婃秷鎭寘鍚墍鏈夊彂甯冪殑鏇存敼鍒楄〃鍜屽凡鐭ラ棶棰樸傚彧鏈夐儴鍒嗗彂鐗堜笉闇瑕宸茬煡鐨勯棶棰閮ㄥ垎銆

         涓轰簡璁╂垜浠殑鐢ㄦ埛蹇熻闂渶鏂MySQL鍔熻兘锛屾垜浠瘡4-8鍛ㄤ骇鐢熶竴涓柊鐨MySQL鍙戝竷銆傛瘡澶╂瀯寤烘簮鐮佸揩鐓э紝鍙互浠http://downloads.mysql.com/snapshots.php鑾峰緱銆

         濡傛灉锛屽敖绠$粡杩囨垜浠渶澶х殑鍔姏锛屾垜浠湪鍙戝竷鍚庝粛鏀跺埌缂洪櫡鎶ュ憡锛屽嵆鍦ㄦ煇涓叿浣撳钩鍙颁笂鍑虹幇涓ラ噸闂锛屾垜浠皢绔嬪嵆杩涜淇锛屽苟涓鸿骞冲彴鏋勫缓涓涓柊鐨 'a'鐗堟湰銆傜敱浜庢垜浠殑澶х敤鎴风兢锛屽彲浠ュ緢蹇湴鏌ュ嚭骞惰В鍐虫绫婚棶棰樸

         鎴戜滑涓轰繚璇佺ǔ瀹氱増鏈墍鍋氱殑璺熻釜璁板綍涓嶉敊銆傚湪鏈杩150涓彂甯冧腑锛屾垜浠彧闇瑕佸鍏朵腑涓嶅埌10涓噸鏂版瀯寤恒傚叾涓湁3涓渚嬶紝缂洪櫡涓烘垜浠殑鏋勫缓鏈哄櫒涓婄殑glibc 搴擄紝鑺变簡寰堥暱鏃堕棿鏉ヨ窡韪

2.1.2.5. MySQL AB缂栬瘧鐨凪ySQL浜岃繘鍒剁増鏈

浣滀负MySQL AB鐨勬湇鍔★紝鎴戜滑鎻愪緵浜嗕竴濂椾簩杩涘埗MySQL鍒嗗彂鐗堬紝宸茬粡鍦ㄦ垜浠殑绔欑偣涓婃墍鍒楃殑绯荤粺鎴栨敮鎸MySQL銆佸弸濂藉湴涓烘垜浠彁渚涜闂殑鏈哄櫒涓婄殑绯荤粺涓婄紪璇戣繃銆

闄や簡鍏蜂綋骞冲彴瀹夎杞欢鍖呮牸寮忔彁渚涚殑浜岃繘鍒跺垎鍙戠増锛屾垜浠繕浠ュ帇缂tar鏂囦欢(.tar.gz鏂囦欢)涓哄绉嶅钩鍙版彁渚涗簡浜岃繘鍒跺垎鍙戠増銆傝鍙傝2.2鑺傦紝鈥滀娇鐢ㄤ簩杩涘埗鍒嗗彂鐗堢殑鏍囧噯MySQL瀹夎鈥

瀵逛簬Windows鍒嗗彂鐗堬紝鍙傝2.3鑺傦紝鈥滃湪Windows涓婂畨瑁匨ySQL鈥

浣跨敤鑴氭湰 Build-tools/Do-compile鐢熸垚杩欎簺鍒嗗彂鐗堬紝鍙互缂栬瘧婧愮爜骞朵娇鐢scripts/make_binary_distribution鍒涘缓浜岃繘鍒tar.gz鏂囦欢銆

閫氳繃涓嬮潰鐨勭紪璇戝櫒鍜岄夐」鏉ラ厤缃苟鏋勫缓浜岃繘鍒跺垎鍙戠増銆傚彲浠ユ煡鐪嬪悇涓簱浜岃繘鍒tar鏂囦欢鍒嗗彂鐗堢殑鑴氭湰bin/mysqlbug鍐呯殑鍙橀噺COMP_ENV_INFOCONFIGURE_LINE鏉ユ煡鐪嬭繖浜涗俊鎭

  • MySQL AB寮鍙戠郴缁熶笂鏋勫缓涓嬮潰鐨勪簩杩涘埗锛

             Linux 2.4.xx x86涓殑gcc 2.95.3

    CFLAGS="-O2 -mcpu=pentiumpro" CXX=gcc CXXFLAGS="-O2 -mcpu=pentiumpro -felide-constructors" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-assembler --disable-shared --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static

             Linux 2.4.x x86涓殑icc(Intel C++ Compiler 8.1鎴栨洿楂樼増鏈)

    CC=icc CXX=icpc CFLAGS="-O3 -unroll2 -ip -mp -no-gcc -restrict" CXXFLAGS="-O3 -unroll2 -ip -mp -no-gcc -restrict" ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --libexecdir=/usr/local/mysql/bin --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-assembler --disable-shared --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-embedded-server --with-innodb

    璇锋敞鎰Intel 缂栬瘧鍣8.1鐗堝拰鏇撮珮鐗堟湁涓嶅悓鐨勨滅函鈥C(icc)椹卞姩绋嬪簭鍜C++(icpc)椹卞姩绋嬪簭锛涘鏋滀綘浣跨敤icc 8.0鐗堟湰鎴栬緝鏃╃殑鐗堟湰鏉ユ瀯寤MySQL锛岄渶瑕佽缃CXX=icc

             Linux 2.4.xx Intel Itanium 2涓殑ecc (Intel C++ Itanium Compiler 7.0)

    CC=ecc CFLAGS="-O2 -tpp2 -ip -nolib_inline" CXX=ecc CXXFLAGS="-O2 -tpp2 -ip -nolib_inline" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile

             Linux 2.4.xx Intel Itanium涓殑ecc(Intel C++ Itanium Compiler 7.0)

    CC=ecc CFLAGS=-tpp1 CXX=ecc CXXFLAGS=-tpp1 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile

             Linux 2.4.xx alpha涓殑ccc(Compaq C V6.2-505 / Compaq C++ V6.3-006)

    CC=ccc CFLAGS="-fast -arch generic" CXX=cxx CXXFLAGS="-fast -arch generic -noexceptions -nortti" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --with-mysqld-ldflags=-non_shared --with-client-ldflags=-non_shared --disable-shared

             Linux 2.x.xx ppc涓殑gcc 2.95.4

    CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --libexecdir=/usr/local/mysql/bin --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --disable-shared --with-embedded-server --with-innodb

             Linux 2.4.xx s390涓殑gcc 2.95.3

    CFLAGS="-O2" CXX=gcc CXXFLAGS="-O2 -felide-constructors" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --disable-shared --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static

             Linux 2.4.xx x86_64(AMD64)涓殑gcc 3.2.1

    CXX=gcc ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --disable-shared

             Sun Solaris 8 x86涓殑gcc 3.2.3

    CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --libexecdir=/usr/local/mysql/bin --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --disable-shared --with-inno

             Sun Solaris 8 SPARC涓殑gcc 3.2

    CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-assembler --with-named-z-libs=no --with-named-curses-libs=-lcurses --disable-shared

             Sun Solaris 8 SPARC 64-bit涓殑gcc 3.2

    CC=gcc CFLAGS="-O3 -m64 -fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-O3 -m64 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --with-named-z-libs=no --with-named-curses-libs=-lcurses --disable-shared

             Sun Solaris 9 SPARC涓殑gcc 2.95.3

    CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-assembler --with-named-curses-libs=-lcurses --disable-shared

             Sun Solaris 9 SPARC涓殑cc-5.0(Sun Forte 5.0)

    CC=cc-5.0 CXX=CC ASFLAGS="-xarch=v9" CFLAGS="-Xa -xstrconst -mt -D_FORTEC_ -xarch=v9" CXXFLAGS="-noex -mt -D_FORTEC_ -xarch=v9" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-assembler --with-named-z-libs=no --enable-thread-safe-client --disable-shared

             IBM AIX 4.3.2 ppc涓殑gcc 3.2.3

    CFLAGS="-O2 -mcpu=powerpc -Wa,-many " CXX=gcc CXXFLAGS="-O2 -mcpu=powerpc -Wa,-many -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --with-named-z-libs=no --disable-shared

             IBM AIX 4.3.3 ppc涓殑xlC_r(IBM Visual Age C/C++ 6.0)

    CC=xlc_r CFLAGS="-ma -O2 -qstrict -qoptimize=2 -qmaxmem=8192" CXX=xlC_r CXXFLAGS ="-ma -O2 -qstrict -qoptimize=2 -qmaxmem=8192" ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --libexecdir=/usr/local/mysql/bin --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --with-named-z-libs=no --disable-shared --with-innodb

             IBM AIX 5.1.0 ppc涓殑gcc 3.3

    CFLAGS="-O2 -mcpu=powerpc -Wa,-many" CXX=gcc CXXFLAGS="-O2 -mcpu=powerpc -Wa,-many -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --with-named-z-libs=no --disable-shared

             IBM AIX 5.2.0 ppc涓殑xlC_r(IBM Visual Age C/C++ 6.0)

    CC=xlc_r CFLAGS="-ma -O2 -qstrict -qoptimize=2 -qmaxmem=8192" CXX=xlC_r CXXFLAGS="-ma -O2 -qstrict -qoptimize=2 -qmaxmem=8192" ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --libexecdir=/usr/local/mysql/bin --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --with-named-z-libs=no --disable-shared --with-embedded-server --with-innodb

             HP-UX 10.20 pa-risc1.1涓殑gcc 3.1

    CFLAGS="-DHPUX -I/opt/dce/include -O3 -fPIC" CXX=gcc CXXFLAGS="-DHPUX -I/opt/dce /include -felide-constructors -fno-exceptions -fno-rtti -O3 -fPIC" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --with-pthread --with-named-thread-libs=-ldce --with-lib-ccflags=-fPIC --disable-shared

             HP-UX 11.00 pa-risc涓殑aCC(HP ANSI C++ B3910B A.03.50)

    CC=cc CXX=aCC CFLAGS=+DAportable CXXFLAGS=+DAportable ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --libexecdir=/usr/local/mysql/bin --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --disable-shared --with-embedded-server --with-innodb

             HP-UX 11.11 pa-risc2.0 64bit涓殑aCC(HP ANSI C++ B3910B A.03.33)

    CC=cc CXX=aCC CFLAGS=+DD64 CXXFLAGS=+DD64 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --disable-shared

             HP-UX 11.11 pa-risc2.0 32bit涓殑aCC(HP ANSI C++ B3910B A.03.33)

    CC=cc CXX=aCC CFLAGS="+DAportable" CXXFLAGS="+DAportable" ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --libexecdir=/usr/local/mysql/bin --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --disable-shared --with-innodb

             HP-UX 11.22 ia64 64bit涓殑aCC(HP aC++/ANSI C B3910B A.05.50)

    CC=cc CXX=aCC CFLAGS="+DD64 +DSitanium2" CXXFLAGS="+DD64 +DSitanium2" ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --libexecdir=/usr/local/mysql/bin --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --disable-shared --with-embedded-server --with-innodb

             Apple Mac OS X 10.2 powerpc涓殑gcc 3.1

    CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --disable-shared

             FreeBSD 4.7 i386涓殑gcc 2.95.4

    CFLAGS=-DHAVE_BROKEN_REALPATH ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-assembler --with-named-z-libs=not-used --disable-shared

             浣跨敤LinuxThreadsFreeBSD 4.7 i386涓殑gcc 2.95.4

    CFLAGS="-DHAVE_BROKEN_REALPATH -D__USE_UNIX98 -D_REENTRANT -D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads" CXXFLAGS="-DHAVE_BROKEN_REALPATH -D__USE_UNIX98 -D_REENTRANT -D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads" ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --libexecdir=/usr/local/mysql/bin --enable-thread-safe-client --enable-local-infile --enable-assembler --with-named-thread-libs="-DHAVE_GLIBC2_STYLE_GETHOSTBYNAME_R -D_THREAD_SAFE -I /usr/local/include/pthread/linuxthreads -L/usr/local/lib -llthread -llgcc_r" --disable-shared --with-embedded-server --with-innodb

             QNX Neutrino 6.2.1 i386涓殑gcc 2.95.3qnx-nto 20010315

    CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --disable-shared

    涓嬮潰鐨勪簩杩涘埗鏄湪鐢卞叾瀹冪敤鎴锋彁渚涚粰MySQL AB鐨勭涓夋柟绯荤粺涓婃瀯寤鸿屾垚銆傝繖鏄厤璐硅禒閫侊紱MySQL AB娌℃湁瀹屽叏鎺у埗杩欎簺绯荤粺锛屽洜姝ゆ垜浠彧鑳藉鍦ㄨ繖浜涚郴缁熶笂鏋勫缓鐨勪簩杩涘埗鎻愪緵鏈夐檺鐨勬敮鎸併

               SCO Unix 3.2v5.0.7 i386涓殑gcc 2.95.3:

    CFLAGS="-O3 -mpentium" LDFLAGS=-static CXX=gcc CXXFLAGS="-O3 -mpentium -felide-constructors" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --with-named-z-libs=no --enable-thread-safe-client --disable-shared

             SCO UnixWare 7.1.4 i386涓殑CC 3.2:

    CC=cc CFLAGS="-O" CXX=CC ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --with-named-z-libs=no --enable-thread-safe-client --disable-shared --with-readline

             CO OpenServer 6.0.0 i386涓殑CC 3.2:

    CC=cc CFLAGS="-O" CXX=CC ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --with-named-z-libs=no --enable-thread-safe-client --disable-shared --with-readline

             Compaq Tru64 OSF/1 V5.1 732 alpha涓殑cc/cxx(Compaq C V6.3-029i / DIGITAL C++ V6.1-027):

    CC="cc -pthread" CFLAGS="-O4 -ansi_alias -ansi_args -fast -inline speed -speculate all" CXX="cxx -pthread" CXXFLAGS="-O4 -ansi_alias -fast -inline speed -speculate all -noexceptions -nortti" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --with-named-thread-libs="-lpthread -lmach -lexc -lc" --disable-shared --with-mysqld-ldflags=-all-static

                SGI Irix 6.5 IP32涓殑gcc 3.0.1:

    CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --disable-shared

             FreeBSD/sparc64 5.0涓殑gcc 3.2.1:

    CFLAGS=-DHAVE_BROKEN_REALPATH ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data --libexecdir=/usr/local/mysql/bin --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --disable-shared --with-innodb

    MySQL AB杩囧幓鎻愪緵鐨勪簩杩涘埗杞欢鍖呬腑搴旂敤浜嗕笅闈㈢殑缂栬瘧閫夐」銆傝繖浜涗簩杩涘埗涓嶅啀杩涜鏇存柊锛屼絾鏄湪杩欓噷鍒楀嚭浜嗚繖浜涚紪璇戦夐」渚涘弬鑰冦

              Linux 2.2.xx SPARC涓殑egcs 1.1.2:

    CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-assembler --disable-shared

             Linux 2.2.x x686涓殑gcc 2.95.2:

    CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex

             SunOS 4.1.4 2 sun4c涓殑gcc 2.7.2.1:

    CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors" ./configure --prefix=/usr/local/mysql --disable-shared --with-extra-charsets=complex --enable-assembler

             SunOS 5.5.1(鍙婁互涓婄増鏈)sun4u涓殑egcs 1.0.3a2.90.27gcc 2.95.2鍜屾洿鏂扮増:

             CC=gcc CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-low-memory --with-extra-charsets=complex --enable-assembler

             SunOS 5.6 i86pc涓殑gcc 2.8.1:

    CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-low-memory --with-extra-charsets=complex

             BSDI BSD/OS 3.1 i386涓殑gcc 2.7.2.1:

    CC=gcc CXX=gcc CXXFLAGS=-O ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex

             BSDI BSD/OS 2.1 i386涓殑gcc 2.7.2:

    CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex

             AIX 4.2涓殑gcc 2.7.2.2

    CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex

    濡傛灉浣犳湁鏇村ソ鐨勪笂杩伴厤缃夐」锛屽彲浠ュ悜MySQL internals閭欢鍒楄〃鍙戦侀偖浠躲傝鍙傝1.7.1.1鑺傦紝鈥淭he MySQL閭欢鍒楄〃鈥

    鍦ㄦ垜浠殑绔欑偣涓垪鍑虹殑MySQL 5.1鍙戝竷鐨RPM鍒嗗彂鐗堟槸鐢MySQL AB浜х敓鐨勩

    濡傛灉浣犳兂瑕佺紪璇MySQL璋冭瘯鐗堟湰锛屽簲褰撳湪鍓嶉潰鐨configure鍛戒护涓姞涓--with-debug--with-debug=full锛屽苟鍘绘帀-fomit-frame-pointer閫夐」銆

2.1.3. 鎬庢牱鑾峰緱MySQL

妫鏌MySQL涓嬭浇椤(http://dev.mysql.com/downloads/ )鑾峰彇褰撳墠鐗堟湰鍜屼笅杞芥寚浠や俊鎭傚叧浜MySQL涓嬭浇闀滃儚绔欑偣鐨勫畬鏁寸殑鏈鏂板垪琛紝鍙傝 http://dev.mysql.com/downloads/mirrors.html銆備綘鍙互鍦ㄦ鍙戠幇MySQL闀滃儚绔欑偣鍜屽浣曟姤鍛婃湁闂鐨勬垨杩囨椂鐨勯暅鍍忕珯鐐圭殑淇℃伅銆

鎴戜滑鐨勪富闀滃儚绔欑偣浣嶄簬http://mirrors.sunsite.dk/mysql/

2.1.4. 閫氳繃MD5鏍¢獙鍜屾垨GnuPG楠岃瘉杞欢鍖呯殑瀹屾暣鎬

涓嬭浇浜嗛傚悎浣犵殑闇姹傜殑MySQL瀹夎杞欢鍖呭苟鍦ㄥ畨瑁呭墠锛屼綘搴斿綋纭繚瀹冪殑瀹屾暣鎬э紝娌℃湁琚鏀广MySQL AB鎻愪緵浜3绉嶅畬鏁存ф鏌ユ柟娉曪細

         MD5鏍¢獙鍜

         浣跨敤GnuPGGNU Privacy Guard瀵圭鍚嶈繘琛屽姞瀵

         瀵逛簬RPM杞欢鍖咃紝浣跨敤鍐呭祵寮RPM瀹屾暣鎬ч獙璇佹満鍒

涓嬮潰鐨勭珷鑺傛弿杩颁簡濡備綍浣跨敤杩欎簺鏂规硶銆

濡傛灉浣犳敞鎰忓埌MD5鏍¢獙鍜屼笌GPG绛惧悕涓嶅尮閰嶏紝棣栧厛搴斿皾璇曞娆′笅杞界浉鍏冲畨瑁呰蒋浠跺寘锛屽彲浠ヤ粠鍏跺畠闀滃儚绔欑偣銆傚鏋滀綘鍙嶅灏濊瘯浠嶄笉鑳芥垚鍔熼獙璇佸畨瑁呰蒋浠跺寘鐨勫畬鏁存э紝璇峰皢姝ょ被闂閫氱煡缁欐垜浠紝鍖呮嫭瀹屾暣鐨勫畨瑁呰蒋浠跺寘鍚嶅拰浣犱娇鐢ㄧ殑涓嬭浇绔欑偣锛屽湪<webmaster@mysql.com><build@mysql.com>銆備笉瑕佷娇鐢ㄧ己闄-鎶ュ憡鏈哄埗鏉ユ姤鍛婁笅杞介棶棰樸

2.1.4.1. 楠岃瘉MD5鏍¢獙鍜

涓嬭浇MySQL瀹夎杞欢鍖呭悗锛屼綘搴斿綋纭繚瀹冪殑MD5鏍¢獙鍜屼笌鎻愪緵鐨MySQL涓嬭浇椤典笂鐨勭浉鍖归厤銆傛瘡涓畨瑁呰蒋浠跺寘鏈夊敮涓鐨勬牎楠屽拰锛屽彲浠ョ敤涓嬮潰鐨勫懡浠ゆ潵楠岃瘉锛屽叾涓package_name鏄綘涓嬭浇鐨勫畨瑁呰蒋浠跺寘鐨勫悕绉帮細

shell> md5sum package_name

绀轰緥锛

  shell> md5sum mysql-stard-5.1.2-alpha-linux-i686.tar.gz
  aaab65abbec64d5e907dcd41b8699945  mysql-stard-5.1.2-alpha-linux-i686.tar.gz

浣犲簲褰撻獙璇佺粨鏋滄牎楠屽拰(鍗佸叚杩涘埗鏁板瓧瀛楃涓)涓庝笅杞介〉涓婄浉鍏冲畨瑁呰蒋浠跺寘涓嬮潰鏄剧ず鐨勬牎楠屽拰鐩稿尮閰嶃

娉ㄩ噴锛涓瀹氳楠岃瘉褰掓。鏂囦欢(渚嬪锛.zip.tar.gz鏂囦欢)鐨勬牎楠屽拰锛岃屼笉鏄叾涓寘鎷殑鏂囦欢銆

璇锋敞鎰忓苟闈炴墍鏈夋搷浣滅郴缁熸敮鎸md5sum鍛戒护銆傚湪涓浜涙搷浣滅郴缁熶笂锛屽彧鏄О涓md5鍙︿竴浜涙牴鏈笉瑁呰浇瀹冦傚湪Linux涓紝瀹冩槸GNU Text Utilities瀹夎杞欢鍖呯殑涓閮ㄥ垎锛岄傚悎鍚勭骞冲彴銆傚彲浠ヤ粠http//www.gnu.org/software/textutils/涓嬭浇婧愮爜銆傚鏋滀綘宸茬粡瀹夎浜OpenSSL锛岃繕鍙互浣跨敤鍛戒护openssl md5 package_namehttp//www.fourmilab.ch/md5/鎻愪緵浜DOS/Windows浣跨敤鐨md5鍛戒护琛屽疄鐢ㄥ伐鍏枫winMd5Sum鏄竴涓浘褰MD5妫鏌ュ伐鍏凤紝鍙互浠http//www.nullriver.com/index/products/winmd5sum鑾峰緱銆

2.1.4.2. 閫氳繃GnuPG杩涜绛惧悕妫鏌

楠岃瘉瀹夎杞欢鍖呭畬鏁存у拰鐪熷疄鎬х殑鍙︿竴涓柟娉曟槸浣跨敤鍔犲瘑绛惧悕銆傝繖姣斾娇鐢MD5鏍¢獙鍜屾洿鍙潬锛屼絾鏄渶瑕佹洿澶氱殑宸ヤ綔銆

MySQL ABGnuPG(GNU Privacy Guard)瀵逛笅杞MySQ杞欢鍖呰繘琛岀鍚嶃GnuPG鏄紑鏀炬簮鐮侊紝涓嶅悓浜Phil Zimmermann鐨勯椈鍚嶇殑Pretty Good Privacy (PGP)銆傚叧浜GnuPG鍜屽浣曡幏寰楀苟瀹夎鍒颁綘鐨勭郴缁熺殑璇︾粏淇℃伅锛岃鍙傝http//www.gnupg.org/銆傚ぇ澶氭暟Linux鍒嗗彂鐗堣鏈夐粯璁ゅ畨瑁呯殑GnuPG銆傚叧浜GnuPG鐨勮缁嗕俊鎭紝鍙傝 http//www.openpgp.org/

瑕佹兂楠岃瘉鍏蜂綋瀹夎杞欢鍖呯殑绛惧悕锛屼綘棣栧厛闇瑕佽幏寰MySQL AB鍏叡GPG鏋勫缓瀵嗛挜鐨勬嫹璐濄傚彲浠ヤ粠http//www.keyserver.net/涓嬭浇瀵嗛挜銆備綘鎯宠鑾峰緱鐨勫瘑閽ュ悕涓build@mysql.com銆傚彟澶栵紝鍙互浠庝笅闈㈢殑鏂囨湰鐩存帴鍓垏骞剁矘璐村瘑閽ワ細

Key ID:
pub  1024D/5072E1F5 2003-02-03
     MySQL Package signing key (www.mysql.com) <build@mysql.com>
Fingerprint: A4A9 4068 76FC BD3C 4567  70C8 8C71 8D3B 5072 E1F5
 
Public Key (ASCII-armored):
 
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
 
mQGiBD4+owwRBAC14GIfUfCyEDSIePvEW3SAFUdJBtoQHH/nJKZyQT7h9bPlUWC3
RODjQReyCITRrdwyrKUGku2FmeVGwn2u2WmDMNABLnpprWPkBdCk96+OmSLN9brZ
fw2vOUgCmYv2hW0hyDHuvYlQA/BThQoADgj8AW6/0Lo7V1W9/8VuHP0gQwCgvzV3
BqOxRznNCRCRxAuAuVztHRcEAJooQK1+iSiunZMYD1WufeXfshc57S/+yeJkegNW
hxwR9pRWVArNYJdDRT+rf2RUe3vpquKNQU/hnEIUHJRQqYHo8gTxvxXNQc7fJYLV
K2HtkrPbP72vwsEKMYhhr0eKCbtLGfls9krjJ6sBgACyP/Vb7hiPwxh6rDZ7ITnE
kYpXBACmWpP8NJTkamEnPCia2ZoOHODANwpUkP43I7jsDmgtobZX9qnrAXw+uNDI
QJEXM6FSbi0LLtZciNlYsafwAPEOMDKpMqAK6IyisNtPvaLd8lH0bPAnWqcyefep
rv0sxxqUEMcM3o7wwgfN83POkDasDbs3pjwPhxvhz6//62zQJ7Q7TXlTUUwgUGFj
a2FnZSBzaWduaW5nIGtleSAod3d3Lm15c3FsLmNvbSkgPGJ1aWxkQG15c3FsLmNv
bT6IXQQTEQIAHQUCPj6jDAUJCWYBgAULBwoDBAMVAwIDFgIBAheAAAoJEIxxjTtQ
cuH1cY4AnilUwTXn8MatQOiG0a/bPxrvK/gCAJ4oinSNZRYTnblChwFaazt7PF3q
zIhMBBMRAgAMBQI+PqPRBYMJZgC7AAoJEElQ4SqycpHyJOEAn1mxHijft00bKXvu
cSo/pECUmppiAJ41M9MRVj5VcdH/KN/KjRtW6tHFPYhMBBMRAgAMBQI+QoIDBYMJ
YiKJAAoJELb1zU3GuiQ/lpEAoIhpp6BozKI8p6eaabzF5MlJH58pAKCu/ROofK8J
Eg2aLos+5zEYrB/LsrkCDQQ+PqMdEAgA7+GJfxbMdY4wslPnjH9rF4N2qfWsEN/l
xaZoJYc3a6M02WCnHl6ahT2/tBK2w1QI4YFteR47gCvtgb6O1JHffOo2HfLmRDRi
Rjd1DTCHqeyX7CHhcghj/dNRlW2Z0l5QFEcmV9U0Vhp3aFfWC4Ujfs3LU+hkAWzE
7zaD5cH9J7yv/6xuZVw411x0h4UqsTcWMu0iM1BzELqX1DY7LwoPEb/O9Rkbf4fm
Le11EzIaCa4PqARXQZc4dhSinMt6K3X4BrRsKTfozBu74F47D8Ilbf5vSYHbuE5p
/1oIDznkg/p8kW+3FxuWrycciqFTcNz215yyX39LXFnlLzKUb/F5GwADBQf+Lwqq
a8CGrRfsOAJxim63CHfty5mUc5rUSnTslGYEIOCR1BeQauyPZbPDsDD9MZ1ZaSaf
anFvwFG6Llx9xkU7tzq+vKLoWkm4u5xf3vn55VjnSd1aQ9eQnUcXiL4cnBGoTbOW
I39EcyzgslzBdC++MPjcQTcA7p6JUVsP6oAB3FQWg54tuUo0Ec8bsM8b3Ev42Lmu
QT5NdKHGwHsXTPtl0klk4bQk4OajHsiy1BMahpT27jWjJlMiJc+IWJ0mghkKHt92
6s/ymfdf5HkdQ1cyvsz5tryVI3Fx78XeSYfQvuuwqp2H139pXGEkg0n6KdUOetdZ
Whe70YGNPw1yjWJT1IhMBBgRAgAMBQI+PqMdBQkJZgGAAAoJEIxxjTtQcuH17p4A
n3r1QpVC9yhnW2cSAjq+kr72GX0eAJ4295kl6NxYEuFApmr1+0uUq/SlsQ==
=YJkx
-----END PGP PUBLIC KEY BLOCK-----

浣犲彲浠ヤ娇鐢gpg --import灏嗘瀯寤哄瘑閽ュ鍏ヤ綘鐨勪釜浜哄叕鍏GPG閽ュ寵鍦keyring銆備緥濡傦紝濡傛灉浣犳妸瀵嗛挜淇濆瓨鍒mysql_pubkey.asc鏂囦欢涓紝瀵煎叆鍛戒护搴斾负锛

shell> gpg --import mysql_pubkey.asc

鍏充簬鍏叡瀵嗛挜濡備綍宸ヤ綔鐨勮缁嗕俊鎭紝璇峰弬闃GPG鏂囨。銆

涓嬭浇骞跺鍏ュ叕鍏辨瀯寤哄瘑閽ュ悗锛屼笅杞芥湡鏈涚殑MySQL瀹夎杞欢鍖呭拰鐩稿簲鐨勭鍚嶏紝涔熷彲浠ヤ粠涓嬭浇椤典笂鑾峰緱銆傜鍚嶆枃浠跺悕涓庡垎鍙戠増鏂囦欢鐩稿悓锛屾湁 an .asc鎵╁睍鍚嶃備緥濡傦細

鍒嗗彂鏂囦欢

mysql-stard-5.1.2-alpha-linux-i686.tar.gz

绛惧悕鏂囦欢

mysql-stard-5.1.2-alpha-linux-i686.tar.gz.asc

纭繚涓や釜鏂囦欢淇濆瓨鍦ㄥ悓涓鐩綍涓嬶紝杩愯涓嬮潰鐨勫懡浠ゆ潵楠岃瘉鍒嗗彂鏂囦欢鐨勭鍚嶏細

shell> gpg --verify package_name.asc

绀轰緥锛

  shell> gpg --verify mysql-standard-5.1.2-alpha-linux-i686.tar.gz.asc
  gpg: Signature made Tue 12 Jul 2005 23:35:41 EST using DSA key ID 5072E1F5
  gpg: Good signature from "MySQL Package signing key (www.mysql.com) <build@mysql.com>"

Good signature娑堟伅琛ㄧず鎵鏈夊唴瀹归兘寰堟纭備綘鍙互蹇界暐浠讳綍insecure memory璀﹀憡銆

2.1.4.3. 浣跨敤RPM杩涜绛惧悕妫鏌

RPM杞欢鍖呮病鏈夊崟鐙殑绛惧悕銆RPM杞欢鍖呭唴缃GPG绛惧悕鍜MD5鏍¢獙鍜屻傚彲浠ヨ繍琛屼笅闈㈢殑鍛戒护鏉ラ獙璇佸畨瑁呰蒋浠跺寘锛

shell> rpm --checksig package_name.rpm

绀轰緥锛

shell> rpm --checksig MySQL-server-5.1.2-alpha-0.i386.rpm
MySQL-server-5.1.2-alpha-0.i386.rpm md5 gpg OK

娉ㄩ噴锛濡傛灉浣犳浣跨敤RPM 4.1锛屽苟涓斿嚭鐜板叧浜(GPG) NOT OK (MISSING KEYS: GPG#5072e1f5)鐨勬姳鎬紝灏界浣犲凡缁忓皢MySQL鍏叡鏋勫缓瀵嗛挜瀵煎叆鍒颁綘鑷繁鐨GPG閽ュ寵鍦堬紝浣犲繀椤婚鍏堝皢瀵嗛挜瀵煎叆鍒RPM閽ュ寵鍦堜腑銆RPM 4.1涓嶅啀浣跨敤浣犵殑涓汉GPG閽ュ寵鍦(GPG鏈韩)RPM 4.1缁存姢鑷繁鐨勯挜鍖欏湀锛屽洜涓哄畠鏄郴缁熻寖鍥寸殑搴旂敤绋嬪簭锛岃岀敤鎴GPG鍏叡閽ュ寵鍦堟槸鍏蜂綋鐨勭敤鎴锋枃浠躲傝鎯冲皢MySQL鍏叡瀵嗛挜瀵煎叆RPM閽ュ寵鍦堬紝瑕侀鍏堣幏寰楀墠闈㈢珷鑺傛弿杩扮殑瀵嗛挜銆傜劧鍚庝娇鐢rpm --import瀵煎叆瀵嗛挜銆備緥濡傦紝濡傛灉浣犵殑鍏叡瀵嗛挜淇濆瓨鍦mysql_pubkey.asc鏂囦欢涓紝搴斾娇鐢ㄤ笅杩板懡浠ゅ鍏ュ叕鍏卞瘑閽ワ細

shell> rpm --import mysql_pubkey.asc

濡傛灉浣犻渶瑕佽幏寰MySQL鍏叡瀵嗛挜锛屽弬瑙2.1.4.2鑺傦紝鈥滈氳繃GnuPG杩涜绛惧悕妫鏌

2.1.5. 瀹夎甯冨眬

杩欒妭鎻忚堪瀹夎MySQL AB鎻愪緵鐨勪簩杩涘埗浠g爜鍜屾簮鐮佸垎鍙戞椂鍒涘缓鐨勯粯璁ょ洰褰曞竷灞銆傚鏋滀綘瀹夎鍏跺畠渚涘簲鍟嗘彁渚涚殑鍒嗗彂锛屽簲浣跨敤鍏跺畠甯冨眬銆

Windows涓紝MySQL 5.1鐨勯粯璁ゅ畨瑁呯洰褰曟槸C:\Program Files\MySQL\MySQL Server 5.1(涓浜Windows鐢ㄦ埛瀹佹効瀹夎鍒板師鏉ョ殑榛樿瀹夎鐩綍 C\mysql銆傜劧鑰岋紝瀛愮洰褰曞竷灞浠嶇劧鐩稿悓锛瀹夎鐩綍鍖呮嫭浠ヤ笅瀛愮洰褰曪細

鐩綍

鐩綍鍐呭

bin

瀹㈡埛绔▼搴忓拰mysqld鏈嶅姟鍣

data

鏃ュ織鏂囦欢锛屾暟鎹簱

Docs

鏂囨。

examples

绀轰緥绋嬪簭鍜岃剼鏈

include

鍖呭惈()鏂囦欢

lib

scripts

瀹炵敤宸ュ叿鑴氭湰

share

閿欒娑堟伅鏂囦欢

浣跨敤MySQL AB's Linux RPM鍒嗗彂杩涜瀹夎鍚庯紝灏嗗湪浠ヤ笅绯荤粺鐩綍浜х敓鏂囦欢锛

鐩綍

鐩綍鍐呭

/usr/bin

瀹㈡埛绔▼搴忓拰鑴氭湰

/usr/sbin

mysqld鏈嶅姟鍣

/var/lib/mysql

鏃ュ織鏂囦欢锛屾暟鎹簱

/usr/share/doc/packages

鏂囨。

/usr/include/mysql

鍖呭惈()鏂囦欢

/usr/lib/mysql

/usr/share/mysql

閿欒娑堟伅鍜屽瓧绗﹂泦鏂囦欢

/usr/share/sql-bench

鍩哄噯绋嬪簭

Unix涓紝鍙互鍦ㄤ綘閫夋嫨鐨勫畨瑁呬綅缃В鍘嬪苟瀹夎tar鏂囦欢浜岃繘鍒跺垎鍙(typically /usr/local/mysql)骞跺湪璇ヤ綅缃垱寤轰互涓嬬洰褰曪細

鐩綍

鐩綍鍐呭

bin

瀹㈡埛绔▼搴忓拰mysqld鏈嶅姟鍣

data

鏃ュ織鏂囦欢锛屾暟鎹簱

docs

鏂囨。锛ChangeLog

include

鍖呭惈()鏂囦欢

lib

scripts

mysql_install_db

share/mysql

閿欒娑堟伅鏂囦欢

sql-bench

鍩哄噯绋嬪簭

閰嶇疆骞剁紪璇戝畬婧愮爜鍒嗗彂鍚庯紝渚垮紑濮嬪畨瑁呫傞粯璁ゆ儏鍐典笅锛屽彲浠ュ皢鏂囦欢瀹夎鍒/usr/local锛屽嵆鍦ㄤ笅闈㈢殑瀛愮洰褰曚腑锛

鐩綍

鐩綍鍐呭

bin

瀹㈡埛绔▼搴忓拰鑴氭湰

include/mysql

鍖呭惈()鏂囦欢

info

Info鏍煎紡鐨勬枃妗

lib/mysql

libexec

mysqld鏈嶅姟鍣

share/mysql

閿欒娑堟伅鏂囦欢

sql-bench

鍩哄噯绋嬪簭鍜crash-me娴嬭瘯

var

鏁版嵁搴撳拰鏃ュ織鏂囦欢

鍦ㄤ竴涓畨瑁呯洰褰曞唴锛屾簮鐮佸畨瑁呯殑甯冨眬鍦ㄤ笅鍒楁柟闈笉鍚屼簬浜岃繘鍒跺畨瑁咃細

         mysqld鏈嶅姟鍣ㄨ瀹夎鍦libexec鐩綍鑰屼笉鏄bin鐩綍鍐呫

         鏁版嵁鐩綍鏄var鑰岄潪data

         mysql_install_db琚畨瑁呭湪bin鐩綍鑰岄潪scripts鍐呫

         澶存枃浠跺拰搴撶洰褰曟槸include/mysqllib/mysql鑰岄潪includelib

鎵ц婧愮爜鍒嗗彂鏍圭洰褰曚笅鐨scripts/make_binary_distribution鑴氭湰锛屼綘鍙互鐢ㄧ紪璇戣繃鐨勬簮鐮佸垎鍙戠増鍒涘缓浣犺嚜宸辩殑浜岃繘鍒跺畨瑁呫

2.2. 浣跨敤浜岃繘鍒跺垎鍙戠増鐨勬爣鍑哅ySQL瀹夎

鍚庨潰鍑犵珷鍖呮嫭濡備綍鍦ㄥ畨瑁呰蒋浠跺寘鏍煎紡閫傚悎鐨勫钩鍙颁笂骞冲彴瀹夎MySQL(鍗虫墽琛屸浜岃繘鍒跺畨瑁鈥濓級涔熷彲浠ュ湪澶氱骞冲彴涓婂畨瑁MySQL浜岃繘鍒跺垎鍙戠増銆傚叧浜庨傚悎鎵鏈夊钩鍙扮殑杞欢鍖呯殑閫氱敤瀹夎鎸囦护鍙傝2.7鑺傦紝鈥滃湪鍏跺畠绫籙nix绯荤粺涓畨瑁匨ySQL鈥

鍏充簬浜岃繘鍒跺垎鍙戠増鐨勪娇鐢ㄥ拰濡備綍鑾峰緱鐨勮缁嗕俊鎭鍙傝2.1鑺傦紝鈥滀竴鑸畨瑁呴棶棰樷

2.3.聽鍦╓indows涓婂畨瑁匨ySQL

MySQL AB宸茬粡鎻愪緵浜Windows涓畨瑁呯殑MySQL 3.21浠ヤ笂鐗堟湰锛屽苟鎻愪緵浜嗘瘡澶╀笅杞MySQL鐨勬瘮鐜囥傛湰鑺傛弿杩板湪Windows涓畨瑁MySQL鐨勮繃绋嬨

浣跨敤Windows鐗堟湰MySQL瀹夎鍣紝缁撳悎GUI閰嶇疆鍚戝锛屽彲浠ヨ嚜鍔ㄥ畨瑁MySQL锛屽垱寤洪夐」鏂囦欢锛屽惎鍔ㄦ湇鍔″櫒骞朵娇榛樿鐢ㄦ埛璐︽埛瀹夊叏銆

濡傛灉浣犺鍗囩骇宸叉湁鐨4.1.5鐗堜互鍓嶇殑MySQL,浣犲繀椤绘墽琛屼互涓嬫楠わ細

1.    鑾峰緱骞跺畨瑁呭垎鍙戠増銆

2.    鏍规嵁闇瑕佽缃夐」鏂囦欢銆

3.    閫夋嫨鎯宠浣跨敤鐨勬湇鍔″櫒銆

4.    鍚姩鏈嶅姟鍣ㄣ

5.    涓哄垵濮MySQL璐︽埛鎸囧畾瀵嗙爜銆

璇ヨ繃绋嬭繕閫傚悎瀹夎杞欢鍖呭唴涓嶅寘鎷畨瑁呭櫒鐨MySQL瀹夎銆

WindowsMySQL 5.13绉嶅垎鍙戞牸寮忥細

          浜岃繘鍒跺垎鍙戠増鍖呭惈涓涓缃▼搴忥紝鍙互瀹夎浣犻渶瑕佺殑浠讳綍鍐呭锛屽洜姝ゅ彲浠ョ珛鍗冲惎鍔ㄦ湇鍔″櫒銆

          婧愮爜鍒嗗彂鐗堝寘鍚墍鏈変娇鐢Visual Studio 2003缂栬瘧鍣ㄦ潵鏋勫缓鍙墽琛岀▼搴忕殑浠g爜鍜屾敮鎸佹枃浠躲

涓鑸潵璁诧紝浣犲簲褰撲娇鐢ㄤ簩杩涘埗鍒嗗彂鐗堛傚畠姣斿叾瀹冪殑鍒嗗彂鐗堜娇鐢ㄨ捣鏉ヨ绠鍗曪紝涓嶅啀闇瑕佸叾瀹冨伐鍏锋潵鍚姩骞惰繍琛MySQL

鏈妭鎻忚堪浜嗗浣曚娇鐢ㄤ簩杩涘埗鍒嗗彂鐗堝湪Windows涓畨瑁MySQL銆傝鎯充娇鐢ㄦ簮鐮佸垎鍙戠増瀹夎锛屽弬瑙2.8.6鑺傦紝鈥滃湪Windows涓嬩粠婧愮爜瀹夎MySQL鈥

2.3.1. Windows绯荤粺瑕佹眰

瑕佹兂鍦Windows涓繍琛MySQL锛屼綘闇瑕侊細

         32Windows鎿嶄綔绯荤粺锛屼緥濡9xMeNT2000XPWindows Server 2003

鍩轰簬Windows NT鐨勬搷浣滅郴缁(NT2000,XP2003)锛屽皢MySQL鏈嶅姟鍣ㄥ仛涓烘湇鍔℃潵杩愯銆傚己鐑堝缓璁娇鐢ㄥ熀浜Windows NT鐨勬搷浣滅郴缁熴傝鍙傝2.3.12鑺傦紝鈥滀互Windows鏈嶅姟鏂瑰紡鍚姩MySQL鈥

         TCP/IP鍗忚鏀寔銆

         Windows鐗堟湰MySQL浜岃繘鍒跺垎鍙戠増锛屽彲浠ヤ粠http//dev.mysql.com/涓嬭浇/涓嬭浇銆傝鍙傝2.1.3鑺傦紝鈥滄庢牱鑾峰緱MySQL鈥

娉ㄩ噴锛氬鏋滀綘浠FTP涓嬭浇鍒嗗彂鐗堬紝鎴戜滑寤鸿浣跨敤鍏呭垎鐨FTP瀹㈡埛绔互淇濊瘉缁紶锛岄伩鍏嶄笅杞借繃绋嬩腑鏂囦欢琚牬鍧忋

         鍙互璇诲彇 .zip鏂囦欢鐨勫伐鍏凤紝浠ヨВ鍘嬪垎鍙戞枃浠躲

         纭洏涓婃湁瓒冲鐨勭┖闂翠繚璇佹牴鎹綘鐨勯渶姹傛潵瑙e寘銆佸畨瑁呭拰鍒涘缓鏁版嵁搴(涓鑸缓璁嚦灏戞湁200鍏嗗瓧鑺)

浣犺繕鍙互鏈変互涓嬪彲閫夐渶姹傦細

         濡傛灉浣犺鍒掗氳繃ODBC杩炴帴MySQL鏈嶅姟鍣紝浣犺繕闇瑕佷竴涓繛鎺ュ櫒/ODBC椹卞姩绋嬪簭銆傝鍙傝26.1鑺傦紝鈥淢ySQL Connector/ODBC鈥

         濡傛灉琛ㄩ渶瑕佸崰鐢ㄧ殑绌洪棿澶т簬4GB锛屽垯鍦NTFS鎴栨洿鏂扮殑鏂囦欢绯荤粺涓婂畨瑁MySQL銆傚綋鍒涘缓琛ㄦ椂涓嶈蹇樿浣跨敤MAX_ROWSAVG_ROW_LENGTH銆傝鍙傝13.1.5鑺傦紝鈥淐REATE TABLE璇硶鈥

2.3.2. 閫夋嫨瀹夎杞欢鍖

Windows涓畨瑁MySQL鏃讹紝鏈3MySQL 5.1瀹夎杞欢鍖呭彲渚涢夋嫨锛

         鍩烘湰瀹夎锛氳瀹夎杞欢鍖呯殑鏂囦欢鍚嶇被浼间簬mysql-essential-5.1.2-alpha-win32.msi锛屽寘鍚湪Windows涓畨瑁MySQL鎵闇瑕佺殑鏈灏戠殑鏂囦欢锛屽寘鎷厤缃悜瀵笺傝瀹夎杞欢鍖呬笉鍖呮嫭鍙夌粍浠讹紝渚嬪宓屽叆寮忔湇鍔″櫒鍜屽熀鍑嗗浠躲

         瀹屽叏瀹夎锛氳瀹夎杞欢鍖呯殑鏂囦欢鍚嶇被浼间簬mysql-5.1.2-alpha-win32.zip锛屽寘鍚湪Windows涓畨瑁MySQL鎵闇瑕佺殑鍏ㄩ儴鏂囦欢锛屽寘鎷厤缃悜瀵笺傝瀹夎杞欢鍖呭寘鎷彲閫夌粍浠讹紝渚嬪宓屽叆寮忔湇鍔″櫒鍜屽熀鍑嗗浠躲

         闈炶嚜鍔ㄥ畨瑁呮枃浠锛氳瀹夎杞欢鍖呯殑鏂囦欢鍚嶇被浼间簬mysql-noinstall-5.1.2-alpha-win32.zip锛屽寘鍚畬鏁村畨瑁呭寘涓殑鍏ㄩ儴鏂囦欢锛屽彧鏄笉鍖呮嫭閰嶇疆鍚戝銆傝瀹夎杞欢鍖呬笉鍖呮嫭鑷姩瀹夎鍣紝蹇呴』鎵嬪姩瀹夎鍜岄厤缃

瀵逛簬澶у鏁扮敤鎴凤紝寤鸿閫夋嫨鍩烘湰瀹夎銆

浣犵殑閫夋嫨浼氬奖鍝嶄綘鍚庨潰蹇呴』閬典粠鐨勫畨瑁呰繃绋嬨傚鏋滀綘閫夋嫨鍩烘湰瀹夎鎴栧畬鍏ㄥ畨瑁咃紝鍙傝2.3.3鑺傦紝鈥滅敤鑷姩瀹夎鍣ㄥ畨瑁匨ySQL鈥銆傚鏋滀綘閫夋嫨闈炶嚜鍔ㄥ畨瑁MySQL锛屽弬瑙2.3.6鑺傦紝鈥滈氳繃闈炲畨瑁匷ip鏂囦欢瀹夎MySQL鈥

2.3.3.聽鐢ㄨ嚜鍔ㄥ畨瑁呭櫒瀹夎MySQL

Windows涓畨瑁MySQL鏃讹紝鏂扮敤鎴峰彲浠ヤ娇鐢MySQL瀹夎甯姪鍜MySQL Configuration Wizard锛堥厤缃悜瀵硷級銆MySQL瀹夎鍜岄厤缃殑鏂瑰紡鏄娇鏂扮敤鎴峰彲浠ョ珛鍗冲紑濮嬩娇鐢MySQL

鍩烘湰瀹夎鍜屽畬鍏ㄥ畨瑁呬腑鍧囧寘鎷MySQL瀹夎甯姪鍜岄厤缃悜瀵硷紝寤鸿鍦ㄥぇ澶氭暟鏍囧噯MySQL瀹夎涓夋嫨銆備緥澶栨儏鍐靛寘鎷兂鍦ㄥ崟涓湇鍔″櫒涓婂畨瑁呭涓疄渚嬬殑鐢ㄦ埛鍜屾兂瀹屽叏鎺у埗鏈嶅姟鍣ㄩ厤缃殑楂樼骇鐢ㄦ埛銆

2.3.4. 浣跨敤MySQL瀹夎鍚戝

2.3.4.1. 鍓嶈█

MySQL瀹夎甯姪鏄MySQL鏈嶅姟鍣ㄧ殑瀹夎鍣紝浣跨敤鏈鏂扮殑Microsoft Window瀹夎鍣ㄦ妧鏈傜粨鍚堜娇鐢MySQL瀹夎甯姪鍜岄厤缃悜瀵硷紝鐢ㄦ埛瀹夎骞 閰嶇疆瀹MySQL鏈嶅姟鍣ㄥ悗渚垮彲浠ョ洿鎺ヤ娇鐢ㄣ

MySQL瀹夎甯姪鏄MySQL 5.1鏈嶅姟鍣ㄥ垎鍙戠殑鏍囧噯瀹夎鍣ㄣ備娇鐢MySQL瀹夎甯姪瀹夎MySQL涔嬪墠锛岀敤鎴烽渶瑕佹墜鍔ㄥ叧闂苟鍗歌浇宸茬粡瀹夎鐨勪互鍓嶇増鏈殑MySQL銆傚叧浜庡浠ュ墠鐗堟湰杩涜鍗囩骇鐨勮缁嗕俊鎭鍙傝 2.3.4.7鑺傦紝鈥滃崌绾ySQL鈥

鏈杩戠増鏈殑Windows鍖呭惈浜嗘敼杩涚増鏈殑Microsoft Windows瀹夎鍣(MSI)MSI宸茬粡鎴愪负Windows 2000Windows XPWindows Server 2003搴旂敤绋嬪簭瀹夎鐨勪簨瀹炴爣鍑嗐MySQL瀹夎甯姪涓娇鐢ㄤ簡璇ユ妧鏈紝浣垮畨瑁呰繃绋嬫洿鍔犵伒娲汇侀『鍒┿

Microsoft Windows瀹夎鍣ㄥ紩鎿庨殢鐫Windows XP鐨勬洿鏂拌屾洿鏂帮紱浣跨敤浠ュ墠Windows鐗堟湰鐨勭敤鎴峰彲浠ュ弬鑰Microsoft 鐭ヨ瘑搴撴枃绔鏌ラ槄鍏充簬鍗囩骇鍒版渶鏂扮増Windows瀹夎鍣ㄥ紩鎿庣殑璧勬枡銆

姝ゅ锛Microsoft鏈杩戝凡缁忓紩鍏ヤ簡WiX(Windows 瀹夎鍣 XML)宸ュ叿鍖呫傝繖鏄Microsoft鍏鐨勫紑鏀炬簮鐮侀」鐩傛垜浠浆鎹㈠埌WiX鏄洜涓哄畠鏄竴涓紑鏀炬簮鐮侀」鐩紝鍙互浣跨敤鑴氭湰鏇村姞鐏垫椿鍦板鐞嗘暣涓Windows瀹夎杩囩▼銆

MySQL瑁呭府鍔╃殑鏀硅繘渚濊禆浜庡悇鐢ㄦ埛鐨勬敮鎸佸拰鍙嶉銆傚鏋滀綘鍙戠幇MySQL瀹夎甯姪缂哄皯瀵逛綘寰堥噸瑕佺殑鏌愪簺鍔熻兘锛屾垨濡傛灉浣犲彂鐜版煇涓己闄凤紝璇蜂娇鐢ㄦ垜浠殑MySQL缂洪櫡绯荤粺鏉ョ储鍙栧姛鑳芥垨鎶ュ憡闂銆

2.3.4.2. 涓嬭浇骞跺惎鍔∕ySQL瀹夎鍚戝

鍙互浠http://dev.mysql.com/downloads/涓嬭浇MySQL鏈嶅姟鍣ㄥ畨瑁呰蒋浠跺寘銆傚鏋滀綘涓嬭浇鐨勫畨瑁呰蒋浠跺寘鍦Zip鏂囦欢涓紝浣犻渶瑕佸厛鎻愬彇鏂囦欢銆

鍚姩甯姪鐨勮繃绋嬪彇鍐充簬涓嬭浇鐨勫畨瑁呰蒋浠跺寘鐨勫唴瀹广傚鏋滄湁setup.exe鏂囦欢锛屽弻鍑诲惎鍔ㄥ畨瑁呰繃绋嬨傚鏋滄湁.msi鏂囦欢锛屽弻鍑诲惎鍔ㄥ畨瑁呰繃绋嬨

2.3.4.3. 閫夋嫨瀹夎绫诲瀷

3绉嶅畨瑁呯被鍨嬶細Typical(鍏稿瀷瀹夎)Complete(瀹屽叏瀹夎)Custom(瀹氬埗瀹夎)

Typical(鍏稿瀷瀹夎)瀹夎鍙畨瑁MySQL鏈嶅姟鍣ㄣmysql鍛戒护琛屽鎴风鍜屽懡浠よ瀹炵敤绋嬪簭銆傚懡浠よ瀹㈡埛绔拰瀹炵敤绋嬪簭鍖呮嫭mysqldumpmyisamchk鍜屽叾瀹冨嚑涓伐鍏锋潵甯姪浣犵鐞MySQL鏈嶅姟鍣ㄣ

Complete(瀹屽叏瀹夎)瀹夎灏嗗畨瑁呰蒋浠跺寘鍐呭寘鍚殑鎵鏈夌粍浠躲傚畬鍏ㄥ畨瑁呰蒋浠跺寘鍖呮嫭鐨勭粍浠跺寘鎷祵鍏ュ紡鏈嶅姟鍣ㄥ簱銆佸熀鍑嗗浠躲佹敮鎸佽剼鏈拰鏂囨。銆

Custom(瀹氬埗瀹夎)瀹夎鍏佽浣犲畬鍏ㄦ帶鍒朵綘鎯宠瀹夎鐨勮蒋浠跺寘鍜屽畨瑁呰矾寰勩傚叧浜庡畾鍒跺畨瑁呯殑璇︾粏淇℃伅璇峰弬瑙2.3.4.4鑺傦紝鈥滃畾鍒跺畨瑁呭璇濇鈥

濡傛灉浣犻夋嫨Typical(鍏稿瀷瀹夎)Complete(瀹屽叏瀹夎)瀹夎骞剁偣鍑Next鎸夐挳锛屼綘灏嗚繘鍏ョ‘璁ょ獥鍙g‘璁ら夋嫨骞跺紑濮嬪畨瑁呫傚鏋滀綘閫夋嫨瀹氬埗瀹夎骞剁偣鍑Next鎸夐挳锛屼綘灏嗚繘鍏ュ畾鍒跺畨瑁呭璇濇锛屽弬瑙2.3.4.4鑺傦紝鈥滃畾鍒跺畨瑁呭璇濇鈥

2.3.4.4. 瀹氬埗瀹夎瀵硅瘽妗

濡傛灉浣犳兂瑕佹洿鏀MySQL瀹夎甯姪瀹夎鐨勫畨瑁呰矾寰勬垨鍏蜂綋缁勪欢锛屽簲褰撻夋嫨Custom(瀹氬埗瀹夎)瀹夎銆

鎵鏈夊彲鐢ㄧ粍浠跺垪鍏ュ畾鍒跺畨瑁呭璇濇宸︿晶鐨勬爲鐘惰鍥惧唴銆傛湭瀹夎鐨勭粍浠剁敤绾㈣壊 X 鍥炬爣琛ㄧず锛涘凡缁忓畨瑁呯殑缁勪欢鏈夌伆鑹插浘鏍囥傝鎯虫洿鏀圭粍浠讹紝鐐瑰嚮璇ョ粍浠剁殑鍥炬爣骞朵粠涓嬫媺鍒楄〃涓夋嫨鏂扮殑閫夐」銆

鍙互鐐瑰嚮瀹夎璺緞鍙充晶鐨Change...鎸夐挳鏉ユ洿鏀归粯璁ゅ畨瑁呰矾寰勩

閫夋嫨浜嗗畨瑁呯粍浠跺拰瀹夎璺緞鍚庯紝鐐瑰嚮Next鎸夐挳杩涘叆纭瀵硅瘽妗嗐

2.3.4.5. 閰嶇疆瀵硅瘽妗

閫夋嫨浜嗗畨瑁呯被鍨嬪拰鍙夊畨瑁呯粍浠跺悗锛屽垯杩涘叆纭瀵硅瘽妗嗐傝瀵硅瘽妗嗕腑灏嗘樉绀哄畨瑁呯被鍨嬪拰瀹夎璺緞渚涙鏌ャ

濡傛灉浣犳弧鎰忚瀹氬艰鎯冲畨瑁MySQL锛岀偣鍑Install锛堝畨瑁咃級鎸夐挳銆傝鎯虫洿鏀硅瀹氬硷紝鐐瑰嚮Back鎸夐挳銆傝鎯抽鍑MySQL瀹夎甯姪涓嶅啀瀹夎 MySQL锛岀偣鍑Cancel鎸夐挳銆

瀹屾垚瀹夎鍚庯紝灏嗗嚭鐜版敞鍐岄夐」鍜MySQL缃戝潃銆傛敞鍐屽悗渚垮彲浠ヨ闂forums.mysql.com澶勭殑MySQL璁哄潧锛屽彲浠ュ湪bugs.mysql.com鎶ュ憡缂洪櫡锛屽苟鍙互娉ㄥ唽涓烘椂浜嬫柊闂昏鎴枫傚湪瀹夎鍣ㄧ殑鏈鍚庝竴涓獥鍙e唴锛屾彁渚涗簡瀹夎鎽樿锛屽苟鎻愪緵閫夐」浠ュ惎鍔MySQL Configuration Wizard锛堥厤缃悜瀵硷級锛屽彲浠ョ敤鏉ュ垱寤洪厤缃枃浠讹紝瀹夎MySQL鏈嶅姟骞惰繘琛屽畨鍏ㄩ厤缃

2.3.4.6. MySQL瀹夎鍚戝鎵浣滅殑鏇存敼

鐐瑰嚮Install锛堝畨瑁咃級鎸夐挳鍚庯紝MySQL瀹夎甯姪寮濮嬪畨瑁呰繃绋嬶紝骞跺绯荤粺杩涜涓嬮潰绔犺妭鎻忚堪鐨勬洿鏀广

鏇存敼娉ㄥ唽琛

鍦ㄥ吀鍨嬪畨瑁呬腑锛MySQL瀹夎甯姪鍦HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB鍒涘缓Windows娉ㄥ唽閿笺

MySQL瀹夎甯姪鏍规嵁姝e畨瑁呯殑鏈嶅姟鍣ㄧ殑涓昏鐗堟湰鍒涘缓涓涓敭鍊硷紝渚嬪 MySQL鏈嶅姟鍣5.1瀹冨寘鍚袱涓瓧绗︿覆鍊硷紝LocationVersionLocation瀛楃涓插寘鍚畨瑁呯洰褰曘傚湪榛樿瀹夎涓紝瀹冨寘鍚C:\Program Files\MySQL\MySQL Server 5.1\Version瀛楃涓插寘鍚彂甯冨彿銆備緥濡傦紝瀹夎MySQL Server 5.1.2-alpha锛岄敭鍊煎寘鍚竴涓5.1.2-alpha鍊笺

杩欎簺娉ㄥ唽閿肩敤鏉ュ府鍔╁閮ㄥ伐鍏疯瘑鍒MySQL鏈嶅姟鍣ㄧ殑瀹夎浣嶇疆锛屼笉闇瑕佹壂鎻忔暣涓‖鐩樻潵纭畾MySQL鏈嶅姟鍣ㄧ殑瀹夎璺緞銆傝繍琛屾湇鍔″櫒鏃朵笉闇瑕佹敞鍐岄敭鍊硷紝浣跨敤noinstall Zip鏂囦欢鏃朵笉鍒涘缓娉ㄥ唽閿笺

鏇存敼鍚姩鑿滃崟

MySQL瀹夎甯姪鍦Windows 鍚姩鑿滃崟涓垱寤轰竴鏉℃柊鐨勬潯鐩紝浣跨敤MySQL鑿滃崟锛屾牴鎹畨瑁呯殑MySQL鐨勪富鐗堟湰鏉ュ懡鍚嶃備緥濡傦紝濡傛灉瀹夎浜MySQL 5.1, MySQL瀹夎甯姪鍦鍚姩鑿滃崟涓垱寤MySQL Server 5.1閮ㄥ垎銆

灏嗗湪鏂鍚姩鑿滃崟閮ㄥ垎鍒涘缓涓嬮潰鐨勬潯鐩細

         MySQL鍛戒护琛屽鎴风锛氳繖鏄mysql鍛戒护琛屽鎴风鐨勫揩鎹锋柟寮忥紝瀵瑰叾杩涜閰嶇疆浠ヨ繛鎺ヤ负root鐢ㄦ埛銆傚綋杩炴帴鏃跺揩鎹锋柟寮忔彁绀鸿緭鍏root鐢ㄦ埛瀵嗙爜銆

         MySQL鏈嶅姟鍣ㄥ疄渚嬮厤缃悜瀵锛氳繖鏄MySQL Configuration Wizard锛堥厤缃悜瀵硷級鐨勫揩鎹锋柟寮忋備娇鐢ㄨ蹇嵎鏂瑰紡鏉ラ厤缃柊瀹夎鐨勬湇鍔″櫒锛屾垨閲嶆柊閰嶇疆宸叉湁鐨勬湇鍔″櫒銆

         MySQL鏂囨。锛氬彲浠ヨ繛鎺ュ埌淇濆瓨鍦MySQL鏈嶅姟鍣ㄥ畨瑁呯洰褰曚笅鐨勬枃妗c傞噰鐢ㄥ熀鏈畨瑁呮柟寮忓畨瑁MySQL鏈嶅姟鍣ㄦ椂锛岃閫夐」涓嶅彲鐢ㄣ

鏇存敼鏂囦欢绯荤粺

榛樿鎯呭喌涓嬶紝MySQL瀹夎甯姪灏MySQL 5.1鏈嶅姟鍣ㄥ畨瑁呭埌C:\Program Files\MySQL\MySQL Server 5.1锛屽叾涓Program Files鏄郴缁熷簲鐢ㄧ▼搴忕殑榛樿浣嶇疆锛5.1MySQL鏈嶅姟鍣ㄧ殑涓昏鐗堟湰銆傝繖鏄缓璁殑MySQL鏈嶅姟鍣ㄧ殑鏂板畨瑁呬綅缃紝鏇挎崲浜嗗墠闈㈢殑榛樿浣嶇疆c\mysql

榛樿鎯呭喌涓嬶紝鎵鏈MySQL搴旂敤绋嬪簭淇濆瓨鍒扮洰褰C:\Program Files\MySQL涓嬶紝鍏朵腑Program Files鏄簲鐢ㄧ▼搴忓湪Windows涓殑榛樿瀹夎浣嶇疆銆傚紑鍙戞満鍣ㄤ笂鐨勫吀鍨MySQL瀹夎搴斾负锛

C:\Program Files\MySQL\MySQL Server 5.1
C:\Program Files\MySQL\MySQL Administrator 1.0
C:\Program Files\MySQL\MySQL Query Browser 1.0

璇ユ柟娉曚娇绠$悊鍜岀淮鎶ゅ叿浣撶郴缁熶笂瀹夎鐨MySQL搴旂敤绋嬪簭鏇村姞瀹规槗銆

2.3.4.7. 鍗囩骇MySQL

浣跨敤MSI鐨勫崌绾у姛鑳斤紝MySQL瀹夎甯姪鍙互鑷姩鎵ц鏈嶅姟鍣ㄥ崌绾с傝繖鎰忓懗鐫瀹夎鏂扮増鏈墠锛屼笉闇瑕佹墜鍔ㄥ嵏杞藉墠闈㈠畨瑁呯殑绋嬪簭銆傚畨瑁呮柊鐗堟湰鍓嶏紝瀹夎鍣ㄨ嚜鍔ㄥ叧闂苟鍗歌浇鍓嶉潰瀹夎鐨MySQL鏈嶅姟銆

鍙湁鍦ㄤ富鐗堟湰鍙峰拰娆¤鐗堟湰鍙风浉鍚岀殑瀹夎涔嬮棿杩涜鍗囩骇鏃讹紝鎵嶈兘鑷姩杩涜鍗囩骇銆備緥濡傦紝鍙互鑷姩浠MySQL 4.1.5鍗囩骇鍒MySQL 4.1.6,浣嗘槸涓嶈兘浠MySQL 5.0鍗囩骇鍒MySQL 5.1

鍙傝2.3.15鑺傦紝鈥滃湪Windows涓嬪崌绾ySQL鈥

2.3.5. 浣跨敤閰嶇疆鍚戝

2.3.5.1. 鍓嶈█

MySQL Configuration Wizard锛堥厤缃悜瀵硷級鍙互甯姪鑷姩閰嶇疆Windows涓殑鏈嶅姟鍣ㄣMySQL Configuration Wizard锛堥厤缃悜瀵硷級闂綘涓绯诲垪闂锛岀劧鍚庡皢鍥炵瓟鏀惧埌妯℃澘涓敓鎴愪竴涓my.ini鏂囦欢锛岃鏂囦欢涓庝綘鐨勫畨瑁呬竴鑷淬

MySQL Configuration Wizard锛堥厤缃悜瀵硷級鍖呭惈鍦MySQL 5.1鏈嶅姟鍣ㄤ腑锛岀洰鍓嶅彧閫傜敤浜Windows鐢ㄦ埛銆

MySQL Configuration Wizard锛堥厤缃悜瀵硷級鍦ㄥ緢澶х▼搴︿笂鏄MySQL AB缁忚繃澶氬勾浠庤澶氱敤鎴锋敹鍒扮殑鍙嶉鐨勭粨鏋溿傜劧鑰岋紝濡傛灉浣犲彂鐜板畠缂哄皯鏌愪簺瀵逛綘寰堥噸瑕佺殑鍔熻兘锛屾垨濡傛灉浣犲彂鐜颁竴涓己闄凤紝璇蜂娇鐢ㄦ垜浠殑MySQL 缂洪櫡绯荤粺鏉ョ储鍙栧姛鑳芥垨鎶ュ憡闂銆

2.3.5.2. 鍚姩MySQL閰嶇疆鍚戝

涓鑸儏鍐靛綋MySQL瀹夎甯姪閫鍑烘椂锛屼粠MySQL瀹夎甯姪鍚姩MySQL Configuration Wizard锛堥厤缃悜瀵硷級銆傝繕鍙互鐐瑰嚮Windows鍚姩鑿滃崟涓MySQL鏈嶅姟鍣ㄥ疄渚嬮厤缃悜瀵鏉$洰涓殑MySQL閮ㄥ垎鏉ュ惎鍔MySQL Configuration Wizard锛堥厤缃悜瀵硷級銆

骞朵笖锛岃繕鍙互杩涘叆MySQL瀹夎bin鐩綍鐩存帴鍚姩MySQLInstanceConfig.exe鏂囦欢銆

2.3.5.3. 閫夋嫨缁存姢閫夐」

濡傛灉MySQL Configuration Wizard锛堥厤缃悜瀵硷級妫鏌ュ埌my.ini鏂囦欢锛屼綘鍙互閫夋嫨閲嶆柊閰嶇疆宸叉湁鐨勬湇鍔″櫒锛屾垨閫氳繃鍒犻櫎my.ini鏂囦欢骞跺仠姝€佸嵏杞MySQL鏈嶅姟鏉ュ嵏杞芥湇鍔″櫒瀹炰緥銆

瑕佹兂閲嶆柊閰嶇疆宸叉湁鐨勬湇鍔″櫒锛岄夋嫨Re-configure Instance閫夐」骞剁偣鍑Next鎸夐挳銆傚凡鏈夌殑my.ini鏂囦欢閲嶆柊鍛藉悕涓mytimestamp.ini.bak锛屽叾涓timestampmy.ini鏂囦欢鍒涘缓鏄殑鏃ユ湡鍜屾椂闂淬傝鎯冲嵏杞藉凡鏈夌殑鏈嶅姟鍣ㄥ疄渚嬶紝閫夋嫨Remove Instance閫夐」骞剁偣鍑Next鎸夐挳銆

濡傛灉閫夋嫨浜Remove Instance閫夐」锛屽垯杩涘叆纭绐楀彛銆傜偣鍑Execute鎸夐挳锛MySQL Configuration Wizard锛堥厤缃悜瀵硷級鍋滄骞跺嵏杞MySQL鏈嶅姟锛岀劧鍚庡垹闄my.ini鏂囦欢銆傛湇鍔″櫒瀹夎鍜岃嚜宸辩殑data鏂囦欢澶逛笉鍒犻櫎銆

濡傛灉閫夋嫨浜Re-configure Instance閫夐」锛屽垯杩涘叆閰嶇疆绫诲瀷瀵硅瘽妗嗭紝鍙互閫夋嫨浣犳兂瑕侀厤缃殑瀹夎绫诲瀷銆

2.3.5.4. 閫夋嫨閰嶇疆绫诲瀷

褰撳惎鍔MySQL Configuration Wizard锛堥厤缃悜瀵硷級閲嶆柊瀹夎MySQL锛屾垨涓哄凡鏈夊畨瑁呴夋嫨Re-configure Instance閫夐」锛屽垯杩涘叆閰嶇疆绫诲瀷瀵硅瘽妗嗐

鍙互閫夋嫨涓ょ閰嶇疆绫诲瀷锛Detailed Configuration锛堣缁嗛厤缃級Standard Configuration锛堟爣鍑嗛厤缃級Standard Configuration锛堟爣鍑嗛厤缃級閫夐」閫傚悎鎯宠蹇熷惎鍔MySQL鑰屼笉蹇呰冭檻鏈嶅姟鍣ㄩ厤缃殑鏂扮敤鎴枫璇︾粏閰嶇疆閫夐」閫傚悎鎯宠鏇村姞缁嗙矑搴︽帶鍒舵湇鍔″櫒閰嶇疆鐨勯珮绾х敤鎴枫

濡傛灉浣犳槸MySQL鐨勬柊鎵嬶紝闇瑕侀厤缃负鍗曠敤鎴峰紑鍙戞満鐨勬湇鍔″櫒锛Standard Configuration锛堟爣鍑嗛厤缃級搴斿綋閫傚悎浣犵殑闇姹傘傞夋嫨Standard Configuration锛堟爣鍑嗛厤缃級閫夐」锛屽垯 MySQL Configuration Wizard锛堥厤缃悜瀵硷級鑷姩璁剧疆鎵鏈夐厤缃夐」锛屼絾涓嶅寘鎷鏈嶅姟閫夐」鍜屽畨鍏閫夐」

Standard Configuration锛堟爣鍑嗛厤缃級璁剧疆閫夐」鍙兘涓庡畨瑁MySQL鐨勭郴缁熶笉鍏煎銆傚鏋滅郴缁熶笂宸茬粡瀹夎浜MySQL鍜屼綘鎯宠閰嶇疆鐨勫畨瑁咃紝寤鸿閫夋嫨璇︾粏閰嶇疆

瑕佹兂Standard Configuration锛堟爣鍑嗛厤缃級锛岃鍒嗗埆鍙傞槄2.3.5.11鑺傦紝鈥滄湇鍔¢夐」瀵硅瘽妗嗏2.3.5.12鑺傦紝鈥滃畨鍏ㄩ夐」瀵硅瘽妗嗏鐨勬湇鍔¢夐」鍜屽畨鍏閫夐」

2.3.5.5. 鏈嶅姟鍣ㄧ被鍨嬪璇濇

鍙互閫夋嫨3绉嶆湇鍔″櫒绫诲瀷锛岄夋嫨鍝鏈嶅姟鍣ㄥ皢褰卞搷鍒MySQL Configuration Wizard锛堥厤缃悜瀵硷級瀵瑰唴瀛樸佺‖鐩樺拰杩囩▼鎴栦娇鐢ㄧ殑鍐崇瓥銆

         Developer Machine(寮鍙戞満鍣)锛氳閫夐」浠h〃鍏稿瀷涓汉鐢ㄦ闈㈠伐浣滅珯銆傚亣瀹氭満鍣ㄤ笂杩愯鐫澶氫釜妗岄潰搴旂敤绋嬪簭銆傚皢MySQL鏈嶅姟鍣ㄩ厤缃垚浣跨敤鏈灏戠殑绯荤粺璧勬簮銆

         Server Machine锛堟湇鍔″櫒锛锛氳閫夐」浠h〃鏈嶅姟鍣紝MySQL鏈嶅姟鍣ㄥ彲浠ュ悓鍏跺畠搴旂敤绋嬪簭涓璧疯繍琛岋紝渚嬪FTPemailweb鏈嶅姟鍣ㄣMySQL鏈嶅姟鍣ㄩ厤缃垚浣跨敤閫傚綋姣斾緥鐨勭郴缁熻祫婧愩

         Dedicated MySQL Server Machine锛堜笓鐢MySQL鏈嶅姟鍣級锛氳閫夐」浠h〃鍙繍琛MySQL鏈嶅姟鐨勬湇鍔″櫒銆傚亣瀹氳繍琛屾病鏈夎繍琛屽叾瀹冨簲鐢ㄧ▼搴忋MySQL鏈嶅姟鍣ㄩ厤缃垚浣跨敤鎵鏈夊彲鐢ㄧ郴缁熻祫婧愩

2.3.5.6. 鏁版嵁搴撲娇鐢ㄦ儏鍐靛璇濇

閫氳繃Database Usage锛堟暟鎹簱浣跨敤锛瀵硅瘽妗嗭紝浣犲彲浠ユ寚鍑哄垱寤MySQL琛ㄦ椂浣跨敤鐨勮〃澶勭悊鍣ㄣ傞氳繃璇ラ夐」锛屼綘鍙互閫夋嫨鏄惁浣跨敤InnoDB鍌ㄥ瓨寮曟搸锛屼互鍙InnoDB鍗犵敤澶氬ぇ姣斾緥鐨勬湇鍔″櫒璧勬簮銆

         Multifunctional Database锛堝鍔熻兘鏁版嵁搴擄級锛氶夋嫨璇ラ夐」锛屽垯鍚屾椂浣跨敤InnoDBMyISAM鍌ㄥ瓨寮曟搸锛屽苟鍦ㄤ袱涓紩鎿庝箣闂村钩鍧囧垎閰嶈祫婧愩傚缓璁粡甯镐娇鐢ㄤ袱涓偍瀛樺紩鎿庣殑鐢ㄦ埛閫夋嫨璇ラ夐」銆

         Transactional Database Only锛堝彧鏄簨鍔″鐞嗘暟鎹簱锛锛氳閫夐」鍚屾椂浣跨敤InnoDBMyISAM 鍌ㄥ瓨寮曟搸锛屼絾鏄皢澶у鏁版湇鍔″櫒璧勬簮鎸囨淳缁InnoDB鍌ㄥ瓨寮曟搸銆傚缓璁富瑕佷娇鐢InnoDB鍙伓灏斾娇鐢MyISAM鐨勭敤鎴烽夋嫨璇ラ夐」銆

         Non-Transactional Database Only锛堝彧鏄潪浜嬪姟澶勭悊鏁版嵁搴擄級锛氳閫夐」瀹屽叏绂佺敤InnoDB鍌ㄥ瓨寮曟搸锛屽皢鎵鏈夋湇鍔″櫒璧勬簮鎸囨淳缁MyISAM鍌ㄥ瓨寮曟搸銆傚缓璁笉浣跨敤InnoDB鐨勭敤鎴烽夋嫨璇ラ夐」銆

2.3.5.7. InnoDB琛ㄧ┖闂村璇濇

鏈変簺鐢ㄦ埛鍙兘鎯宠灏InnoDB琛ㄧ┖闂存枃浠舵斁鍒颁笉鍚岀殑浣嶇疆锛岃屼笉鏀惧埌MySQL鏈嶅姟鍣ㄦ暟鎹洰褰曘傚鏋滀綘鐨勭郴缁熸湁杈冨ぇ鐨勭┖闂存垨杈冮珮鎬ц兘鐨勫偍瀛樿澶囷紙渚嬪RAID鍌ㄥ瓨绯荤粺锛夛紝鍒欐渶濂藉皢琛ㄧ┖闂存枃浠跺崟鐙斁鍒颁竴涓綅缃

瑕佹兂鏇存敼InnoDB琛ㄧ┖闂存枃浠剁殑榛樿浣嶇疆锛屼粠椹卞姩鍣ㄤ笅鎷夊垪琛ㄩ夋嫨涓涓柊鐨勯┍鍔ㄥ櫒锛屽苟浠庤矾寰勪笅鎷夊垪琛ㄩ夋嫨鏂扮殑璺緞銆傝鎯冲垱寤鸿矾寰勶紝鐐瑰嚮 ...鎸夐挳銆

濡傛灉浣犺鏇存敼宸叉湁鏈嶅姟鍣ㄧ殑閰嶇疆锛屾洿鏀硅矾寰勫墠浣犲繀椤荤偣鍑Modify鎸夐挳銆傛鏃跺惎鍔ㄦ湇鍔″櫒涔嬪墠锛屼綘蹇呴』灏嗗凡鏈夎〃绌洪棿鏂囦欢绉诲埌鏂颁綅缃

2.3.5.8. 骞跺彂杩炴帴瀵硅瘽妗

闄愬埗鎵鍒涘缓鐨勪笌MySQL鏈嶅姟鍣ㄤ箣闂寸殑骞惰杩炴帴鏁伴噺寰堥噸瑕侊紝浠ヤ究闃叉鏈嶅姟鍣ㄨ楀敖璧勬簮銆傚湪Concurrent Connections锛堝苟琛岃繛鎺ワ級瀵硅瘽妗嗕腑锛屽彲浠ラ夋嫨鏈嶅姟鍣ㄧ殑浣跨敤鏂规硶锛屽苟鏍规嵁鎯呭喌闄愬埗骞惰杩炴帴鐨勬暟閲忋傝繕鍙互鎵嬪姩璁剧疆骞惰杩炴帴鐨勯檺鍒躲

         Decision Support锛堝喅绛栨敮鎸侊級(DSS)/OLAP锛氬鏋滄湇鍔″櫒涓嶉渶瑕佸ぇ閲忕殑骞惰杩炴帴鍙互閫夋嫨璇ラ夐」銆傚亣瀹氭渶澶ц繛鎺ユ暟鐩缃负100,骞冲潎骞惰杩炴帴鏁颁负20

         Online Transaction Processing锛堣仈鏈轰簨鍔″鐞嗭級(OLTP)锛氬鏋滀綘鐨勬湇鍔″櫒闇瑕佸ぇ閲忕殑骞惰杩炴帴鍒欓夋嫨璇ラ夐」銆傛渶澶ц繛鎺ユ暟璁剧疆涓500

         Manual Setting锛堜汉宸ヨ缃級锛氶夋嫨璇ラ夐」鍙互鎵嬪姩璁剧疆鏈嶅姟鍣ㄥ苟琛岃繛鎺ョ殑鏈澶ф暟鐩備粠鍓嶉潰鐨勪笅鎷夋涓夋嫨骞惰杩炴帴鐨勬暟鐩紝濡傛灉浣犳湡鏈涚殑鏁扮洰涓嶅湪鍒楄〃涓紝鍒欏湪涓嬫媺妗嗕腑杈撳叆鏈澶ц繛鎺ユ暟銆

2.3.5.9. 鑱旂綉閫夐」瀵硅瘽妗

Networking Options缃戠粶閫夐」锛瀵硅瘽妗嗕腑鍙互鍚敤鎴栫鐢TCP/IP缃戠粶锛屽苟閰嶇疆鐢ㄦ潵杩炴帴MySQL鏈嶅姟鍣ㄧ殑绔彛鍙枫

榛樿鎯呭喌鍚敤TCP/IP缃戠粶銆傝鎯崇鐢TCP/IP缃戠粶锛屽彇娑堥夋嫨Enable TCP/IP Networking閫夐」鏃佽竟鐨勬鏌ユ銆

榛樿浣跨敤3306绔彛銆傝鎯虫洿璁块棶MySQL浣跨敤鐨勭鍙o紝浠庝笅鎷夋閫夋嫨涓涓柊绔彛鍙锋垨鐩存帴鍚戜笅鎷夋杈撳叆鏂扮殑绔彛鍙枫傚鏋滀綘閫夋嫨鐨勭鍙e彿宸茬粡琚崰鐢紝灏嗘彁绀虹‘璁ら夋嫨鐨勭鍙e彿銆

2.3.5.10. 瀛楃闆嗗璇濇

MySQL鏈嶅姟鍣ㄦ敮鎸佸绉嶅瓧绗﹂泦锛屽彲浠ヨ缃傜敤浜庢墍鏈夎〃銆佸垪鍜屾暟鎹簱鐨勯粯璁ゆ湇鍔″櫒瀛楃闆嗐備娇鐢Character Set瀛楃闆嗗璇濇锛夋潵鏇存敼 MySQL鏈嶅姟鍣ㄧ殑榛樿瀛楃闆嗐

         Standard Character Set锛堟爣鍑嗗瓧绗﹂泦锛锛氬鏋滄兂瑕佷娇鐢Latin1鍋氫负榛樿鏈嶅姟鍣ㄥ瓧绗﹂泦锛屽垯閫夋嫨璇ラ夐」銆Latin1鐢ㄤ簬鑻辫鍜岃澶氳タ娆ц瑷銆

         Best Support For Multilingualism锛堟敮鎸佸绉嶈瑷锛锛氬鏋滄兂瑕佷娇鐢UTF8鍋氫负榛樿鏈嶅姟鍣ㄥ瓧绗﹂泦锛屽垯閫夋嫨璇ラ夐」銆UTF8鍙互 灏嗕笉鍚岃瑷鐨勫瓧绗﹀偍瀛樹负鍗曚竴鐨勫瓧绗﹂泦銆

         Manual Selected Default Character Set/Collation浜哄伐閫夋嫨鐨勯粯璁ゅ瓧绗﹂泦/鏍″瑙勫垯锛锛氬鏋滄兂瑕佹墜鍔ㄩ夋嫨鏈嶅姟鍣ㄧ殑榛樿瀛楃闆嗭紝璇烽夋嫨璇ラ」銆備粠涓嬫媺鍒楄〃涓夋嫨鏈熸湜鐨勫瓧绗﹂泦銆

2.3.5.11. 鏈嶅姟閫夐」瀵硅瘽妗

鍦ㄥ熀浜Windows NT鐨勫钩鍙颁笂锛屽彲浠ュ皢MySQL鏈嶅姟鍣ㄥ畨瑁呮垚鏈嶅姟銆傚畨瑁呮垚鏈嶅姟锛岀郴缁熷惎鍔ㄦ椂鍙互鑷姩鍚姩MySQL鏈嶅姟鍣紝鐢氳嚦鍑虹幇鏈嶅姟鏁呴殰鏃跺彲浠ラ殢Windows鑷姩鍚姩銆

榛樿鎯呭喌锛MySQL Configuration Wizard锛堥厤缃悜瀵硷級灏MySQL鏈嶅姟鍣ㄥ畨瑁呬负鏈嶅姟锛屾湇鍔″悕涓MySQL銆傚鏋滀綘涓嶆兂瀹夎鏈嶅姟锛屽彇娑Install As Windows Service閫夐」鏃佽竟鐨勯夋嫨妗嗐傚彲浠ヤ粠涓嬫媺妗嗛夋嫨鏂扮殑鏈嶅姟鍚嶆垨鍦ㄤ笅鎷夋杈撳叆鏂扮殑鏈嶅姟鍚嶆潵鏇存敼鏈嶅姟鍚嶃

瑕佹兂灏MySQL鏈嶅姟鍣ㄥ畨瑁呬负鏈嶅姟锛屼絾鏄笉鑷姩鍚姩锛屼笉閫変腑Launch the MySQL Server Automatically閫夐」鏃佽竟鐨勬鏌ユ銆

2.3.5.12. 瀹夊叏閫夐」瀵硅瘽妗

寮虹儓寤鸿涓轰綘鐨MySQL鏈嶅姟鍣ㄨ缃竴涓root瀵嗙爜锛岄粯璁ゆ儏鍐MySQL Configuration Wizard锛堥厤缃悜瀵硷級瑕佹眰浣犺缃竴涓root瀵嗙爜銆傚鏋滀綘涓嶆兂璁剧疆root瀵嗙爜锛屼笉閫変腑Modify Security Settings锛堜慨鏀瑰畨鍏ㄨ瀹氬硷級閫夐」鏃佽竟鐨勯夋嫨妗嗐

瑕佹兂璁剧疆root瀵嗙爜锛屽湪New root password(杈撳叆鏂板瘑鐮)Confirm锛堢‘璁わ級涓や釜妗嗗唴杈撳叆鏈熸湜鐨勫瘑鐮併傚鏋滈噸鏂伴厤缃凡鏈夌殑鏈嶅姟鍣紝浣犺繕闇瑕Current root password锛堝綋鍓root瀵嗙爜锛妗嗗唴杈撳叆宸叉湁鐨root瀵嗙爜銆

瑕佹兂闃叉閫氳繃缃戠粶浠root鐧诲綍锛岄変腑Root may only connect from localhost锛堝彧鍏佽浠庢湰鏈虹櫥闄嗚繛鎺root閫夐」鏃佽竟鐨勬銆傝繖鏍峰彲浠ユ彁楂root璐︽埛鐨勫畨鍏ㄣ

瑕佹兂鍒涘缓涓涓尶鍚嶇敤鎴疯处鎴凤紝閫変腑Create An Anonymous Account锛堝垱寤哄尶鍚嶈处鎴凤級閫夐」鏃佽竟鐨勬銆傚垱寤哄尶鍚嶈处鎴蜂細闄嶄綆鏈嶅姟鍣ㄧ殑瀹夊叏锛屽苟閫犳垚鐧诲綍鍜岃鍙洶闅俱傚洜姝や笉寤鸿銆

2.3.5.13. 閰嶇疆瀵硅瘽妗

MySQL Configuration Wizard锛堥厤缃悜瀵硷級鐨勬渶鍚庝竴涓璇濇鏄Confirmation锛堢‘璁わ級瀵硅瘽妗銆傝鎯冲惎鍔ㄩ厤缃繃绋嬶紝鐐瑰嚮Execute銆傝鎯宠繑鍥炶鎯冲埌鍓嶉潰鐨勫璇濇锛岀偣鍑Back鎸夐挳銆傝鎯充笉閰嶇疆鏈嶅姟鍣ㄥ嵆閫鍑MySQL Configuration Wizard锛堥厤缃悜瀵硷級锛岀偣鍑Cancel鎸夐挳銆

鐐瑰嚮Execute鎸夐挳鍚庯紝MySQL Configuration Wizard锛堥厤缃悜瀵硷級鎵ц涓绯诲垪鐨勪换鍔★紝鎵ц杩囩▼灏嗘樉绀哄湪灞忓箷涓娿

MySQL Configuration Wizard锛堥厤缃悜瀵硷級棣栧厛浣跨敤MySQL AB寮鍙戜汉鍛樺拰宸ョ▼甯堝噯澶囩殑妯℃澘鏍规嵁浣犵殑閫夋嫨纭畾閰嶇疆鏂囦欢閫夐」銆傝妯℃澘鐨勫悕绉颁负my-template.ini锛屼綅浜庢湇鍔″櫒瀹夎鐩綍涓

MySQL Configuration Wizard锛堥厤缃悜瀵硷級灏嗚繖浜涢夐」鍐欏叆鍒颁竴涓my.ini鏂囦欢涓my.ini鏂囦欢鐨勬渶缁堜綅缃樉绀哄湪鍐閰嶇疆鏂囦欢浠诲姟鐨勬梺杈广

濡傛灉閫夋嫨涓MySQL鏈嶅姟鍣ㄥ垱寤轰竴涓湇鍔★紝MySQL Configuration Wizard锛堥厤缃悜瀵硷級鍒欏垱寤哄苟鍚姩鏈嶅姟銆傚鏋滀綘閲嶆柊閰嶇疆宸叉湁鐨勬湇鍔★紝MySQL Configuration Wizard锛堥厤缃悜瀵硷級鍒欐牴鎹綘鐨勯厤缃洿鏀归噸鏂板惎鍔ㄦ湇鍔°

濡傛灉閫夋嫨璁剧疆root瀵嗙爜锛MySQL Configuration Wizard锛堥厤缃悜瀵硷級鍒欒繛鎺ユ湇鍔″櫒锛岃缃柊root瀵嗙爜骞跺簲鐢ㄤ綘閫夋嫨鐨勫叾瀹冨畨鍏ㄨ瀹氬笺

MySQL Configuration Wizard锛堥厤缃悜瀵硷級瀹屾垚浠诲姟鍚庯紝鍒欐樉绀轰竴涓瑕併傜偣鍑Finish鎸夐挳閫鍑MySQL Configuration Wizard锛堥厤缃悜瀵硷級銆

2.3.5.14. my.ini鏂囦欢鐨勪綅缃

MySQL Configuration Wizard锛堥厤缃悜瀵硷級灏my.ini鏂囦欢鏀惧埌MySQL鏈嶅姟鍣ㄧ殑瀹夎鐩綍涓傝繖鏍峰彲浠ュ府鍔╁皢閰嶇疆鏂囦欢涓庡叿浣撴湇鍔″櫒瀹炰緥鍏宠仈璧锋潵銆

瑕佹兂纭繚MySQL鏈嶅姟鍣ㄧ煡閬撲粠鍝噷鏌ユ壘my.ini鏂囦欢锛屽嵆鍋氫负鏈嶅姟瀹夎鐨勪竴閮ㄥ垎浼犻掔粰MySQL鏈嶅姟鍣ㄧ殑閮ㄥ垎锛--defaults-file="C:\Program Files\MySQL\MySQL Server 5.1\my.ini"锛屽叾涓C:\Program Files\MySQL\MySQL Server 5.1 MySQL鏈嶅姟鍣ㄧ殑瀹夎璺緞鏇夸唬銆

--defaults-file鎸囧MySQL鏈嶅姟鍣ㄨ鍙栧叿浣撶殑閰嶇疆鏂囦欢銆

2.3.5.15. 缂栬緫my.ini鏂囦欢

瑕佹兂淇敼my.ini鏂囦欢锛岀敤鏂囨湰缂栬緫鍣ㄦ墦寮骞惰繘琛屽繀瑕佺殑淇敼銆備綘杩樺彲浠ョ敤MySQL Administrator瀹炵敤宸ュ叿淇敼鏈嶅姟鍣ㄩ厤缃

MySQL瀹㈡埛绔拰瀹炵敤绋嬪簭锛屼緥濡mysql鍛戒护琛屽鎴风鍜mysqldump涓嶈兘灏my.ini鏂囦欢鏀惧埌鏈嶅姟鍣ㄥ畨瑁呯洰褰曚腑銆傝鎯抽厤缃鎴风鍜屽疄鐢ㄥ伐鍏凤紝鏍规嵁Windows 鐗堟湰锛屽湪C\WindowsC\WINNT鐩綍涓嬪垱寤轰竴涓柊鐨my.ini鏂囦欢銆

2.3.6.聽閫氳繃闈炲畨瑁匷ip鏂囦欢瀹夎MySQL

鎯充娇鐢ㄩ潪鑷姩瀹夎鍖呯殑鐢ㄦ埛鍙互浣跨敤鏈妭鐨勬寚浠ゆ墜鍔ㄥ畨瑁MySQL銆備粠Zip鏂囨。瀹夎MySQL鐨勮繃绋嬩负锛

1.    灏嗘枃妗f彁鍙栧埌鏈熸湜鐨勫畨瑁呯洰褰曚腑銆

2.    鍒涘缓涓涓夐」鏂囦欢銆

3.    閫夋嫨MySQL鏈嶅姟鍣ㄧ被鍨嬨

4.    鍚姩MySQL鏈嶅姟鍣ㄣ

5.    浣块粯璁ょ敤鎴疯处鎴峰畨鍏ㄣ

涓嬮潰涓鑺傛弿杩颁簡璇ヨ繃绋嬨

2.3.7. 鎻愬彇瀹夎妗f鏂囦欢

瑕佹兂鎵嬪姩瀹夎MySQL锛屽叾姝ラ涓猴細

1.    濡傛灉浣犱粠浠ュ墠鐨勭増鏈崌绾э紝寮濮嬪崌绾ц繃绋嬪墠璇峰弬闃2.3.15鑺傦紝鈥滃湪Windows涓嬪崌绾ySQL鈥

2.    濡傛灉浣犱娇鐢ㄥ熀浜Windows NT鐨勬搷浣滅郴缁燂紝渚嬪Windows NTWindows 2000Windows XPWindows Server 2003,纭繚鐧诲綍鐨勭敤鎴峰悕鍏锋湁绠$悊鍛樻潈闄愩

3.    閫夋嫨瀹夎浣嶇疆銆備紶缁熷畨瑁呬腑MySQL鏈嶅姟鍣ㄥ畨瑁呭埌C\mysqlMySQL Installation Wizard锛堝畨瑁呭府鍔╋級灏MySQL瀹夎鍒C:\Program Files\MySQL銆傚鏋滀綘涓嶆兂灏MySQL瀹夎鍒C\mysql锛屼綘蹇呴』鍦ㄥ惎鍔ㄨ繃绋嬫垨鍦ㄩ夐」鏂囦欢涓寚瀹氬畨瑁呯洰褰曠殑璺緞銆傝鍙傝2.3.8鑺傦紝鈥滃垱寤洪夐」鏂囦欢鈥

4.    浣跨敤zip鏂囦欢宸ュ叿锛屽皢瀹夎鏂囦欢鎻愬彇鍒伴夊畾鐨勫畨瑁呬綅缃備娇鐢ㄦ煇浜涘伐鍏凤紝鍙互灏嗘枃妗f彁鍙栧埌閫夋嫨鐨勫畨瑁呬綅缃殑鏂囦欢澶逛腑銆傚湪杩欑鎯呭喌涓嬶紝浣犲彲浠ュ皢瀛愭枃浠跺す涓殑鍐呭绉诲姩鍒伴夋嫨鐨勫畨瑁呬綅缃

2.3.8. 鍒涘缓閫夐」鏂囦欢

濡傛灉鎯宠鎸囧畾杩愯鏈嶅姟鍣ㄧ殑鍚姩閫夐」锛屽彲浠ュ湪鍛戒护琛屼腑鎸囧嚭鎴栨斁鍒颁竴涓夐」鏂囦欢涓傚浜庢湇鍔″櫒姣忔鍚姩閮界敤鍒扮殑閫夐」锛屼綘浼氬彂鐜颁娇鐢ㄩ夐」鏂囦欢鏉ユ寚瀹MySQL閰嶇疆闈炲父鏂逛究銆傜壒鍒槸鍦ㄤ互涓嬬幆澧冧腑锛

         瀹夎鎴栨暟鎹洰褰曚綅缃笉鏄粯璁や綅缃(C:\Program Files\MySQL\MySQL Server 5.1C:\Program Files\MySQL\MySQL Server 5.1\data)

         闇瑕佽皟鑺傛湇鍔″櫒璁惧畾鍊笺

MySQL鏈嶅姟鍣ㄥ湪Windows涓惎鍔ㄦ椂锛屽畠浠庝袱涓枃浠朵腑瀵绘壘閫夐」锛Windows鐩綍涓殑my.ini鏂囦欢鍜C\my.cnf 鏂囦欢銆Windows鐩綍鍏稿瀷鍚嶇О涓C\WINDOWSC\WINNT銆傚彲浠ヤ娇鐢ㄤ笅闈㈢殑鍛戒护浠WINDIR鐜鍙橀噺鍊肩‘瀹氳嚜宸辩殑纭垏浣嶇疆锛

C\> echo %WINDIR%

MySQL棣栧厛浠my.ini鏂囦欢涓鎵鹃夐」锛岀劧鍚庝粠my.cnf鏂囦欢涓鎵俱備负浜嗛伩鍏嶆贩娣嗭紝鏈濂藉彧浣跨敤涓涓枃浠躲傚鏋滀綘鐨PC浣跨敤浜嗕竴涓紩瀵煎姞杞藉櫒锛屽叾涓C涓嶆槸寮曞鐩橈紝鍞竴鐨勯夊垯鏄娇鐢my.ini鏂囦欢銆備笉绠′綘浣跨敤鍝釜閫夐」鏂囦欢锛屽繀椤讳负绾枃鏈枃浠躲

杩樺彲浠ヤ娇鐢MySQL鍒嗗彂涓殑绀轰緥閫夐」鏂囦欢銆傚湪瀹夎鐩綍涓煡鎵句互涓嬫枃浠讹細my-small.cnfmy-medium.cnfmy-large.cnfmy-huge.cnf锛屼綘鍙互閲嶆柊鍛藉悕骞跺鍒跺埌鐩稿簲浣嶇疆鐢ㄤ綔鍩烘湰閰嶇疆鏂囦欢銆

鍙互鐢ㄤ换浣曟枃鏈紪杈戝櫒鏉ュ垱寤哄苟淇敼閫夐」鏂囦欢锛屼緥濡傝浜嬫湰銆備緥濡傦紝濡傛灉MySQL瀹夎鍦E\mysql鏁版嵁鐩綍瀹夎鍦E:\mydata\data锛屼綘鍙互 鍒涘缓鍚湁[mysqld]閮ㄥ垎鐨勯夐」鏂囦欢锛屾寚瀹basedirdatadir鍙傛暟鐨勫硷細

[mysqld]
# set basedir to your installation path
basedir=E:/mysql
# set datadir to the location of your data directory
datadir=E:/mydata/data

璇锋敞鎰忓湪閫夐」鏂囦欢涓娇鐢ㄦ鏂滅嚎鍎夸笉鏄弽鏂滅嚎鎸囧畾Windows璺緞鍚嶃傚鏋滀娇鐢ㄥ弽鏂滅嚎锛屽繀椤荤敤鍙屽弽鏂滅嚎锛

[mysqld]
# set basedir to your installation path
basedir=E:\\mysql
# set datadir to the location of your data directory
datadir=E:\\mydata\\data

Windows涓嬶紝MySQL瀹夎鍣ㄥ皢鏁版嵁鐩綍鐩存帴鏀惧埌瀹夎MySQL鐨勭洰褰曚笅銆傚鏋滀綘鎯宠浣跨敤鍏跺畠浣嶇疆鐨勬暟鎹洰褰曪紝搴斿綋灏data鐩綍涓殑鍏ㄩ儴鍐呭澶嶅埗鍒版柊鐨勭洰褰曚笅銆備緥濡傦紝濡傛灉MySQL瀹夎鍒C:\Program Files\MySQL\MySQL Server 5.1涓紝鏁版嵁鐩綍榛樿鍦C:\Program Files\MySQL\MySQL Server 5.1\data銆傚鏋滄兂瑕佷娇鐢E:\mydata鍋氫负鏁版嵁鐩綍锛屼綘蹇呴』鍋氫袱浠朵簨鎯咃細

1.    灏嗘暣涓data鐩綍鍜屽叏閮ㄥ唴瀹逛粠C:\Program Files\MySQL\MySQL Server 5.1\data绉诲姩鍒E:\mydata

2.    姣忔鍚姩鏈嶅姟鍣ㄦ椂锛屼娇鐢--datadir閫夐」鏉ユ寚瀹氭柊鐨勬暟鎹洰褰曘

2.3.9. 閫夋嫨MySQL鏈嶅姟鍣ㄧ被鍨

涓嬮潰鐨勮〃鏄剧ず浜Windows涓嬪彲鐢ㄧ殑MySQL 5.1鏈嶅姟鍣細

浜岃繘鍒

鎻忚堪

mysqld- debug

宸茬粡缂栬瘧杩囷紝鍙互杩涜瀹屽叏璋冭瘯鍜岃嚜鍔ㄥ唴瀛樺垎閰嶆鏌ワ紝鐢ㄤ簬琛InnoDBBDB

mysqld

浼樺寲鐨勪簩杩涘埗锛屾敮鎸InnoDB

mysqld-nt

浼樺寲鐨勪簩杩涘埗锛屾敮鎸Windows NT2000 XP锛屾湁鍛藉悕绠¢亾銆

mysqld-max

浼樺寲鐨勪簩杩涘埗锛屾敮鎸InnoDBBDB琛ㄣ

mysqld-max-nt

mysqld-max锛屼絾鏄凡缁忕紪璇戣繃锛屾敮鎸佸懡鍚嶇閬撱

宸茬粡瀵规墍鏈夊墠闈㈢殑浜岃繘鍒惰繘琛屼簡浼樺寲浠ラ傜敤鐜颁唬Intel澶勭悊鍣紝浣嗘槸搴斿綋宸ヤ綔鍦Intel i386-绫绘垨鏇撮珮鐨勫鐞嗗櫒涓娿

鎵鏈Windows MySQL 5.1鏈嶅姟鍣ㄦ敮鎸佹暟鎹簱鐩綍绗﹀彿閾炬帴銆

MySQL鏀寔鎵鏈Windows骞冲彴鐨TCP/IPmysqld-ntmysql-max-nt鏈嶅姟鍣ㄦ敮鎸Windows NT2000XP2003鐨勫懡鍚嶇閬撱傜劧鑰岋紝鍦ㄦ墍鏈夊钩鍙颁笅榛樿浣跨敤TCP/IP(鍦ㄨ澶Windows閰嶇疆涓紝鍛藉悕绠¢亾姣TCP/IP鎱級

鍛藉悕绠¢亾鍦ㄤ互涓嬫潯浠朵笅浣跨敤锛

         濡傛灉浣跨敤--enable-named-pipe閫夐」鍚姩鏈嶅姟鍣紝鍒欏惎鐢ㄤ簡鍛藉悕绠¢亾銆傞渶瑕佹槑纭娇鐢ㄨ閫夐」锛屽洜涓哄綋浣跨敤鍛藉悕绠¢亾鍏抽棴MySQL鏈嶅姟鍣ㄦ椂锛屾煇浜涚敤鎴蜂細閬囧埌闂銆

         鍙湁mysqld-ntmysqld-max-nt鏈嶅姟鍣紝骞朵笖鏈嶅姟鍣ㄨ繍琛屽湪鏀寔鍛藉悕绠¢亾鐨Windows鐗堟湰(NT2000XP2003)锛屾墠鑳藉浣跨敤鍛藉悕绠¢亾杩炴帴銆

         杩欎簺鏈嶅姟鍣ㄥ彲浠ヨ繍琛屽湪Windows 98 Me涓紝浣嗘槸蹇呴』瀹夎TCP/IP鍗忚锛涙鏃朵笉鍙互浣跨敤鍛藉悕绠¢亾杩炴帴銆

         杩欎簺鏈嶅姟鍣ㄤ笉鑳藉湪Windows 95涓繍琛屻

娉ㄩ噴锛鍙傝冩墜鍐屼腑鐨勫ぇ澶氭暟渚嬪瓙浣跨敤mysqld鍋氫负鏈嶅姟鍣ㄥ悕銆傚鏋滀綘閫夋嫨浣跨敤涓嶅悓鐨勬湇鍔″櫒锛屼緥濡mysqld-nt锛屽垯鍦ㄧ浉搴斾緥瀛愪腑鐨勫懡浠や腑杩涜鐩稿簲鐨勬浛鎹€

2.3.10. 棣栨鍚姩鏈嶅姟鍣

鏈妭涓殑淇℃伅涓昏閫傜敤閫夋嫨NoinstallMySQL瀹夎鐗堟湰锛屾垨鎯宠鎵嬪姩閰嶇疆鍜屾祴璇MySQL鑰屼笉鐢GUI宸ュ叿鐨勬儏鍐点

Windows 95,98,Me涓紝MySQL瀹㈡埛绔讳娇鐢TCP/IP杩炴帴鏈嶅姟鍣ㄣ(杩欐牱鍏佽缃戠粶涓殑鎵鏈夋満鍣ㄨ繛鎺MySQL鏈嶅姟鍣級鍥犳锛屽湪鍚姩MySQL涔嬪墠锛屼綘蹇呴』纭繚鏈哄櫒鏀寔TCP/IP銆傚彲浠ヤ粠Windows CD-ROM涓壘鍒TCP/IP

璇锋敞鎰忓鏋滀娇鐢ㄦ棫鐗堟湰鐨Windows 95(渚嬪锛OSR2)锛屽緢鍙兘浣犱娇鐢ㄤ簡鏃х殑Winsock鍖咃紱MySQL闇瑕Winsock 2銆傚彲浠ヤ粠http://www.microsoft.com/鑾峰緱鏈鏂扮殑WinsockWindows 98鍖呭惈鏂扮殑Winsock 2搴擄紝鍥犳涓嶉渶瑕佹洿鏂板簱銆

鍦ㄥ熀浜NT鐨勭郴缁熶腑锛屼緥濡 Windows NT2000XP2003,瀹㈡埛绔彲浠ユ湁涓や釜閫夋嫨銆傚彲浠ヤ娇鐢TCP/IP锛屽鏋滄湇鍔″櫒鏀寔鍛藉悕绠¢亾杩炴帴锛屼篃鍙互浣跨敤鍛藉悕绠¢亾銆傝鎯充娇MySQL浣跨敤Windows NT 4涓殑TCP/IP,浣犲繀椤诲畨瑁呮湇鍔pack 3(鎴栨洿鏂扮殑琛ヤ竵)

濡傛灉鐢--shared-memory閫夐」鍚姩锛WindowsMySQL杩樻敮鎸佸叡浜唴瀛樿繛鎺ャ傚鎴风鍙互閫氳繃--protocol=memory閫夐」閫氳繃鍏变韩鍐呭瓨杩涜杩炴帴銆

鍏充簬杩愯鍝釜鏈嶅姟鍣ㄤ簩杩涘埗鐨勪俊鎭紝鍙傝2.3.9鑺傦紝鈥滈夋嫨MySQL鏈嶅姟鍣ㄧ被鍨嬧

鏈妭瀵MySQL鏈嶅姟鍣ㄥ惎鍔ㄨ繘琛屼簡姒傝堪銆備笅闈㈢珷鑺傝缁嗚鏄庝簡浠庡懡浠よ鎴Windows 鏈嶅姟鍚姩MySQL鏈嶅姟鍣ㄧ殑鍏蜂綋淇℃伅銆

杩欎簺绔犺妭鐨勪緥瀛愬亣瀹MySQL瀹夎鍒伴粯璁や綅缃C:\Program Files\MySQL\MySQL Server 5.1濡傛灉浣犲皢MySQL瀹夎鍒颁簡鍏跺畠浣嶇疆锛屽垯瑕佹洿鏀逛緥瀛愪腑鐨勮矾寰勫悕銆

鍦ㄦ帶鍒跺彴绐楀彛(鎴栤DOS window)涓紝鏈濂芥牴鎹懡浠ゆ彁绀鸿繘琛屾祴璇曘傝繖鏍峰彲浠ヨ鏈嶅姟鍣ㄥ湪window涓鏄撶湅瑙佺殑鍦版柟鏄剧ず鐘舵佹秷鎭傚鏋滈厤缃嚭鐜伴敊璇紝閫氳繃杩欎簺娑堟伅锛屽彲浠ユ洿瀹规槗鍦拌瘑鍒苟淇闂銆

瑕佹兂鍚姩鏈嶅姟鍣紝杈撳叆鍛戒护锛

C\> C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld --console

鏀寔InnoDB鐨勬湇鍔″櫒鍚姩鏃讹紝浣犲簲褰撹兘鐪嬭涓嬮潰鐨勬秷鎭細

InnoDB: The first specified datafile c:\ibdata\ibdata1 did not exist:
InnoDB: a new database to be created
InnoDB: Setting file c:\ibdata\ibdata1 size to 209715200
InnoDB: Database physically writes the file full: wait...
InnoDB: Log file c:\iblogs\ib_logfile0 did not exist: new to be created
InnoDB: Setting log file c:\iblogs\ib_logfile0 size to 31457280
InnoDB: Log file c:\iblogs\ib_logfile1 did not exist: new to be created
InnoDB: Setting log file c:\iblogs\ib_logfile1 size to 31457280
InnoDB: Log file c:\iblogs\ib_logfile2 did not exist: new to be created
InnoDB: Setting log file c:\iblogs\ib_logfile2 size to 31457280
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: creating foreign key constraint system tables
InnoDB: foreign key constraint system tables created
011024 10:58:25  InnoDB: Started

鏈嶅姟鍣ㄥ畬鎴愬惎鍔ㄥ簭鍒楀悗锛屼綘搴斿綋鑳界湅瑙佷笅杩板唴瀹癸紝琛ㄧず鏈嶅姟鍣ㄥ噯澶囧ソ锛屽彲浠ヨ繘琛屽鎴风杩炴帴锛

mysqld: ready for connections
Version: '5.1.2-alpha'  socket: ''  port: 3306

鏈嶅姟鍣ㄧ户缁悜鎺у埗鍙板啓鍏ヨ瘖鏂緭鍑恒備綘鍙互鎵撳紑鏂扮殑鎺у埗鍙扮獥鍙h繍琛屽鎴风绋嬪簭銆

濡傛灉鐪佺暐--console閫夐」锛屾湇鍔″櫒鍚戞暟鎹洰褰(榛樿涓C:\Program Files\MySQL\MySQL Server 5.1\data)涓殑閿欒鏃ュ織鍐欏叆璇婃柇杈撳嚭銆傞敊璇棩蹇楁枃浠剁殑鎵╁睍鍚嶄负.err

娉ㄩ噴锛MySQL鎺堟潈琛ㄤ腑鐨勮处鎴蜂竴寮濮嬫病鏈夊瘑鐮併傛湇鍔″櫒鍚姩鍚庯紝浣犲簲褰撴牴鎹2.9鑺傦紝鈥滃畨瑁呭悗鐨勮缃拰娴嬭瘯鈥涓殑璇存槑璁剧疆瀵嗙爜銆

2.3.11. 浠嶹indows鍛戒护琛屽惎鍔∕ySQL

鍙互浠庡懡浠よ鎵嬪姩鍚姩MySQL鏈嶅姟鍣ㄣ傚彲浠ュ湪浠讳綍鐗堟湰鐨Windows涓疄鐜般

瑕佹兂浠庡懡浠よ鍚姩mysqld鏈嶅姟鍣紝浣犲簲褰撳惎鍔ㄦ帶鍒跺彴绐楀彛(鎴栤DOS window)骞惰緭鍏ュ懡浠わ細

C\> C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld

鏍规嵁绯荤粺涓MySQL瀹夎浣嶇疆鐨勪笉鍚岋紝鍓嶉潰鐨勪緥瀛愪腑浣跨敤鐨勮矾寰勪篃涓嶅悓銆

鍦ㄩ潪NT鐗堟湰鐨Windows涓紝鍦ㄥ悗鍙板惎鍔mysqld銆備篃灏辨槸锛屾湇鍔″櫒鍚姩鍚庯紝浣犲簲褰撳彲浠ョ湅瑙佸悗闈㈢殑鍛戒护鎻愮ず銆傚鏋滀綘鐢ㄨ鏂规硶鍦Windows NT2000XP2003涓惎鍔ㄦ湇鍔″櫒锛屾湇鍔″櫒鍒欏湪鍓嶅彴杩愯锛屽湪鏈嶅姟鍣ㄩ鍑哄墠锛屼笉浼氬嚭鐜板懡浠ゆ彁绀恒傚洜姝わ紝褰撴湇鍔″櫒杩愯鏃讹紝搴斿綋鎵撳紑鍙︿竴涓帶鍒跺彴绐楀彛鏉ヨ繍琛屽鎴风绋嬪簭銆

涓嬭堪鍛戒护鍙互鍋滄MySQL鏈嶅姟鍣細

C\> C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqladmin -u root shutdown

璇ュ懡浠よ皟鐢MySQL绠$悊宸ュ叿mysqladmin杩炴帴鏈嶅姟鍣ㄥ苟鍛婄煡瀹冨叧闂湇鍔°傝鍛戒护浣跨敤MySQL root鐢ㄦ埛杩炴帴锛岃繖鏄MySQL鏉冮檺绯荤粺涓殑榛樿绠$悊璐︽埛銆傝娉ㄦ剰MySQL鏉冮檺绯荤粺涓殑鐢ㄦ埛瀹屽叏鐙珛浜Windows涓嬬殑鐧诲綍鐢ㄦ埛銆

濡傛灉mysqld涓嶈兘鍚姩锛屾鏌ラ敊璇棩蹇楃湅鐪嬫湇鍔″櫒鏄惁鍐欏叆浜嗘樉绀洪棶棰樺師鍥犵殑浠讳綍娑堟伅銆傞敊璇棩蹇椾綅浜C:\Program Files\MySQL\MySQL Server 5.1\data鐩綍涓傛槸甯﹀悗缂.err鐨勬枃浠躲傝繕鍙互灏濊瘯灏嗘湇鍔″櫒鍚姩涓mysqld --console锛涙鏃讹紝鍙互浠庣獥鍙d腑鑾峰緱涓浜涙湁鐢ㄧ殑淇℃伅锛屽彲浠ュ府鍔╄В鍐抽棶棰樸

鏈鍚庨夐」鏄敤--standalone --debug鍚姩mysqld銆傛鏃讹紝mysqld 鍐欏叆鏃ュ織鏂囦欢C\mysqld.trace搴斿綋鍖呭惈mysqld涓嶅惎鍔ㄧ殑鍘熷洜銆傝鍙傝E.1.2鑺傦紝鈥滃垱寤鸿窡韪枃浠垛

浣跨敤mysqld --verbose --help鏄剧ずmysqld鐨勬墍鏈夐夐」銆

2.3.12. 浠indows鏈嶅姟鏂瑰紡鍚姩MySQL

NT瀹舵棌 (Windows NT2000,XP2003)涓紝寤鸿灏MySQL瀹夎涓Windows鏈嶅姟锛屽綋Windows鍚姩銆佸仠姝㈡椂锛MySQL涔熻嚜鍔ㄥ惎鍔ㄣ佸仠姝€傝繕鍙互浠庡懡浠よ浣跨敤NET鍛戒护锛屾垨浣跨敤鍥惧舰Services宸ュ叿鏉ユ帶鍒AMySQL鏈嶅姟鍣ㄣ

Windows鎺у埗闈㈡澘(Windows 2000,XPServer 2003绠$悊宸ュ叿涓嬮潰)涓彲浠ョ湅瑙Services宸ュ叿(Windows Service Control Manager)寤鸿浠庡懡浠よ瀹夎娲诲嵏杞芥湇鍔″櫒鏃跺叧闂Services宸ュ叿銆傝繖鏍峰彲浠ラ槻姝㈣澶氶敊璇

瀹夎MySQL Windows鏈嶅姟涔嬪墠锛屽簲褰撲娇鐢ㄤ笅闈㈢殑鍛戒护鍏堝仠姝㈠綋鍓嶆杩愯鐨勬湇鍔″櫒锛

C\> C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin -u root shutdown

娉ㄩ噴锛濡傛灉MySQL root鐢ㄦ埛璐︽埛鏈夊瘑鐮侊紝浣犻渶瑕佽皟鐢ㄥ懡浠 C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin -u root -p shutdown骞舵牴鎹彁绀鸿緭鍏ュ瘑鐮併

璇ュ懡浠よ皟鐢MySQL绠$悊宸ュ叿mysqladmin锛岃繛鎺ユ湇鍔″櫒骞跺憡鐭ュ畠鍏抽棴鏈嶅姟銆傝鍛戒护浣跨敤MySQL root鐢ㄦ埛杩炴帴锛岃繖鏄MySQL鏉冮檺绯荤粺涓殑榛樿绠$悊璐︽埛銆傝娉ㄦ剰MySQL鏉冮檺绯荤粺涓殑鐢ㄦ埛瀹屽叏鐙珛浜Windows涓嬬殑鐧诲綍鐢ㄦ埛銆

浣跨敤璇ュ懡浠ゅ畨瑁呮湇鍔″櫒

C\> mysqld --install

濡傛灉鍙娇鐢ㄦ湇鍔″櫒鍚嶅畨瑁mysqld鏃舵湁闂锛屽皾璇曚娇鐢ㄥ叏璺緞鍚嶆潵瀹夎銆備緥濡傦細

C\> C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld --install

浣犺繕鍙互灏MySQL bin鐩綍鐨勮矾寰勫姞鍒Windows绯荤粺PATH鐜鍙橀噺涓細

         鍙冲嚮Windows妗岄潰涓婄殑My Computer锛堟垜鐨勮绠楁満锛鍥炬爣锛岄夋嫨Properties锛堝睘鎬э級銆

         鐒跺悗浠庡嚭鐜扮殑System Properties鑿滃崟涓夋嫨Advanced锛堥珮绾э級鏍囩锛岀劧鍚庣偣鍑Environment Variables鐜鍙橀噺锛鎸夐挳銆

         閫夋嫨System Variables绯荤粺鍙橀噺锛変笅闈㈢殑Path锛堣矾寰勶級锛岀劧鍚庣偣鍑Edit缂栬緫锛鎸夐挳銆傚皢寮瑰嚭Edit System Variable锛堢紪杈戠郴缁熷彉閲忥級瀵硅瘽妗嗐

         灏嗗厜鏍囨斁鍒版爣璁Variable Value鍙橀噺鍊硷級澶勭殑鏂囨湰鐨勫悗闈€(浣跨敤End閿‘淇濆厜鏍囦綅浜庢枃鏈殑鏈鍚)銆傜劧鍚庤緭鍏MySQL bin鐩綍   鐨勫畬鏁磋矾寰(渚嬪锛C:\Program Files\MySQL\MySQL Server 5.1\bin)锛岃娉ㄦ剰搴斾娇鐢ㄥ垎鍙峰皢璇ヨ矾寰勪笌璇ュ煙鍐呯殑鍏跺畠鍊奸殧绂诲紑銆備竴娆″叧闂瀵硅瘽妗嗗拰鍚勪釜瀵硅瘽妗嗭紝鐐瑰嚮OK鐩村埌鎵撳紑鐨勬墍鏈夊璇濇琚叧闂備綘鐜板湪鍙互鍦DOS鎻愮ず绗︿笅浠庣郴缁熺殑浠讳綍鐩綍杈撳叆MySQL鍙墽琛岀▼搴忓悕鏉ヨ皟鐢MySQL鍙墽琛岀▼搴忥紝鑰屼笉蹇呮彁渚涜矾寰勫悕銆傚寘鎷湇鍔″櫒銆MySQL瀹㈡埛绔拰鎵鏈MySQL鍛戒护琛屽疄鐢ㄧ▼搴忥紝渚嬪mysqladminmysqldump

         璇锋敞鎰忓湪鍚屼竴涓満鍣ㄤ笂杩愯澶氫釜MySQL鏈嶅姟鍣ㄦ椂锛屼笉闇瑕佸湪Windows PATH涓姞鍏MySQL bin鐩綍銆

璀﹀憡锛氱紪杈戠郴缁PATH鏃跺繀椤荤壒鍒敞鎰忥紱鎰忓鍒犻櫎鎴栦慨鏀瑰凡鏈夎矾寰勫间細閫犳垚绯荤粺鏁呴殰鐢氳嚦鐦棯銆

鏈嶅姟瀹夎鍛戒护涓嶄細鍚姩鏈嶅姟鍣ㄣ傚湪鏈妭鍚庨潰灏嗙粰鍑虹浉鍏虫寚浠ゃ

瀹夎鏈嶅姟鏃讹紝鍙互浣跨敤MySQL 5.1涓殑涓嬮潰鐨勫弬鏁帮細

         鍙互鐩存帴鍦--install閫夐」鍚庨潰鎸囧畾鏈嶅姟鍚嶃傞粯璁ゆ湇鍔″悕鏄MySQL

         濡傛灉缁欏嚭浜嗘湇鍔″悕锛屽悗闈㈠彲浠ヨ窡涓涓夐」銆備竴鑸儏鍐碉紝搴斿綋涓defaults-file=file_name锛屾寚瀹氶夐」鏂囦欢鐨勫悕绉帮紝鏈嶅姟鍣ㄥ惎鍔ㄦ椂搴斿綋浠庝腑璇诲彇閫夐」銆

鍙互浣跨敤鍗曚釜閫夐」浠f浛--defaults-file锛屼絾鏄笉鎻愬¤繖鏍峰仛銆--defaults-file鏇村姞鐏垫椿涓浜涳紝鍥犱负浣犲彲浠ュ皢澶氫釜鏈嶅姟鍣ㄥ惎鍔ㄩ夐」鏀惧叆鍛藉悕鐨勯夐」鏂囦欢涓

         鍙互鍦ㄦ湇鍔″悕鍚庨潰鎸囧畾涓涓--local-service閫夐」銆傝繖鏍锋湇鍔″櫒杩愯鏃朵娇鐢LocalService Windows璐︽埛锛屽彧鍏锋湁鏈夐檺鐨勭郴缁熸潈闄愩傝璐︽埛鍙傜敤浜Windows XP鎴栨洿鏂扮増鏈傚鏋滄湇鍔″悕鍚庨潰鍚屾椂璺熸湁--defaults-file--local-service锛屼簩鑰呭彲浠ユ寜浠讳綍椤哄簭鎺掓斁銆

瀵逛簬Windows MySQL鏈嶅姟鍣紝鏍规嵁涓嬮潰瑙勫垯纭畾鏈嶅姟鍣ㄤ娇鐢ㄧ殑鏈嶅姟鍚嶅拰閫夐」鏂囦欢锛

         濡傛灉鍦ㄦ湇鍔″畨瑁呭懡浠や腑锛屾病鏈夊湪--install閫夐」鍚庨潰鎸囧畾浜嗘湇鍔″悕鎴栦娇鐢ㄩ粯璁ゆ湇鍔″悕(MySQL)锛屾湇鍔″櫒鍒欎娇鐢MySQL鏈嶅姟鍚嶅苟浠庢爣鍑嗛夐」鏂囦欢鐨[mysqld]缁勮鍙栭夐」銆

         濡傛灉鍦ㄦ湇鍔″畨瑁呭懡浠や腑锛屽湪--install閫夐」鍚庨潰鎸囧畾鐨勬湇鍔″悕涓嶆槸榛樿鏈嶅姟鍚(MySQL)銆傚垯浠庡叿鏈夌浉鍚屾湇鍔″悕鐨勭粍涓鍙栭夐」锛屽苟浠庢爣鍑嗛夐」鏂囦欢璇诲彇閫夐」銆

鏈嶅姟鍣ㄨ繕浠庢爣鍑嗛夐」鏂囦欢鐨[mysqld]缁勮鍙栭夐」銆備綘鍙互浣跨敤[mysqld]缁勪腑鐨勯夐」鐢ㄤ簬鎵鏈MySQL 鏈嶅姟锛岃繕鍙互浣跨敤鍏锋湁鐩稿悓鏈嶅姟鍚嶇殑缁勶紝鐢ㄤ簬璇ユ湇鍔″悕鎵瀵瑰簲鐨勬湇鍔″櫒銆

         濡傛灉鍦ㄦ湇鍔″畨瑁呭懡浠や腑锛屽湪鏈嶅姟鍚嶅悗闈㈡寚瀹氫簡--defaults-file閫夐」锛屾湇鍔″櫒鍙粠鍛藉悕鏂囦欢鐨[mysqld]缁勪腑璇诲彇閫夐」锛屽拷鐣ユ爣鍑嗛夐」鏂囦欢銆

瀵逛簬鏇村鏉傜殑渚嬪瓙鍙互鑰冭檻浣跨敤鍛戒护锛

C\> C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld --install MySQL --defaults-file=C:\my-opts.cnf

璇ュ懡浠や腑锛--install閫夐」鍚庨潰缁欏嚭浜嗛粯璁ゆ湇鍔″悕(MySQL)銆傚鏋滄湭缁欏嚭--defaults-file閫夐」锛岃鍛戒护鍙互璁╂湇鍔″櫒浠庢爣鍑嗛夐」鏂囦欢鐨[mysqld]缁勪腑璇绘暟銆傜敱浜庢彁渚涗簡--defaults-file閫夐」锛屾湇鍔″櫒鍙粠鍛藉悕鏂囦欢鐨[mysqld]缁勮鍙栭夐」銆

杩樺彲浠ュ湪鍚姩MySQL鏈嶅姟涔嬪墠锛屽湪Windows Services宸ュ叿涓寚瀹氬惎鍔ㄥ弬鏁伴夐」銆

MySQL鏈嶅姟鍣ㄥ畨瑁呬负鏈嶅姟鍚庯紝Windows鍚姩鏃惰嚜鍔ㄥ惎鍔ㄦ湇鍔°傝繕鍙互浠Services宸ュ叿鐩存帴鍚姩鏈嶅姟锛屾垨浣跨敤鍛戒护NET START MySQLNET鍛戒护蹇界暐澶у皬鍐欍

鍋氫负鏈嶅姟杩愯鏃讹紝mysqld涓嶈兘璁块棶鎺у埗鍙扮獥鍙o紝鍥犳鐪嬩笉瑙佷换浣曟秷鎭傚鏋mysqld鏈惎鍔紝妫鏌ラ敊璇棩蹇楃湅鐪嬫湇鍔″櫒鏄惁鍐欏叆浜嗘樉绀洪棶棰樺師鍥犵殑浠讳綍娑堟伅銆傞敊璇棩蹇椾綅浜MySQL鏁版嵁鐩綍涓(渚嬪锛C:\Program Files\MySQL\MySQL Server 5.1\data)锛屾槸甯﹀悗缂.err鐨勬枃浠躲

濡傛灉MySQL鏈嶅姟鍣ㄥ畨瑁呬负鏈嶅姟锛屽苟涓旀湇鍔℃杩愯锛Windows鍏抽棴鏃惰嚜鍔ㄥ仠姝㈡湇鍔°傝繕鍙互閫氳繃Services宸ュ叿銆NET STOP MySQL鍛戒护鎴 mysqladmin shutdown鍛戒护鎵嬪姩鍋滄鏈嶅姟鍣ㄣ

濡傛灉涓嶆兂鍦ㄥ紩瀵艰繃绋嬩腑鑷姩鍚姩鏈嶅姟锛岃繕鍙互灏嗘湇鍔¤缃负鎵嬪姩鍚姩妯″紡銆傚疄鐜扮殑鏂规硶鏄娇鐢--install-manual閫夐」鑰岄潪--install閫夐」锛

C\> C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld --install-manual

瑕佹兂鍗歌浇鏈嶅姟鍣紝濡傛灉鏈嶅姟姝h繍琛屽垯搴旈鍏堜娇鐢ㄥ懡浠NET STOP MYSQL鍋滄鏈嶅姟銆傜劧鍚庝娇鐢--remove閫夐」鍗歌浇鏈嶅姟锛

C\> C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld --remove

濡傛灉mysqld涓嶆槸鏈嶅姟锛屽彲浠ヤ粠鍛戒护琛屽惎鍔ㄥ畠銆傝缁嗚鏄庡弬瑙2.3.11鑺傦紝鈥滀粠Windows鍛戒护琛屽惎鍔∕ySQL鈥

濡傛灉鍦ㄥ畨瑁呰繃绋嬩腑閬囧埌闂锛岃鍙傞槄2.3.14鑺傦紝鈥滃湪Windows鐜涓嬪MySQL瀹夎鐨勬晠闅滆瘖鏂笌鎺掗櫎鈥

2.3.13. 娴嬭瘯MySQL瀹夎

鍙互閫氳繃浠ヤ笅鍛戒护娴嬭瘯MySQL鏈嶅姟鍣ㄦ槸鍚﹀伐浣滐細
C:\> C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow
C:\> C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow -u root mysql
C:\> C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin version status proc
C:\> C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql test

濡傛灉mysqld瀵瑰鎴风绋嬪簭TCP/IP杩炴帴鐨勫搷搴旇緝鎱紝鍙兘鏄DNS闂銆傛鏃讹紝浣跨敤--skip-name-resolve閫夐」鍚姩mysqld锛屽湪MySQL鎺堟潈琛ㄧ殑Host鍒楀彧浣跨敤localhostIP鍙枫

鍙互閫氳繃--pipe--protocol=PIPE閫夐」寮哄埗MySQL瀹㈡埛绔娇鐢ㄥ懡鍚嶇閬撹繛鎺ヤ唬鏇TCP/IP杩炴帴锛屾垨鎸囧畾.(闃舵)鍋氫负涓绘満鍚嶃備娇鐢--socket閫夐」鎸囧畾绠¢亾鍚嶃

2.3.14. 鍦╓indows鐜涓嬪MySQL瀹夎鐨勬晠闅滆瘖鏂笌鎺掗櫎

棣栨瀹夎銆佽繍琛MySQL鏃讹紝浣犲彲鑳戒細閬囧埌涓浜涢敊璇紝浣MySQL鏈嶅姟鍣ㄤ笉鑳藉惎鍔ㄣ傛湰鑺傜殑鐩殑鏄府鍔╀綘璇婃柇骞剁籂姝h繖浜涢敊璇

瑙e喅鏈嶅姟鍣ㄩ棶棰樻椂浣犵殑绗竴璧勬枡鏄敊璇棩蹇椼MySQL鏈嶅姟鍣ㄤ娇鐢ㄩ敊璇棩蹇楁潵璁板綍鏈嶅姟鍣ㄤ笉鑳藉惎鍔ㄧ殑淇℃伅銆傞敊璇棩蹇椾綅浜my.ini鏂囦欢鎸囧畾鐨勬暟鎹洰褰曚腑銆傞粯璁ゆ暟鎹洰褰曚綅浜C:\Program Files\MySQL\MySQL Server 5.1\dat銆傝鍙傝5.11.1鑺傦紝鈥滈敊璇棩蹇椻

鍙︿竴涓敊璇浉鍏充俊鎭簮鏄MySQL鏈嶅姟鍚姩鏃舵帶鍒跺彴涓婃樉绀虹殑娑堟伅銆傚皢mysqld瀹夎涓烘湇鍔″悗锛屼粠鍛戒护琛岄氳繃NET START mysql鍛戒护鏉ユ煡鐪MySQL鏈嶅姟鍚姩鐩稿叧鐨勯敊璇秷鎭傝鍙傝2.3.12鑺傦紝鈥滀互Windows鏈嶅姟鏂瑰紡鍚姩MySQL鈥

涓嬮潰璺濈璇存槑浜嗛娆″畨瑁呭苟鍚姩MySQL鏈嶅姟鏃朵細閬囧埌鐨勬渶甯歌鐨勯敊璇秷鎭細

                System error 1067 has occurred.
                Fatal error: Can't open privilege tables: Table 'mysql.host' doesn't exist

         MySQL鏈嶅姟鍣ㄦ壘涓嶅埌MySQL鏉冮檺鏁版嵁搴撴垨鍏抽敭鏂囦欢鏃朵細鍑虹幇杩欎簺娑堟伅銆傚綋MySQL鍩烘垨鏁版嵁鐩綍娌℃湁瀹夎鍦ㄩ粯璁や綅缃(C\mysqlC:\Program Files\MySQL\MySQL Server 5.1\data)锛岃屾槸瀹夎鍒板叾瀹冧綅缃椂閫氬父浼氶亣鍒拌闂銆

鍙戠敓璇ラ棶棰樼殑涓绉嶆儏鍐垫槸瀵MySQL杩涜鍗囩骇鎴栧畨瑁呭埌浜嗘柊浣嶇疆锛屼絾鏄病鏈夊閰嶇疆鏂囦欢杩涜鏇存柊浠ュ搴旀柊鐨勫畨瑁呬綅缃傛澶栬繕鍙兘鏄柊鏃ч厤缃枃浠跺啿绐侊紝褰撳崌绾MySQL鏃讹紝涓瀹氳鍒犻櫎鎴栭噸鏂板懡鍚嶆棫鐨勯厤缃枃浠躲

濡傛灉浣犳病鏈夊皢MySQL瀹夎鍒C:\Program Files\MySQL\MySQL Server 5.1鐩綍涓嬶紝鑰屾槸瀹夎鍒颁簡鍏跺畠鐩綍涓嬶紝浣犻渶瑕侀氳繃浣跨敤閰嶇疆(my.ini)鏂囦欢璁MySQL鏈嶅姟鍣ㄧ煡閬撳畨瑁呯洰褰曘my.ini鏂囦欢搴斾綅浜Windows鐩綍涓嬶紝鍏稿瀷涓C\WINNTC\WINDOWS銆傚彲浠ュ湪鍛戒护鎻愮ず绗︿笅杈撳叆涓嬮潰鐨勫懡浠や粠WINDIR鐜鍙橀噺鍊间腑纭畾纭垏浣嶇疆锛

C\> echo %WINDIR%

鍙互閫氳繃鏂囨湰缂栬緫鍣紙渚嬪璁颁簨鏈級鏉ュ垱寤哄苟淇敼閫夐」鏂囦欢銆備緥濡傦紝濡傛灉MySQL瀹夎鍦E\mysql鏁版嵁鐩綍鍦D:\MySQLdata锛屼綘鍙互鍒涘缓閫夐」鏂囦欢骞惰缃[mysqld]鏉ユ寚瀹basedirdatadir鍙傛暟鐨勫硷細

[mysqld]
# set basedir to your installation path
basedir=E:/mysql
# set datadir to the location of your data directory
datadir=D:/MySQLdata

璇锋敞鎰忓簲浣跨敤()鏂滅嚎鑰屼笉鏄弽鏂滅嚎鍦ㄩ夐」鏂囦欢涓寚瀹Windows璺緞鍚嶃傚鏋滀娇鐢ㄥ弽鏂滅嚎锛屽垯蹇呴』浣跨敤鍙屾枩绾匡細

[mysqld]
# set basedir to your installation path
basedir=C:\\Program Files\\MySQL\\MySQL Server 5.1
# set datadir to the location of your data directory
datadir=D:\\MySQLdata

濡傛灉鍦MySQL閰嶇疆鏂囦欢涓洿鏀datadir鍊硷紝鍦ㄩ噸鏂板惎鍔MySQL鏈嶅姟鍣ㄤ箣鍓嶏紝蹇呴』绉诲姩宸叉湁MySQL鏁版嵁鐩綍涓殑鍐呭銆

鍙傝2.3.8鑺傦紝鈥滃垱寤洪夐」鏂囦欢鈥

                Error: Cannot create Windows service for MySql. Error: 0

         褰撲綘娌℃湁浜嬪厛鍋滄骞跺嵏杞藉凡鏈MySQL鏈嶅姟锛屽苟涓斾娇鐢MySQL Configuration Wizard锛堥厤缃悜瀵硷級閲嶆柊瀹夎鎴栧崌绾MySQL鏃讹紝浼氶亣鍒拌闂銆傚彂鐢熺殑鍘熷洜鏄紝褰撻厤缃悜瀵艰瘯鍥惧畨瑁呮湇鍔℃椂锛屽畠鍙戠幇宸茬粡鏈変竴涓悓鍚嶇殑鏈嶅姟銆

瑙e喅璇ラ棶棰樼殑涓涓柟妗堟槸浣跨敤閰嶇疆鍚戝鏃堕夋嫨mysql涔嬪鐨勫叾瀹冩湇鍔″悕銆傝繖鏍峰彲浠ユ纭畨瑁呮柊鏈嶅姟锛屼絾淇濈暀浜嗗師鏉ョ殑鏈嶅姟銆備絾鏄繖鏍蜂笉濂斤紝鏈濂芥槸鍗告帀涓嶅啀浣跨敤鐨勬棫鏈嶅姟銆

瑕佹兂姘歌繙鍗告帀鏃х殑MySQL鏈嶅姟锛岄氳繃绠$悊鏉冮檺鐢ㄦ埛鍦ㄥ懡浠よ鎵ц涓嬮潰鐨勫懡浠わ細

C:\>sc delete mysql
[SC] DeleteService SUCCESS

濡傛灉Windows鐗堟湰涓病鏈sc宸ュ叿锛屽彲浠ヤ粠 http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/delsrv-o.asp 涓嬭浇delsrv宸ュ叿骞朵娇鐢delsrvMySQL璇硶銆

2.3.15. 鍦╓indows涓嬪崌绾ySQL

鏈妭鍒楀嚭浜嗗湪Windows涓崌绾MySQL搴旈噰鍙栫殑姝ラ銆

1.    杩涜鍗囩骇鍓嶄綘搴斿厛澶囦唤褰撳墠鐨MySQL瀹夎銆傝鍙傝5.9.1鑺傦紝鈥滄暟鎹簱澶囦唤鈥

2.    http://dev.mysql.com/downloads/涓嬭浇鏈鏂WindowsMySQL

3.    鍗囩骇MySQL鍓嶏紝蹇呴』鍋滄鏈嶅姟鍣ㄣ

濡傛灉鏈嶅姟鍣ㄥ畨瑁呬负鏈嶅姟锛屽繀椤诲湪鍛戒护鎻愮ず绗︿笅鍦ㄥ懡浠よ涓敤涓嬮潰鐨勫懡浠ゅ仠姝㈡湇鍔★細

C\> NET STOP MYSQL

濡傛灉MySQL鏈嶅姟鍣ㄤ笉鏄湇鍔★紝浣跨敤涓嬮潰鐨勫懡浠ゅ仠姝㈡湇鍔″櫒锛

C\> C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin -u root shutdown

4.    褰撲粠浠ュ墠鑷崇殑4.1.5鐗堟湰鍗囩骇鍒MySQL 5.1,鎴栦粠Zip鏂囦欢瀹夎鐨MySQL鍗囩骇鍒MySQL Installation Wizard瀹夎甯姪锛夊畨瑁呯殑MySQL鏃讹紝浣犲繀椤绘墜鍔ㄥ嵏杞藉墠闈㈠畨瑁呯殑MySQL鏈嶅姟銆

瑕佹兂鍗歌浇MySQL鏈嶅姟锛屼娇鐢ㄤ笅闈㈢殑鍛戒护锛

C\> C:\mysql\bin\mysqld --remove

濡傛灉浣犱笉鎯冲嵏杞藉凡鏈夌殑鏈嶅姟锛MySQL Installation Wizard锛堝畨瑁呭府鍔╋級鍒欎笉浼氭纭畨瑁呮柊鐨MySQL鏈嶅姟銆

5.    濡傛灉浣犱娇鐢MySQL Installation Wizard锛堝畨瑁呭府鍔╋級锛屾寜鐓2.3.4鑺傦紝鈥滀娇鐢∕ySQL瀹夎鍚戝鈥鐨勬弿杩版潵鍚姩甯姪銆

6.    濡傛灉鐢Zip鏂囦欢瀹夎MySQL锛屽簲鎻愬彇鏂囦欢銆備綘鍙互瑕嗙洊宸叉湁鐨MySQL瀹夎(閫氬父浣嶄簬C\mysql)锛屾垨灏嗗畠瀹夎鍒板叾瀹冪洰褰曪紝渚嬪 C\mysql4銆傚缓璁鐩栧師鏈夌殑瀹夎銆

7.    閲嶆柊鍚姩鏈嶅姟鍣ㄣ傚鏋滀綘杩愯MySQL鏈嶅姟锛屽垯浣跨敤NET START MySQL锛岃繕鍙互鐩存帴璋冪敤mysqld

8.    鍏充簬鍦Windows涔嬪鐨勬搷浣滅郴缁熷崌绾MySQL鐨勮缁嗕俊鎭紝璇峰弬闃2.10鑺傦紝鈥滃崌绾ySQL鈥

9.    濡傛灉閬囧埌閿欒锛屽弬瑙 2.3.14鑺傦紝鈥滃湪Windows鐜涓嬪MySQL瀹夎鐨勬晠闅滆瘖鏂笌鎺掗櫎鈥

2.3.16. Windows鐗圡ySQL鍚孶nix鐗圡ySQL瀵规瘮

宸茬粡璇佹槑锛WindowsMySQL寰堢ǔ瀹氥WindowsMySQL鐨勫姛鑳戒笌鐩稿簲鐨Unix鐗堢浉鍚岋紝鍙湁浠ヤ笅渚嬪锛

         Windows 95鍜岀嚎绋

Windows 95鍒涘缓涓涓嚎绋嬫椂澶х害闇瑕200瀛楄妭鐨勪富鍐呭瓨銆MySQL鐨勬瘡涓繛鎺ラ兘浼氬垱寤轰竴涓柊绾跨▼锛屽洜姝ゅ鏋滀綘鐨勬湇鍔″櫒姝e鐞嗚澶氳繛鎺ワ紝浣犱笉搴斿綋鍦Windows 95涓繍琛mysqld

         鏈夐檺鐨勭鍙f暟鐩

Windows绯荤粺鏈夊ぇ绾4,000涓鍙d緵瀹㈡埛绔繛鎺ワ紝鏌愪釜绔彛鐨勮繛鎺ュ叧闂悗锛屽湪鑳藉閲嶆柊鍒╃敤璇ョ鍙e墠锛岄渶瑕24鍒嗛挓銆傚湪瀹㈡埛绔绻佽繛鎺ュ苟浠庢湇鍔″櫒涓婃柇寮鏃讹紝鍦ㄥ彲浠ラ噸鏂颁娇鐢ㄥ叧闂殑绔彛鍓嶏紝鏈夊彲鑳界敤瀹屼簡鎵鏈夊彲鐢ㄧ殑绔彛銆傚鏋滃彂鐢熻繖绉嶆儏鍐碉紝MySQL鏈嶅姟鍣ㄤ笉浼氬搷搴旓紝鍗充娇瀹冧粛鍦ㄨ繍琛屻傝娉ㄦ剰鏈哄櫒涓婅繍琛岀殑鍏跺畠搴旂敤绋嬪簭涔熷彲浠ヤ娇鐢ㄧ鍙o紝姝ゆ椂鍙緵MySQL浣跨敤鐨勭鍙f暟瑕佸皯銆

璇︾粏淇℃伅鍙傝http://support.microsoft.com/default.aspx?scid=kb;en-us;196271

         骞惰璇

MySQL渚濋潬pread()pwrite()绯荤粺璋冪敤鏉ュ悓鏃朵娇鐢INSERTSELECT銆傜洰鍓嶆垜浠娇鐢ㄤ簰鏂ユ潵绔炰簤pread()pwrite()銆傛垜浠皢鏉ユ兂鐢ㄨ櫄鎷熸帴鍙f浛鎹㈡枃浠剁骇鎺ュ彛锛屽洜姝よ鎯虫洿蹇紝鎴戜滑鍙互鍦NT2000XP涓婁娇鐢readfile()/writefile()鎺ュ彛銆傜洰鍓MySQL 5.1鍙互鎵撳紑鐨勬枃浠剁殑闄愬埗鏁扮洰涓2,048,鎰忓懗鐫鍦Windows NT2000,XP2003涓婂彲浠ヨ繍琛岀殑骞惰绾跨▼涓嶅Unix涓婂銆

         闃诲璇

MySQL涓烘瘡涓繛鎺ヤ娇鐢ㄩ樆濉炶鍙栵紝濡傛灉鍚敤浜嗗懡鍚嶇閬撹繛鎺ワ紝鍏跺惈涔夊涓嬶細

o        杩炴帴涓嶄細鍦8灏忔椂鍚庤嚜鍔ㄦ柇寮锛岃屽湪UnixMySQL涓細鍙戠敓銆

o        濡傛灉杩炴帴琚寕璧凤紝涓嶆潃鎺MySQL鍒欎笉浼氬皢鍏朵腑鏂

o        mysqladmin kill涓嶄細鏉鎺夌潯鐪犱腑鐨勮繛鎺ャ

o        鍙鏈夌潯鐪犺繛鎺ワ紝mysqladmin shutdown涓嶄細涓柇銆

鎴戜滑璁″垝鍦ㄥ皢鏉ヤ慨澶嶈闂銆

         ALTER TABLE

鎵цALTER TABLE璇彞鏃讹紝灏嗚琛ㄩ攣瀹氫笉璁╁叾瀹冪嚎绋嬩娇鐢ㄣ傚湪Windows涓紝浣犱笉鑳藉垹闄ゆ琚彟涓涓嚎绋嬩娇鐢ㄧ殑鏂囦欢銆傚湪灏嗘潵锛屾垜浠細鎵惧嚭鍔炴硶瑙e喅璇ラ棶棰樸

         DROP TABLE

Windows涓涓涓MERGE琛ㄥ簲鐢ㄧ殑琛ㄦ墽琛DROP TABLE涓嶄細瀹炵幇锛屽洜涓MERGE澶勭悊鍣ㄥ皢琛ㄤ粠MySQL涓婂眰鏄犲皠闅愯棌璧锋潵銆傜敱浜Windows涓嶅厑璁稿垹闄ゆ墦寮鐨勬枃浠讹紝蹇呴』鍦ㄥ垹闄よ〃涔嬪墠棣栧厛娓呯┖鎵鏈MERGE(浣跨敤FLUSH TABLES)鎴栧垹鎺MERGE琛ㄣ

         DATA DIRECTORY and INDEX DIRECTORY

Windows涓皢蹇界暐DATA DIRECTORYINDEX DIRECTORY閫夐」锛屽洜涓Windows涓嶆敮鎸佺鍙疯繛鎺ャ傚湪鍏锋湁闈炲姛鑳realpath()璋冪敤鐨勭郴缁熶腑锛岃繖浜涢夐」涔熻蹇界暐銆

         DROP DATABASE

浣犱笉鑳藉垹鎺夋琚嚎绋嬩娇鐢ㄧ殑鏁版嵁搴撱

         Task Manager锛堜换鍔$鐞嗗櫒锛夋潃鎺MySQL

浣犱笉鑳戒粠Task Manager锛堜换鍔$鐞嗘眰锛夋垨浣跨敤Windows 95shutdown宸ュ叿鏉ユ潃鎺MySQL銆備綘蹇呴』閫氳繃mysqladmin shutdown鍋滄瀹冦

         澶у皬鍐欏悕

鐢变簬Windows瀵规枃浠跺悕澶у皬鍐欎笉鏁忔劅銆傚洜姝ゅ湪WindowsMySQL鏁版嵁搴撳悕鍜岃〃鍚嶅澶у皬鍐欎篃涓嶆晱鎰熴傚敮涓鐨勯檺鍒舵槸鍦ㄥ悓涓涓鍙ヤ腑锛屽繀椤诲悓鏃朵娇鐢ㄥぇ鍐欐垨灏忓啓鎸囧畾鏁版嵁搴撳悕鍜岃〃鍚嶃傝鍙傝9.2.2鑺傦紝鈥滆瘑鍒澶у皬鍐欐晱鎰熸р

         \鈥欒矾寰勫悕闂撮殧绗

Windows涓殑璺緞鍚嶇敤鈥\鈥欑闂撮殧寮锛屽湪MySQL涓繕鏄浆涔夊瓧绗︺傚鏋滀綘浣跨敤LOAD DATA INFILESELECT ... INTO OUTFILE锛岀敤鈥/鈥欑浣跨敤Unix-绫绘枃浠跺悕锛

mysql> LOAD DATA INFILE 'C:/tmp/skr.txt' INTO TABLE skr;
mysql> SELECT * INTO OUTFILE 'C:/tmp/skr.txt' FROM skr;

浣犺繕鍙互浣跨敤鍙屸\鈥欑锛

mysql> LOAD DATA INFILE 'C:\\tmp\\skr.txt' INTO TABLE skr;
mysql> SELECT * INTO OUTFILE 'C:\\tmp\\skr.txt' FROM skr;

         绠¢亾闂銆

绠¢亾涓嶈兘鍦Windows鍛戒护琛屾彁绀虹涓嬪彲闈犲湴宸ヤ綔銆傚鏋滅閬撳寘鎷瓧绗^Z/CHAR(24)Windows璁や负閬囧埌浜嗘枃浠舵湯灏惧苟涓柇绋嬪簭銆

杩欎富瑕佹槸鎸夌収濡備笅鎵绀轰娇鐢ㄤ簩杩涘埗鏃ュ織鐨勪富瑕侀棶棰橈細

C\>mysqlbinlog binary-log-name | mysql --user=root

濡傛灉浣跨敤鏃ュ織鏃跺嚭鐜伴棶棰橈紝鎬鐤戞槸鐢变簬^Z / CHAR(24)瀛楃锛屼綘鍙互浣跨敤涓嬮潰鐨勭▼搴忥細

C:\> mysqlbinlog binary-log-file --result-file=/tmp/bin.sql
C:\> mysql --user=root --execute "source /tmp/bin.sql"

鍚庨潰鐨勫懡浠よ繕鍙互鐢ㄦ潵鍙潬璇诲彇浠讳綍鍖呭惈浜岃繘鍒舵暟鎹殑SQL鏂囦欢銆

         Access denied for user閿欒

濡傛灉浣犺瘯鍥捐繍琛MySQL瀹㈡埛绔▼搴忔潵杩炴帴鍚屼竴鏈哄櫒涓婅繍琛岀殑鏈嶅姟鍣紝浣嗘槸閬囧埌閿欒Access denied for user 'some-user'@'unknown' to database 'mysql'锛岃繖鎰忓懗鐫MySQL涓嶈兘姝g‘璇嗗埆浣犵殑涓绘満鍚嶃

瑕佽В鍐宠闂锛屼綘搴斿綋鍒涘缓涓涓悕涓\windows\hosts鍖呭惈涓嬮潰淇℃伅鐨勬枃浠讹細

127.0.0.1       localhost

杩欏効鏈変竴浜涘叕寮闂锛屾彁渚涚粰鎯宠甯姪鎴戜滑鏀硅繘Windows涓殑MySQL鐨勪汉浠細

         澧炲姞瀹忔潵浣跨敤Windows鎻愪緵鐨勬洿蹇殑绾跨▼瀹夊叏澧/鍑忔柟娉曘

2.4.聽鍦↙inux涓嬪畨瑁匨ySQL

寤鸿鍦Linux涓娇鐢RPM鍖呮潵瀹夎MySQLMySQL RPM鐩墠宸茬粡宓屽叆鍒SuSE Linux 7.3绯荤粺涓紝浣嗘槸搴斿綋鑳藉湪澶у鏁版敮鎸rpm鍜屼娇鐢glibcLinux鐗堟湰涓伐浣溿傝鎯宠幏寰RPM杞欢鍖咃紝鍙傝2.1.3鑺傦紝鈥滄庢牱鑾峰緱MySQL鈥

MySQL AB涓嶆彁渚涗笌鍏蜂綋骞冲彴鐩稿叧鐨RPM锛涘叿浣撳钩鍙扮浉鍏崇殑RPM鍜岄氱敤RPM涔嬮棿鐨勫尯鍒槸鍏蜂綋骞冲彴鐩稿叧RPM涓虹洰鏍囧钩鍙拌屾瀯寤猴紝涓哄姩鎬佽繛鎺ャ傝岄氱敤RPMLinux绾跨▼涔嬮棿鏄潤鎬佽繛鎺ャ

娉ㄩ噴锛閫氬父鐢卞叾瀹冧緵搴斿晢鎻愪緵MySQLRPM鍒嗗彂鐗堛傚叾鐗瑰緛鍜屽姛鑳戒笌MySQL AB鎵鏋勫缓鐨勪笉鍚岋紝璇ユ墜鍐屼腑鐨勬寚浠や笉涓瀹氶傚悎瀹夎鍏跺畠渚涘簲鍟嗘彁渚涚殑MySQLRPM鍒嗗彂鐗堛傛鏃跺簲鍜ㄨ渚涘簲鍟嗙殑璇存槑銆

濡傛灉RPM鏂囦欢鏈夐棶棰(渚嬪锛屽鏋滀綘鏀跺埌閿欒鈥Sorry, the host 'xxxx' could not be looked up)锛屽弬瑙2.12.1.2鑺傦紝鈥淟inux浜岃繘鍒跺垎鍙戠増璇存槑鈥

鍦ㄥぇ澶氭暟鎯呭喌锛屼綘鍙渶瑕佸畨瑁MySQL-serverMySQL-client杞欢鍖呮潵瀹夎MySQL銆傚湪鏍囧噯瀹夎涓笉闇瑕佸叾瀹冪殑鍖呫傚鏋滀綘鎯宠杩愯鍚洿澶氬姛鑳界殑MySQL-Max鏈嶅姟鍣紝杩樺簲褰撳畨瑁MySQL-Max RPM銆傚繀椤诲厛瀹夎M MySQL-server RPM鍐嶅畨瑁呰妯″潡銆傝鍙傝5.1.2鑺傦紝鈥渕ysqld-max鎵╁睍MySQL鏈嶅姟鍣ㄢ

濡傛灉瀹夎MySQL杞欢鍖呮椂鍑虹幇浠庡睘閿欒(渚嬪锛屸error: removing these packages would break dependencies: libmysqlclient.so.10 is needed by ..)锛屼綘杩樺簲褰撳畨瑁呭寘MySQL-shared-compat锛屽叾涓寘鎷袱涓悜鍚庡吋瀹圭殑鍏变韩搴(MySQL 4.0libmysqlclient.so.12MySQL 3.23libmysqlclient.so.10)

璁稿Linux鍒嗗彂鐗堝寘鍚簡MySQL 3.23锛岄氬父鍔ㄦ佽繛鎺ュ簲鐢ㄧ▼搴忎互鑺傜渷纭洏绌洪棿銆傚鏋滆繖浜涘叡浜簱鍦ㄥ崟鐙殑鍖呭唴(渚嬪锛MySQL-shared)锛屽彧闇瑕佸畨瑁呰繖浜涘寘骞跺崌绾MySQL鏈嶅姟鍣ㄥ拰瀹㈡埛绔蒋浠跺寘(涓洪潤鎬佽繛鎺ワ紝涓嶄緷璧栧叡浜簱)瀵逛簬鍖呭惈涓MySQL鏈嶅姟鍣ㄧ浉鍚岃蒋浠跺寘涓殑鍏变韩搴撶殑鍒嗗彂鐗(渚嬪锛Red Hat Linux)锛屼綘鍙互瀹夎3.23 MySQL-shared RPM锛屾垨浣跨敤MySQL-shared-compat鍖呫

鍙互浣跨敤浠ヤ笅RPM鍖咃細

         MySQL-server-VERSION.i386.rpm

MySQL鏈嶅姟鍣ㄣ備綘闇瑕佽閫夐」锛岄櫎闈炰綘鍙兂杩炴帴杩愯鍦ㄥ彟涓鍙版満鍣ㄤ笂鐨MySQL鏈嶅姟鍣ㄣ 娉ㄩ噴锛氬湪MySQL 4.0.10涔嬪墠锛屾湇鍔″櫒RPM鏂囦欢琚О涓MySQL-VERSION.i386.rpm銆備篃灏辨槸璇达紝鍚嶇О涓笉鍚湁-server

         MySQL-Max-VERSION.i386.rpm

MySQL-Max鏈嶅姟鍣ㄣ傝鏈嶅姟鍣ㄥ叿鏈夊叾瀹冨姛鑳斤紝杩欐槸MySQL-server RPM涓嶅叿澶囩殑銆備綘蹇呴』棣栧厛瀹夎MySQL-server RPM锛屽洜涓MySQL-Max RPM渚濊禆浜庡畠銆

         MySQL-client-VERSION.i386.rpm

鏍囧噯MySQL瀹㈡埛绔▼搴忋備綘鍙兘鎬绘槸瑕佸畨瑁呰杞欢鍖呫

         MySQL-bench-VERSION.i386.rpm

娴嬭瘯鍜屽熀鍑嗐傞渶瑕PerlDBD锛氾細mysql妯″潡銆

         MySQL-devel-VERSION.i386.rpm

搴撳拰鍖呭惈鏂囦欢锛屽鏋滀綘鎯宠缂栬瘧鍏跺畠MySQL瀹㈡埛绔紝渚嬪Perl妯″潡锛屽垯闇瑕併

         MySQL-shared-VERSION.i386.rpm

璇ヨ蒋浠跺寘鍖呭惈鏌愪簺璇█鍜屽簲鐢ㄧ▼搴忛渶瑕佸姩鎬佽杞界殑鍏变韩搴(libmysqlclient.so*)锛屼娇鐢MySQL

         MySQL-shared-compat-VERSION.i386.rpm

璇ヨ蒋浠跺寘鍖呮嫭MySQL 3.23MySQL 4.0鐨勫叡浜簱銆傚鏋滀綘瀹夎浜嗗簲鐢ㄧ▼搴忓姩鎬佽繛鎺MySQL 3.23锛屼絾鏄綘鎯宠鍗囩骇鍒MySQL 4.0鑰屼笉鎯虫墦鐮村簱鐨勪粠灞炲叧绯伙紝鍒欏畨瑁呰杞欢鍖呰屼笉瑕佸畨瑁MySQL-shared銆備粠MySQL 4.0.13璧峰寘鍚瀹夎杞欢鍖呫

         MySQL-embedded-VERSION.i386.rpm

宓屽叆寮MySQL鏈嶅姟鍣ㄥ簱(MySQL 4.0)

         MySQL-VERSION.src.rpm

鍖呭惈浠ュ墠鎵鏈夎蒋浠跺寘鐨勬簮鐮併傚彲鐢ㄦ潵鍦ㄥ叾瀹冩灦鏋勪笂閲嶅缓RPM(渚嬪锛AlphaSPARC)

瑕佹兂鐪嬪埌RPM杞欢鍖呭唴鐨勬墍鏈夋枃浠(渚嬪锛MySQL-server RPM)锛岃繍琛岋細

shell> rpm -qpl MySQL-server-VERSION.i386.rpm

瑕佹兂鎵ц鏍囧噯鏈灏忓畨瑁咃紝杩愯锛

shell> rpm -i MySQL-server-VERSION.i386.rpm
shell> rpm -i MySQL-client-VERSION.i386.rpm

瑕佹兂鍙畨瑁呭鎴风杞欢鍖咃紝杩愯锛

shell> rpm -i MySQL-client-VERSION.i386.rpm

RPM鎻愪緵鍦ㄥ畨瑁呰蒋浠跺寘鍓嶉獙璇佸叾瀹屾暣鎬у拰鐪熷疄鎬х殑鍔熻兘銆傚鏋滀綘瑕佹兂浜嗚В鍏充簬璇ュ姛鑳界殑鏇村淇℃伅锛屽弬瑙2.1.4鑺傦紝鈥滈氳繃MD5鏍¢獙鍜屾垨GnuPG楠岃瘉杞欢鍖呯殑瀹屾暣鎬

鏈嶅姟鍣RPM灏嗘暟鎹斁鍏/var/lib/mysql鐩綍銆RPM杩樹负mysql鐢ㄦ埛鍒涘缓鐧诲綍璐︽埛(濡傛灉杩樻病鏈)锛岀敤鏉ヨ繍琛MySQL鏈嶅姟鍣紝骞跺湪/etc/init.d/鍒涘缓鐩稿簲鏉$洰锛屼互渚垮湪寮曞鏃惰嚜鍔ㄥ惎鍔ㄦ湇鍔″櫒銆(杩欐剰鍛崇潃濡傛灉浣犲凡缁忓畨瑁呭苟涓斿凡缁忔洿鏀瑰惎鍔ㄨ剼鏈紝浣犲彲鑳借澶嶅埗鑴氭湰锛屼互渚夸綘瀹夎鏂RPM鏃 涓嶄細涓㈡帀鑴氭湰)銆傚叧浜庣郴缁熷惎鍔ㄦ椂濡備綍鑷姩鍚姩MySQL鐨勮缁嗕俊鎭紝鍙傝 2.9.2.2鑺傦紝鈥滆嚜鍔ㄥ惎鍔ㄥ拰鍋滄MySQL鈥

濡傛灉鎯宠鍦ㄦ棫鐨勪笉鏀寔/etc/init.d(鐩存帴鎴栭氳繃绗﹀彿杩炴帴)鍒濆鍖栬剼鏈殑Linux鍒嗗彂鐗堜腑瀹夎MySQL RPM锛屼綘搴斿綋鍒涘缓涓涓寚鍚戝垵濮嬪寲鑴氭湰瀹為檯瀹夎鐨勪綅缃殑绗﹀彿杩炴帴銆備緥濡傦紝濡傛灉瀹夎浣嶇疆涓/etc/rc.d/init.d锛屽畨瑁RPM鍓嶄娇鐢ㄨ繖浜涘懡浠ゅ垱寤/etc/init.d锛屼綔涓烘寚鍚戣浣嶇疆鐨勭鍙疯繛鎺ワ細

shell> cd /etc
shell> ln -s rc.d/init.d

鐩墠涓昏Linux鍒嗗彂鐗堝簲褰撴敮鎸佷娇鐢/etc/init.d鐨勬柊鐩綍甯冨眬锛屽洜涓洪渶瑕LSB(Linux鏍囧噯鍩)鍏煎鎬с

濡傛灉浣犲畨瑁呯殑RPM鏂囦欢鍖呮嫭MySQL-server锛屽畨瑁呭悗MySQLd鏈嶅姟鍣ㄥ簲褰撹兘鍚姩骞惰繍琛屻備綘搴斿綋鑳戒娇鐢MySQL鍚姩銆

濡傛灉鍑虹幇闂锛屽彲浠ヤ粠浜岃繘鍒跺畨瑁呴儴鍒嗘壘鍒拌缁嗕俊鎭2.7鑺傦紝鈥滃湪鍏跺畠绫籙nix绯荤粺涓畨瑁匨ySQL鈥

娉ㄩ噴锛MySQL鎺堟潈琛ㄤ腑鐨勮处鎴峰紑濮嬫病鏈夊瘑鐮併傚惎鍔ㄦ湇鍔″櫒鍚庯紝搴斿綋鎸夌収2.9鑺傦紝鈥滃畨瑁呭悗鐨勮缃拰娴嬭瘯鈥涓殑璇存槑涓哄畠浠缃瘑鐮併

2.5.鍦∕ac OS X涓畨瑁匨ySQL

鍙互鍦Mac OS X 10.2.x(Jaguar)鍜屼互涓婄増鏈笂Mac OS X浣跨敤浜岃繘鍒跺畨瑁呰蒋浠跺寘鐨PKG鏍煎紡浠f浛浜岃繘鍒跺垎鍙戠増鏉ュ畨瑁MySQL銆傝娉ㄦ剰璇ヨ蒋浠跺寘涓嶆敮鎸佹棫鐗堟湰鐨Mac OS X(渚嬪锛10.1.x)

瀹夎杞欢鍖呬綅浜庣‖鐩樻槧璞(.dmg)鏂囦欢涓紝蹇呴』棣栧厛鍙屽嚮鎼滅储璧蜂腑鐨勫浘鏍囨潵瀹夎璇ユ枃浠躲傚簲褰撳畨瑁呭浘鍍忓苟鏄剧ず鍏跺唴瀹广

瑕佹兂鑾峰緱MySQL锛屽弬瑙2.1.3鑺傦紝鈥滄庢牱鑾峰緱MySQL鈥

娉ㄩ噴锛鍦ㄧ户缁畨瑁呭墠锛屼竴瀹氳浣跨敤MySQL绠$悊鍣ㄥ簲鐢ㄧ▼搴(Mac OS X鏈嶅姟鍣ㄤ笂)鎴栭氳繃鍛戒护琛岀殑mysqladmin shutdown鍏抽棴鎵鏈夎繍琛MySQL鏈嶅姟鍣ㄥ疄渚嬨

瑕佹兂瀹夎MySQL PKG鏂囦欢锛屽弻鍑昏蒋浠跺寘鍥炬爣銆傚皢鍚姩Mac OS X瀹夎杞欢鍖呭畨瑁呭櫒锛屽皢鎸囧浣犲畬鎴MySQL瀹夎銆

Mac OS X瀹夎杞欢鍖呯殑瀹夎鍣ㄤ腑鏈変竴涓己闄凤紝浣犱細鍦ㄧ洰鏍囩洏閫夋嫨瀵硅瘽妗嗕腑鍙戠幇璇ラ敊璇秷鎭細

You cannot install this software on this disk. (null)

濡傛灉鍑虹幇璇ラ敊璇紝鍙渶瑕佺偣鍑Go Back鎸夐挳杩斿洖鍓嶉潰鐨勭獥鍙c傜劧鍚庣偣鍑Continue鍐嶆閫夋嫨鐩爣鐩橈紝姝ゆ椂搴斿綋鍙互姝g‘鍦伴夋嫨鐩爣鐩樸傛垜浠凡缁忓悜Apple鎶ュ憡浜嗚缂洪櫡锛屽畠姝e湪璋冩煡璇ラ棶棰樸

MySQLMac OS X PKG瀹夎鍒/usr/local/mysql-VERSION锛屽苟涓旇繕浼氬畨瑁呬竴涓鍙疯繛鎺ワ紝/usr/local/mysql锛屾寚鍚戞柊鐨勪綅缃傚鏋滄湁/usr/local/mysql鐩綍锛岄鍏堝皢瀹冩敼鍚嶄负/usr/local/mysql.bak銆傚畨瑁呭畬鍚庯紝瀹夎鍣ㄦ墽琛mysql_install_dbMySQL鏁版嵁搴撲腑鍒涘缓鎺堟潈琛ㄣ

瀹夎甯冨眬涓tar鏂囦欢浜岃繘鍒跺垎鍙戠増绫讳技锛涙墍鏈MySQL浜岃繘鍒朵唬鐮佷綅浜庣洰褰/usr/local/mysql/bin涓傞粯璁ゆ儏鍐碉紝MySQL濂楁帴瀛楁枃浠跺垱寤轰负/tmp/mysql.sock銆傝鍙傝2.1.5鑺傦紝鈥滃畨瑁呭竷灞鈥

MySQL瀹夎闇瑕Mac OS Xmysql鐢ㄦ埛璐︽埛銆傚湪Mac OS X 10.2鍙婁互涓婄増鏈腑锛岄粯璁ゆ儏鍐靛簲瀛樺湪mysql鐢ㄦ埛璐︽埛銆

濡傛灉姝h繍琛Mac OS X鏈嶅姟鍣紝闇瑕佸畨瑁MySQL銆傞殢Mac OS X鏈嶅姟鍣ㄧ増鏈畨瑁呯殑MySQL鐗堟湰濡備笅琛ㄦ墍绀猴細

Mac OS X鏈嶅姟鍣ㄧ増鏈

MySQL鐗堟湰

10.2-10.2.2

3.23.51

10.2.3-10.2.6

3.23.53

10.3

4.0.14

10.3.2

4.0.16

10.4.0

4.1.10a

鏈妭鍙鐩栧畼鏂MySQL Mac OS X PKG鐗堟湰銆備竴瀹氳闃呰Apple鍏充簬MySQL瀹夎鐨勫府鍔╀俊鎭細杩愯鈥甯姪瑙嗗浘鈥濆簲鐢ㄧ▼搴忥紝閫夋嫨鈥Mac OS X鏈嶅姟鍣鈥濆府鍔╋紝鎼滅储鈥MySQL鈥濓紝闃呰鏍囬涓衡瀹夎MySQL鈥濈殑鍐呭銆

瀵逛簬Mac OS X鏈嶅姟鍣ㄤ笂宸茬粡瀹夎鐨MySQL鐗堟湰锛屽鏋滄棭浜4.0锛屽簲鐗瑰埆娉ㄦ剰搴斿綋浣跨敤mysqld_safe鑰屼笉鏄safe_mysqld鏉ュ惎鍔mysqld

濡傛灉浣犲墠闈㈠湪Mac OS X涓婂畨瑁呬簡浠http://www.entropy.ch涓嬭浇鐨Marc LiyanageMySQL杞欢鍖咃紝浣犲彲浠ュ彧浣跨敤璇ラ〉缁欏嚭鐨勪簩杩涘埗瀹夎甯冨眬鎸夌収鏇存柊璇存槑鏉ュ畨瑁呫

濡傛灉浣犱粠Marc3.23.xx 鐗堟湰鎴栦粠Mac OS XMySQL鏈嶅姟鍣ㄧ増鏈崌绾у埌瀹樻柟MySQL PKG锛屼綘杩橀渶瑕佸皢宸叉湁MySQL鎺堟潈琛ㄨ浆鎹负褰撳墠鏍煎紡锛屽洜涓哄凡缁忓姞浜嗚澶氭柊鐨勫畨鍏ㄦ潈闄愩傝鍙傝2.10.2鑺傦紝鈥滃崌绾ф巿鏉冭〃鈥

濡傛灉浣犳兂鍦ㄧ郴缁熷惎鍔ㄨ繃绋嬩腑鑷姩鍚姩MySQL锛屼綘杩橀渶瑕佸畨瑁MySQL Startup Item銆傚湪MySQL 5.1,瀹冩槸Mac OS X瀹夎鐩樻槧鍍忕殑涓閮ㄥ垎锛屾槸涓涓嫭绔嬬殑瀹夎杞欢鍖呫傚彧闇瑕佸弻鍑MySQLStartupItem.鍥炬爣骞舵寜鐓ц鏄庢潵瀹夎銆

璇锋敞鎰Startup Item鍙渶瑕佸畨瑁呬竴娆★紒涓嶉渶瑕佸湪浠ュ悗姣忔鍗囩骇MySQL杞欢鍖呮椂閮藉畨瑁呭畠銆

MySQL 5.1Startup Item瀹夎鍦/Library/StartupItems/MySQLCOM(MySQL 4.1.2浠ュ墠鐨勭増鏈,瀹夎浣嶇疆涓/Library/StartupItems/MySQL锛屼絾涓Mac OS X鏈嶅姟鍣ㄥ畨瑁呯殑MySQL Startup Item鍐茬獊)Startup Item瀹夎鏃跺湪绯荤粺閰嶇疆鏂囦欢/etc/hostconfig涓姞鍏ュ彉閲MySQLCOM=-YES-銆傚鏋滀綘鎯宠disable鑷姩鍚姩MySQL锛屽彧闇瑕佸皢璇ュ彉閲忔洿鏀逛负MySQLCOM=-NO-

Mac OS X鏈嶅姟鍣ㄤ笂锛岄粯璁MySQL瀹夎浣跨敤/etc/hostconfig鏂囦欢涓殑鍙橀噺MySQLMySQL AB Startup Item瀹夎鍣ㄥ皢鍏惰缃负MySQL=-NO-绂佺敤璇ュ彉閲忋傝繖鏍峰彲浠ラ伩鍏嶅惎鍔ㄦ椂闂翠笌MySQL AB Startup Item浣跨敤鐨MySQLCOM鍙橀噺鍐茬獊銆備絾鏄紝涓嶄細鍏抽棴杩愯鐨MySQL鏈嶅姟鍣ㄣ備綘搴斿綋鑷繁鍏抽棴銆

瀹夎瀹屽悗锛屽彲浠ュ湪缁堢绐楀彛杩愯涓嬮潰鐨勫懡浠ゆ潵鍚姩MySQL銆備綘蹇呴』鍏锋湁绠$悊鍛樻潈闄愭潵鎵ц璇ヤ换鍔°

濡傛灉浣犲凡缁忓畨瑁呯殑Startup Item

shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start

(Enter your password, if necessary)

(Press Control-D or enter "exit" to exit the shell)

濡傛灉涓嶄娇鐢Startup Item锛岃緭鍏ヤ笅闈㈢殑鍛戒护搴忓垪锛

shell> cd /usr/local/mysql

shell> sudo ./bin/mysqld_safe

(Enter your password, if necessary)

(Press Control-Z)

shell> bg

(Press Control-D or enter "exit" to exit the shell)

浣犲簲褰撹兘澶熻繛鎺MySQL鏈嶅姟鍣紝渚嬪锛岄氳繃杩愯/usr/local/mysql/bin/mysql鏉ヨ繛鎺ャ

娉ㄩ噴锛MySQL鎺堟潈琛ㄤ腑鐨勮处鎴峰紑濮嬫病鏈夊瘑鐮併傚惎鍔ㄦ湇鍔″櫒鍚庯紝搴斿綋鎸夌収2.9鑺傦紝鈥滃畨瑁呭悗鐨勮缃拰娴嬭瘯鈥涓殑璇存槑鏉ヨ缃瘑鐮併

浣犲彲浠ヤ负澶栧3婧愭枃浠惰捣涓涓埆鍚嶏紝浣垮畠鏇村鏄撹闂父鐢ㄧ殑绋嬪簭锛屼緥濡備粠鍛戒护琛岃繍琛mysqlmysqladmintcsh璇硶涓猴細

aliasMySQL /usr/local/mysql/bin/mysql
aliasMySQLadmin /usr/local/mysql/bin/mysqladmin

瀵逛簬bash锛屼娇鐢細

aliasMySQL=/usr/local/mysql/bin/mysql
aliasMySQLadmin=/usr/local/mysql/bin/mysqladmin

鏈濂芥槸鍦PATH鐜鍙橀噺涓姞鍏/usr/local/mysql/bin銆備緥濡傦紝濡傛灉澶栧3鍛戒护鏄tcsh锛屽湪$HOME/.tcshrc鏂囦欢涓姞鍏ヤ笅闈竴琛岋細

setenv PATH ${PATH}:/usr/local/mysql/bin

濡傛灉鏍圭洰褰曚腑娌℃湁.tcshrc鏂囦欢锛屽垯鐢ㄦ枃鏈紪杈戝櫒鍒涘缓璇ユ枃浠躲

濡傛灉浣犲宸叉湁鐨勫畨瑁呰繘琛屽崌绾э紝璇锋敞鎰忓畨瑁呮柊MySQL PKG鏃朵笉浼氬嵏杞芥棫鐨勫畨瑁呯洰褰曘傞仐鎲剧殑鏄紝Mac OS X瀹夎鍣ㄥ皻鏈彁渚涘姛鑳芥潵姝g‘鍗囩骇鍓嶉潰瀹夎鐨勮蒋浠跺寘銆

瑕佹兂鍦ㄦ柊瀹夎涓娇鐢ㄥ凡鏈夌殑鏁版嵁搴擄紝浣犻渶瑕佸皢鏃ф暟鎹洰褰曚腑鐨勫唴瀹瑰鍒跺埌鏂扮殑鏁版嵁鐩綍銆傛墽琛岃鎿嶄綔鏃讹紝纭繚鍏抽棴鏂般佹棫鏈嶅姟鍣ㄣ傚皢浠ュ墠瀹夎鐨MySQL鏁版嵁搴撴枃浠舵嫹璐濊繃鏉ュ苟鎴愬姛鍚姩鏂扮殑鏈嶅姟鍣ㄥ悗锛屽簲褰撳嵏杞芥棫鐨勬枃浠朵互鑺傜渷纭洏绌洪棿銆傚苟涓旓紝杩樺簲褰撳嵏鎺変綅浜/Library/Receipts/mysql-VERSION.pkg鐨勬棫鐗堟湰Package Receipt鐩綍銆

2.6.聽鍦∟etWare涓畨瑁匨ySQL

MySQL瑁呭叆鍒NetWare棣栧厛鐢Novell瀹炵幇銆Novell瀹㈡埛搴斿綋婊℃剰锛NetWare 6.5涓崋缁戜簡SQL浜岃繘鍒讹紝骞跺叿鏈夎嚜鍔ㄥ晢涓氫娇鐢ㄨ鍙紝鐢ㄤ簬杩愯璇ョ増鏈NetWare鐨勬墍鏈夋湇鍔″櫒銆

NetWareMySQL浣跨敤NetWareMetrowerks CodeWarrior鍜屼笓鐢ㄨ法缂栬瘧鐗GNU鑷姩宸ュ叿缂栬瘧鑰屾垚銆

鍙互浠http://dev.mysql.com/downloads/鑾峰緱鏈鏂扮殑浜岃繘鍒惰蒋浠跺寘NetWare銆傝鍙傝2.1.3鑺傦紝鈥滄庢牱鑾峰緱MySQL鈥

涓轰簡浣MySQL椹荤暀鍦ㄤ富鏈轰笂锛NetWare鏈嶅姟鍣ㄥ繀椤绘弧瓒充互涓嬭姹傦細

         瀹夎鐨NetWare 6.5 NetWare 6.0Latest Support Pack锛堟渶鏂版敮鎸佽ˉ涓侊級銆

         绯荤粺蹇呴』婊¤冻Novell鐨勬渶浣庤姹備互杩愯鐩稿叧鐗堟湰鐨NetWare

         MySQL鏁版嵁鍙婂叾浜岃繘鍒讹紝蹇呴』瀹夎鍒NSS鍗峰唴锛涗笉鏀寔浼犵粺鍗枫

瑕佹兂鍦NetWare涓嬪畨瑁MySQL锛岄伒浠庝笅闈㈢殑姝ラ锛

1.    濡傛灉浣犲鍓嶉潰鐨勫畨瑁呰繘琛屽崌绾э紝鍋滄MySQL鏈嶅姟鍣ㄣ傚簲浣跨敤涓嬮潰鐨勫懡浠や粠鏈嶅姟鍣ㄦ帶鍒跺彴瀹屾垚锛

2.            SERVER:  mysqladmin -u root shutdown

3.    浠庡鎴风鐧诲綍鍒扮洰鏍囨湇鍔″櫒涓婏紝璁块棶瀹夎MySQL鐨勪綅缃

4.    灏嗕簩杩涘埗杞欢鍖Zip鏂囦欢鎻愬彇鍒版湇鍔″櫒涓娿備竴瀹氳浣跨敤Zip鏂囦欢涓殑璺緞銆傜畝鍗曞湴灏嗘枃浠舵彁鍙栧埌SYS\鏄緢瀹夊叏鐨勩

濡傛灉浣犱粠鍓嶉潰鐨勫畨瑁呭崌绾э紝浣犲彲鑳介渶瑕佸鍒舵暟鎹洰褰(渚嬪锛SYS:MYSQL\DATA)my.cnf锛堝鏋滀綘宸茬粡瀹氬埗锛夈傜劧鍚庝綘鍙互鍒犻櫎鏃х増鏈殑MySQL

5.    浣犲彲浠ュ皢鐩綍閲嶆柊鍛藉悕涓烘洿鍔犱竴鑷村拰鏄撲簬浣跨敤鐨勫悕绉般傚湪鏈墜鍐岀殑渚嬪瓙涓娇鐢SYSMYSQL鏉ユ寚鍚戝畨瑁呯洰褰曘

璇锋敞鎰忓湪NetWare涓婂畨瑁MySQL涓嶄細妫娴嬪埌鏄惁宸茬粡瀹夎浜NetWare鍙戝竷涔嬪鐨MySQL鐗堟湰銆傚洜姝わ紝濡傛灉浣犲凡缁忓湪SYS\MYSQL瀹夎浜嗕粠缃戠珯涓婁笅杞界殑鏈鏂MySQL鐗堟湰(渚嬪锛MySQL 4.1鎴栨洿鏂扮増鏈)锛屽湪鍗囩骇NetWare鏈嶅姟鍣ㄤ箣鍓嶏紝蹇呴』閲嶆柊鍛藉悕鏂囦欢澶癸紱鍚﹀垯锛SYS\MySQL涓殑鏂囦欢浼氳NetWare Support Pack涓殑鐗堟湰鎵瑕嗙洊銆

6.    鍦ㄦ湇鍔″櫒鎺у埗鍙颁腑锛屽姞鍏ュ惈鏈 MySQL NLM鐨勭洰褰曠殑鎼滅储璺緞銆備緥濡傦細

7.            SERVER:  SEARCH ADD SYS:MYSQL\BIN

8.    鍒濆鍖栨暟鎹洰褰曞拰鎺堟潈琛紝濡傛灉闇瑕侊紝搴斿湪鏈嶅姟鍣ㄦ帶鍒跺彴鎵цmysql_install_db

9.    鍦ㄦ湇鍔″櫒鎺у埗鍙颁娇鐢mysqld_safe鍚姩MySQL鏈嶅姟鍣ㄣ

10.瑕佸畬鎴愬畨瑁咃紝杩樺簲褰撳湪autoexec.ncf涓姞鍏ヤ互涓嬪懡浠ゃ備緥濡傦紝濡傛灉MySQL瀹夎鍦SYSMYSQL涓紝浣犳兂璁MySQL鑷姩鍚姩锛屽彲浠ュ姞鍏ヤ互涓嬭锛

11.         #Starts the MySQL 5.1.x database server
12.        SEARCH ADD SYS:MYSQL\BIN
13.        MYSQLD_SAFE

濡傛灉MySQL杩愯鍦NetWare 6.0,鎴戜滑寮虹儓寤鸿浣犲湪鍛戒护琛屼腑浣跨敤--skip-external-locking閫夐」锛

#Starts the MySQL 5.1.x database server
SEARCH ADD SYS:MYSQL\BIN
MYSQLD_SAFE --skip-external-locking

杩橀渶瑕佷娇鐢CHECK TABLEREPAIR TABLE鏉ユ浛浠myisamchk锛屽洜涓myisamchk浣跨敤澶栭儴閿併傚凡缁忕煡閬撳閮ㄩ攣鍦NetWare 6.0涓湁闂锛涘湪NetWare 6.5涓凡缁忚В鍐充簡璇ラ棶棰樸

NetWare涓殑mysqld_safe鎻愪緵浜嗙獥鍙d繚鐣欏姛鑳姐傚綋鍗歌浇(鍏抽棴)mysqld_safe NLM鏃讹紝榛樿鎯呭喌绐楀彛涓嶄細娑堝け銆傜浉鍙嶏紝浼氭彁绀虹敤鎴疯緭鍏ワ細

*<NLM has terminated; Press any key to close the screen>*

濡傛灉浣犳兂璁NetWare鑷姩鍏抽棴绐楀彛锛屽湪mysqld_safe浣跨敤--autoclose閫夐」銆備緥濡傦細

#Starts the MySQL 5.1.x database server
SEARCH ADD SYS:MYSQL\BIN
MYSQLD_SAFE --autoclose

14.褰撻娆″畨瑁呮垨浠庡墠闈㈢殑鐗堟湰鍗囩骇MySQL 5.1鐗堟椂锛屽簲涓嬭浇骞跺畨瑁呮渶鏂扮殑鐩稿簲Perl妯″潡鍜PHP鎵╁睍鍚嶏細

         Perl for NetWare: http://forge.novell.com/modules/xfcontent/downloads.php/perl/Modules/

         PHP for NetWare: http://forge.novell.com/modules/xfcontent/downloads.php/php/Modules/

 (MySQL 4.1PHP 5鎵╁睍鍚嶉傜敤浜MySQL 5.1)

5.1.3鑺傦紝鈥渕ysqld_safe锛歁ySQL鏈嶅姟鍣ㄥ惎鍔ㄨ剼鏈涓缁嗘弿杩颁簡NetWare涓殑mysqld_safe鐨勮涓恒

濡傛灉鏈嶅姟鍣ㄤ笂宸茬粡瀹夎浜MySQL锛屼竴瀹氳妫鏌autoexec.ncf涓凡鏈夌殑MySQL鍚姩鍛戒护锛屽鏋滈渶瑕佸垯缂栬緫鎴栧垹闄よ繖浜涘懡浠ゃ

娉ㄩ噴锛MySQL鎺堟潈琛ㄤ腑鐨勫垵濮嬭处鎴锋病鏈夊瘑鐮併傚惎鍔ㄦ湇鍔″櫒鍚庯紝浣犲簲褰撲娇鐢2.9鑺傦紝鈥滃畨瑁呭悗鐨勮缃拰娴嬭瘯鈥涓殑璇存槑鏉ヨ缃瘑鐮併

2.7.聽鍦ㄥ叾瀹冪被Unix绯荤粺涓畨瑁匨ySQL

鏈妭浠嬬粛鍦ㄥ悇绉嶅钩鍙颁笂瀹夎tar鍘嬬缉鏂囦欢鏍煎紡鐨MySQL浜岃繘鍒跺垎鍙戠増(鏂囦欢鏈.tar.gz 鎵╁睍鍚)銆傝缁嗙洰褰曞弬瑙2.1.2.5鑺傦紝鈥淢ySQL AB缂栬瘧鐨凪ySQL浜岃繘鍒剁増鏈

瑕佹兂鑾峰緱MySQL锛屽弬瑙2.1.3鑺傦紝鈥滄庢牱鑾峰緱MySQL鈥

MySQLtar鏂囦欢浜岃繘鍒跺垎鍙戠増鐨勬枃浠跺悕鏍煎紡涓mysql-VERSION-OS.tar.gz锛屽叾涓VERSION鏄増鏈彿(渚嬪锛5.1.2-alpha)OS琛ㄧず鍒嗗彂鐗堝畨瑁呯殑鎿嶄綔绯荤粺绫诲瀷(渚嬪锛pc-linux-i686)

闄や簡杩欎簺閫氱敤杞欢鍖咃紝鎴戜滑杩樹负鍚勫钩鍙版彁渚涗簡鍏蜂綋鐨勪簩杩涘埗瀹夎杞欢鍖呫傚叧浜庡浣曞畨瑁呯殑璇︾粏淇℃伅鍙傝2.2鑺傦紝鈥滀娇鐢ㄤ簩杩涘埗鍒嗗彂鐗堢殑鏍囧噯MySQL瀹夎鈥

浣犻渶瑕佷笅闈㈢殑宸ュ叿鏉ュ畨瑁MySQL tar鏂囦欢浜岃繘鍒跺垎鍙戠増锛

         GNU gunzip瑙e帇缂╁垎鍙戠増銆

         涓涓傚綋鐨tar瑙e寘鍒嗗彂鐗堛 GNU tar宸茬煡鍙互銆備竴浜涙搷浣滅郴缁熶腑鍚湁棰勫畨瑁呯殑tar锛屽凡鐭ユ湁闂銆備緥濡傦紝宸茬煡Mac OS X tarSun tar瀵逛簬闀挎枃浠跺悕鏈夐棶棰樸傚湪Mac OS X涓紝浣犲彲浠ヤ娇鐢ㄩ瀹夎鐨gnutar绋嬪簭銆傚湪鍏跺畠绯荤粺涓嫢tar涓嶅畬鍠勶紝浣犲簲褰撻鍏堝畨瑁GNU tar

濡傛灉浣犻亣鍒伴棶棰橈紝鍦ㄦ妸闂瀵勫埌MySQL閭欢鐩綍鏃讹紝璇蜂竴瀹氫娇鐢mysqlbug锛屽氨绠楅棶棰樹笉鏄竴涓己闄凤紝mysqlbug涔熶細鏀堕泦绯荤粺淇℃伅锛屽皢鏈夊姪浜庡叾瀹冧汉瑙e喅浣犵殑闂銆備笉浣跨敤mysqlbug锛屼綘灏嗗噺灏戝緱鍒颁綘闂鐨勪竴涓В鍐虫柟妗堢殑鍙兘鎬э紒鍦ㄤ綘瑙e寘鍒嗗彂鐗堝悗锛屼綘浼鍦ㄢbin鐩綍涓嬫壘鍒mysqlbug銆傝鍙傝1.7.1.3鑺傦紝鈥滃浣曢氭姤缂洪櫡鍜岄棶棰樷

蹇呴』鎵ц浠ヤ究瀹夎骞朵娇鐢MySQL浜岃繘鍒跺垎鍙戠増鐨勫熀鏈懡浠ゆ槸锛

shell> groupadd mysql

shell> useradd -g mysql mysql

shell> cd /usr/local

shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -

shell> ln -s full-path-to-mysql-VERSION-OS mysql

shell> cd mysql

shell> scripts/mysql_install_db --user=mysql

shell> chown -R root  .

shell> chown -R mysql data

shell> chgrp -R mysql .

shell> bin/mysqld_safe --user=mysql &

娉ㄩ噴锛璇ヨ繃绋嬫湭璁剧疆MySQL璐︽埛鐨勫瘑鐮併傚畬鎴愪笅闈㈢殑杩囩▼鍚庯紝缁х画鎵ц鎯2.9鑺傦紝鈥滃畨瑁呭悗鐨勮缃拰娴嬭瘯鈥

涓嬮潰涓哄畨瑁呬簩杩涘埗鍒嗗彂鐗堢殑鏇磋缁嗙殑鎻忚堪锛

1.    mysqld澧炲姞涓涓櫥褰曠敤鎴峰拰缁勶細

2.            shell> groupadd mysql

3.            shell> useradd -g mysql mysql

杩欎簺鍛戒护灏嗗鍔MySQL缁勫拰MySQL鐢ㄦ埛銆備笉鍚岀増鏈殑Unix涓紝useraddgroupadd鐨勮娉曞彲鑳戒細绋嶆湁涓嶅悓銆傝繕鍙互绉颁负adduseraddgroup

浣犲彲鑳戒細灏嗚繖浜涚敤鎴峰拰缁勫懡鍚嶄负mysql涔嬪鐨勫悕绉般傚鏋滄槸杩欐牱锛屽湪涓嬮潰鐨勬楠や腑鏇挎崲涓虹浉搴旂殑鍚嶇О銆

4.    鎸戦変竴涓綘鎯宠В寮鍒嗗彂鍖呯殑鐩綍锛岃繘鍏ヨ鐩綍銆傚湪涓嬮潰鐨勪緥瀛愪腑锛屾垜浠皢鍒嗗彂瑙e寘鍦ㄢ/usr/local鈥濅笅锛堝洜姝わ紝涓嬪垪璇存槑鍋囪浣犳湁鏉冮檺鍦ㄢ/usr/local鈥濅腑鍒涘缓鏂囦欢鍜岀洰褰曪紝濡傛灉璇ョ洰褰曡淇濇姢锛屼綘闇瑕佷互root瀹炴柦瀹夎锛

5.            shell> cd /usr/local

6.    2.1.3鑺傦紝鈥滄庢牱鑾峰緱MySQL鈥涓垪鍑虹殑绔欑偣涔嬩竴鑾峰緱涓涓垎鍙戞枃浠躲傚浜庝竴涓粰瀹氱殑鐗堟湰锛屾墍鏈夊钩鍙扮殑浜岃繘鍒跺垎鍙戠増鍧囦粠鐩稿悓鐨MySQL婧愮爜鍒嗗彂鐗堟瀯寤恒

7.    瑙e寘鍒嗗彂鐗堬紝灏嗗垱寤哄畨瑁呯洰褰曘傜劧鍚庣敓鎴愬埌璇ョ洰褰曠殑涓涓鍙烽摼鎺ワ細

8.            shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -

9.            shell> ln -s full-path-to-mysql-VERSION-OS mysql

tar鍛戒护鍒涘缓mysql-VERSION-OS鐩綍銆ln鍛戒护鐢熸垚鍒拌鐩綍鐨勪竴涓鍙烽摼鎺ャ傝繖璁╀綘鏇村鏄撳湴鎶婂畨瑁呯洰褰曟寚瀹氫负/usr/local/mysql

浣跨敤GNU tar锛屽垯涓嶅啀闇瑕gunzip銆傚彲浠ョ敤涓嬮潰鐨勫懡浠ゆ浛鎹㈢涓琛屾潵瑙e寘鍜屾彁鍙栧垎鍙戠増锛

shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz

10.杩涘叆瀹夎鐩綍锛

11.       shell> cd mysql

浣犱細鍦mysql鐩綍涓嬪彂鐜板嚑涓枃浠跺拰瀛愮洰褰曪紝瀵瑰畨瑁呯洰鐨勬渶閲嶈鐨勬槸鈥bin鈥濆拰鈥scripts鈥濆瓙鐩綍銆

         bin

杩欎釜鐩綍鍖呭惈瀹㈡埛绔▼搴忓拰鏈嶅姟鍣紝浣犲簲璇ユ妸杩欎釜鐩綍鐨勫畬鏁磋矾寰勫姞鍒PATH鐜鍙橀噺锛屼互渚shell鑳芥纭殑鎵惧埌MySQL绋嬪簭銆傝鍙傝闄勫綍F锛鐜鍙橀噺

         scripts

杩欎釜鐩綍鍖呭惈mysql_install_db鑴氭湰锛岀敤鏉ュ垵濮嬪寲mysql鏁版嵁搴撶殑 鎺堟潈琛紝鍏朵腑璐瓨浜嗘湇鍔″櫒璁块棶鍏佽銆

12.濡傛灉杩樻病鏈夊畨瑁MySQL锛屽繀椤诲垱寤MySQL鎺堟潈琛細

13.        shell> scripts/mysql_install_db --user=mysql

濡傛灉浣犵敤root杩愯鍛戒护锛屽簲褰撲娇鐢--user閫夐」銆傞夐」鐨勫煎簲涓庝綘鍦ㄧ涓姝ヤ负杩愯鏈嶅姟鍣ㄦ墍鍒涘缓鐨勭櫥褰曡处鎴风浉鍚屻傚鏋滀綘鐢ㄨ鐢ㄦ埛鐧诲綍鏉ヨ繍琛屽懡浠わ紝鍙互鐪佺暐--user閫夐」銆

鍒涘缓鎴栧崌绾ф巿鏉冭〃鍚庯紝闇瑕佹墜鍔ㄩ噸鏂板惎鍔ㄦ湇鍔″櫒銆

14.灏嗙▼搴忎簩杩涘埗鐨勬墍鏈夋潈鏀逛负root鏁版嵁鐩綍鐨勬墍鏈夋潈鏀逛负杩愯mysqld 鐨勭敤鎴枫傚鏋滀綅浜庡畨瑁呯洰褰(/usr/local/mysql)涓嬶紝鍛戒护搴斾负锛

15.        shell> chown -R root  .

16.        shell> chown -R mysql data

17.        shell> chgrp -R mysql .

绗竴涓懡浠ゅ皢鏂囦欢鐨勬墍鏈夊睘鎬ф敼涓root鐢ㄦ埛銆傜浜屼釜鍛戒护灏嗘暟鎹洰褰曠殑鎵鏈夊睘鎬ф敼涓mysql鐢ㄦ埛銆傜涓変釜鍛戒护灏嗙粍灞炴ф敼涓mysql缁勩

18.濡傛灉浣犲枩娆㈠湪寮曞鏈哄櫒鏃惰嚜鍔ㄥ惎鍔MySQL锛屽彲浠ユ嫹璐support-files/mysql.server鏂囦欢鍒扮郴缁熸湁鍚姩鏂囦欢鐨勫湴鏂广傛洿澶氱殑淇℃伅鍙互鍦support-files/mysql.server鑴氭湰涓拰2.9.2.2鑺傦紝鈥滆嚜鍔ㄥ惎鍔ㄥ拰鍋滄MySQL鈥涓壘鍒般

19.濡傛灉瀹夎浜DBIDBD::mysql Perl妯″潡锛屽彲浠ヤ娇鐢bin/mysql_setpermission鑴氭湰澧炲姞鏂拌处鎴枫傚叧浜庤鏄庯紝鍙傝 2.13鑺傦紝鈥淧erl瀹夎娉ㄦ剰浜嬮」鈥

20.濡傛灉浣犳兂浣跨敤mysqlaccess鑰屽湪鏌愪釜闈炴爣鍑嗙殑鍦扮偣鏈MySQL鍒嗗彂鐗堬紝浣犲繀椤绘敼鍙樺湴鐐癸紝鍦ㄩ偅鍎mysqlaccess鏈熸湜鎵惧埌mysql瀹㈡埛绔傜紪杈戔bin/mysqlaccess鈥濊剼鏈紝澶х害鍦ㄧ18琛岋紝瀵绘壘绫讳技涓嬮潰鐨勮锛

21.          $MYSQL     = '/usr/local/bin/mysql';    # path to mysql executable

鏀瑰彉璺緞浠ュ弽鏄犲嚭mysql瀹為檯瀛樺偍鍦ㄤ綘绯荤粺涓婄殑鍦扮偣銆傚鏋滀笉杩欐牱鍋氾紝褰撹繍琛mysqlaccess鏃讹紝浣犲皢閬囧埌涓涓broken pipe鐨勯敊璇

鍦ㄦ墍鏈変笢瑗胯瑙e寘骞朵笖瀹夎浠ュ悗锛屼綘搴旇鍒濆鍖栧苟涓旀祴璇曚綘鐨勫垎鍙戠増銆

鍙互鐢ㄤ笅鍒楀懡浠ゅ惎鍔MySQL鏈嶅姟鍣細

shell> bin/mysqld_safe --user=mysql &

鍏充簬mysqld_safe鐨勮缁嗕俊鎭弬瑙5.1.3鑺傦紝鈥渕ysqld_safe锛歁ySQL鏈嶅姟鍣ㄥ惎鍔ㄨ剼鏈

娉ㄩ噴锛MySQL鎺堟潈琛ㄤ腑鐨勮处鎴峰紑濮嬫病鏈夊瘑鐮併傚惎鍔ㄦ湇鍔″櫒鍚庯紝搴斿綋浣跨敤2.9鑺傦紝鈥滃畨瑁呭悗鐨勮缃拰娴嬭瘯鈥涓殑璇存槑鏉ヨ缃瘑鐮併

2.8. 浣跨敤婧愮爜鍒嗗彂鐗堝畨瑁匨ySQL

瀹夎婧愮爜涔嬪墠锛岄鍏堟鏌ユ垜浠殑浜岃繘鍒舵槸鍚﹂傚悎浣犵殑骞冲彴锛屾槸鍚﹀彲浠ュ伐浣溿傛垜浠仛浜嗗ぇ閲忕殑宸ヤ綔纭繚鎴戜滑鐨勪簩杩涘埗鐢ㄦ渶鍚堥傜殑閫夐」鏉ユ瀯寤恒

瑕佽幏寰MySQLa 婧愮爜鍒嗗彂鐗堬紝鍙傝2.1.3鑺傦紝鈥滄庢牱鑾峰緱MySQL鈥

MySQL婧愮爜鍒嗗彂鐗堜负tar鍘嬬缉鏂囦欢锛屾枃浠跺悕鏍煎紡涓mysql-VERSION.tar.gz锛屽叾涓 VERSION鏄増鏈彿锛屼緥濡5.1.2-alpha

浣犻渶瑕佷笅鍒楀伐鍏锋瀯閫犲苟瀹夎MySQL婧愮爜锛

         GNU gunzip瑙e帇缂╄鍒嗗彂鐗堛

         涓涓傚綋鐨tar瑙e寘鍒嗗彂鐗堛GNU tar宸茬煡鍙互銆備竴浜涙搷浣滅郴缁熶腑鍚湁棰勫畨瑁呯殑tar锛屽凡鐭ユ湁闂銆備緥濡傦紝宸茬煡Mac OS X tarSun tar瀵逛簬闀挎枃浠跺悕鏈夐棶棰樸傚湪Mac OS X涓紝浣犲彲浠ヤ娇鐢ㄩ瀹夎鐨gnutar绋嬪簭銆傚湪鍏跺畠绯荤粺涓嫢tar涓嶅畬鍠勶紝浣犲簲褰撻鍏堝畨瑁GNU tar

         涓涓兘宸ヤ綔鐨ANSI C++缂栬瘧鍣ㄣgcc> = 2.95.2egcs> = 1.0.2egcs 2.91.66SGI C++SunPro C++鏄竴浜涘凡鐭ヨ兘宸ヤ綔鐨勭紪璇戝櫒銆傚綋浣跨敤gcc鏃讹紝涓嶉渶瑕libg++gcc2.7.x鏈変竴涓己闄凤紝浣垮緱瀹冨彲鑳戒笉鑳界紪璇戜竴浜涘畬鍏ㄥ悎娉曠殑C++鏂囦欢锛屼緥濡傗sql/sql_base.cc鈥濄傚鏋滀綘浠呮湁gcc2.7.x锛屼綘蹇呴』鍗囩骇gcc鎵嶈兘缂栬瘧MySQL銆傚凡鐭gcc 2.8.1鍦ㄦ煇浜涘钩鍙颁笂鏈変竴浜涢棶棰橈紝鍥犳濡傛灉骞冲彴涓婃湁鏂扮殑缂栬瘧鍣紝鍒欎笉瑕佷娇鐢gcc 2.8.1

缂栬瘧MySQL 3.23.x鏃讹紝寤鸿浣跨敤gcc 2.95.2鎴栨洿鏂扮増銆

         涓涓紭绉鐨make绋嬪簭銆傛绘槸鎺ㄨ崘GNU make涓旀湁鏃跺繀椤讳娇鐢ㄣ傚鏋滀綘鏈夐棶棰鎴戜滑鎺ㄨ崘璇曚竴璇GNU make3.75鎴栨洿鏂扮増

濡傛灉浣犱娇鐢ㄧ殑gcc鐗堟湰瓒冲鏂帮紝鍙互璇嗗埆-fno-exceptions閫夐」锛屽垯浣跨敤璇ラ夐」闈炲父閲嶈銆傚惁鍒欙紝浣犵紪璇戜簩杩涘埗鏃跺嚭鐜伴棶棰樸傛垜浠缓璁綘鍚屾椂浣跨敤-felide-constructors-fno-rtti閫夐」銆傚綋鏈夌枒闂椂锛屾墽琛屼笅闈㈡搷浣滐細

CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
       -fno-exceptions -fno-rtti" ./configure \
       --prefix=/usr/local/mysql --enable-assembler \
       --with-mysqld-ldflags=-all-static

鍦ㄥぇ澶氭暟绯荤粺涓紝鍙互寰楀埌蹇熴佺ǔ瀹氱殑浜岃繘鍒躲

濡傛灉浣犻亣鍒伴棶棰橈紝鍦ㄦ妸闂閭瘎鍒MySQL閭欢鐩綍鏃讹紝璇锋绘槸浣跨敤mysqlbug锛屽氨绠楅棶棰樹笉鏄竴涓己闄凤紝mysqlbug鏀堕泦绯荤粺淇℃伅锛屽皢鏈夊姪浜庡叾瀹冧汉瑙e喅浣犵殑闂銆備笉浣跨敤mysqlbug锛屼綘灏嗗噺灏戝緱鍒伴棶棰樼殑瑙e喅鏂规鐨勫彲鑳芥э紒鍦ㄨВ鍖呭垎鍙戠増鍚庯紝浣犱細鍦ㄢbin鐩綍涓嬫壘鍒mysqlbug銆傝鍙傝1.7.1.3鑺傦紝鈥滃浣曢氭姤缂洪櫡鍜岄棶棰樷

2.8.1. 婧愮爜瀹夎姒傝堪

浣犲繀椤绘墽琛岀殑瀹夎MySQL婧愮爜鍒嗗彂鐗堢殑鍩烘湰鍛戒护鏄細

shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db --user=mysql
shell> chown -R root  .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &

濡傛灉浠庝竴涓簮鐮RPM寮濮嬶紝閭d箞鎵ц濡備笅鍛戒护锛

shell> rpmbuild --rebuild --clean MySQL-VERSION.src.rpm

杩欐牱浣犲埗浣滀竴涓彲浠ュ畨瑁呯殑浜岃繘鍒RPM銆傚浜庢棫鐗堟湰鐨RPM锛屼綘鍙兘闇瑕佹浛鎹㈢敤rpm鏇挎崲鍛戒护rpmbuild

娉ㄩ噴锛璇ヨ繃绋嬩笉涓轰换浣MySQL璐︽埛璁剧疆瀵嗙爜銆傚畬鎴愪笅闈㈢殑杩囩▼鍚庯紝鏍规嵁2.9鑺傦紝鈥滃畨瑁呭悗鐨勮缃拰娴嬭瘯鈥杩涜瀹夎鍚庣殑璁剧疆鍜屾祴璇曘

浠ヤ笅鏄畨瑁MySQL婧愮爜鍒嗗彂鐗堢殑鏇磋缁嗙殑鎻忚堪锛

1.    mysqld澧炲姞涓涓櫥褰曠敤鎴峰拰缁勶細

2.            shell> groupadd mysql
3.            shell> useradd -g mysql mysql

杩欎簺鍛戒护灏嗗鍔MySQL缁勫拰 MySQL鐢ㄦ埛銆備笉鍚岀増鏈殑Unix涓紝useradd groupadd鐨勮娉曞彲鑳戒細绋嶆湁涓嶅悓銆傝繕鍙互绉颁负adduseraddgroup

浣犲彲鑳戒細灏嗚繖浜涚敤鎴峰拰缁勫懡鍚嶄负mysql涔嬪鐨勫悕绉般傚鏋滄槸杩欐牱锛屽湪涓嬮潰鐨勬楠や腑鏇挎崲涓虹浉搴旂殑鍚嶇О銆

4.    鎸戦変竴涓綘鎯宠В寮鍒嗗彂鍖呯殑鐩綍锛岃繘鍏ヨ鐩綍銆

5.    2.1.3鑺傦紝鈥滄庢牱鑾峰緱MySQL鈥涓垪鍑虹殑绔欑偣涔嬩竴鑾峰緱涓涓垎鍙戞枃浠躲

6.    鍦ㄥ綋鍓嶇洰褰曚笅瑙e寘鍒嗗彂鐗堬細

7.            shell> gunzip < /path/to/mysql-VERSION.tar.gz | tar xvf -

璇ュ懡浠ゅ垱寤mysql-VERSION 鐩綍銆

浣跨敤GNU tar锛屽垯涓嶅啀闇瑕gunzip銆備綘鍙互鐢ㄤ笅闈㈢殑鍛戒护鏉ヨВ鍖呭拰鎻愬彇鍒嗗彂锛

shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz

8.    杩涘叆瑙e寘鍒嗗彂鐗堢殑椤剁骇鐩綍锛

9.            shell> cd  mysql-VERSION

璇锋敞鎰忕洰鍓嶅繀椤讳粠椤剁骇鐩綍閰嶇疆鍜屾瀯寤MySQL銆備綘涓嶈兘鍦ㄥ叾瀹冪洰褰曚腑鏋勫缓銆

10.閰嶇疆鍙戝竷鐗堝苟涓旂紪璇戯細

11.        shell> ./configure --prefix=/usr/local/mysql
12.        shell> make

褰撲綘杩愯configure鏃讹紝浣犲彲鑳芥兂瑕佹寚瀹氫竴浜涢夐」锛岃繍琛./configure --help寰楀埌涓涓夐」鍒楄〃銆2.8.2鑺傦紝鈥滃吀鍨嬮厤缃夐」璁ㄨ涓浜涘緢鏈夌敤鐨勯夐」銆

濡傛灉configure澶辫触锛屼綘灏嗗悜MySQL閭欢鐩綍鍙戦佸寘鍚綘璁や负鑳藉府浣犺В鍐宠闂鐨勫寘鍚config.log鈥濅腑鎵鏈夎鐨勯偖浠讹紝涔熻鍖呮嫭configure鐨勬渶鍚庡嚑琛岃緭鍑恒傜敤mysqlbug鑴氭湰閭瘎閿欒鎶ュ憡銆傝鍙傝1.7.1.3鑺傦紝鈥滃浣曢氭姤缂洪櫡鍜岄棶棰樷

濡傛灉缂栬瘧澶辫触锛屽弬瑙2.8.4鑺傦紝鈥滃鐞哅ySQL缂栬瘧闂鈥瀵绘眰甯姪銆

13.瀹夎鍒嗗彂鐗堬細

14.        shell> make install

濡傛灉浣犳兂瑕佽缃竴涓夐」鏂囦欢锛屼娇鐢support-files鐩綍涓殑涓涓綔涓烘ā鏉裤備緥濡傦細

shell> cp support-files/my-medium.cnf /etc/my.cnf

鍙兘浣犻渶瑕佺敤root鐢ㄦ埛杩愯杩欎簺鍛戒护銆

濡傛灉鎯宠閰嶇疆涓烘敮鎸InnoDB琛紝搴斿綋缂栬緫/etc/my.cnf鏂囦欢锛屽幓鎺innodb_...寮濮嬮夐」琛屽墠闈㈢殑#绗︼紝骞跺皢閫夐」鍊兼敼涓轰綘鎯宠鐨勩傝鍙傝4.3.2鑺傦紝鈥滀娇鐢ㄩ夐」鏂囦欢鈥15.2.3鑺傦紝鈥淚nnoDB閰嶇疆鈥

15.杩涘叆瀹夎鐩綍锛

16.        shell> cd /usr/local/mysql

17.濡傛灉杩樻病鏈夊畨瑁呯殑MySQL锛屽繀椤诲垱寤MySQL鎺堟潈琛細

18.        shell> bin/mysql_install_db --user=mysql

濡傛灉鐢root杩愯鍛戒护锛屽簲褰撲娇鐢--user閫夐」銆傞夐」鐨勫煎簲涓庝綘鍦ㄧ涓姝ヤ负杩愯鏈嶅姟鍣ㄦ墍鍒涘缓鐨勭櫥褰曡处鎴风浉鍚屻傚鏋滅敤璇ョ敤鎴风櫥褰曟潵杩愯鍛戒护锛屽彲浠ョ渷鐣--user閫夐」銆

mysql_install_db鍒涘缓MySQL鎺堟潈琛ㄥ悗锛岄渶瑕佹墜鍔ㄩ噸鏂板惎鍔ㄦ湇鍔″櫒

19.灏嗙▼搴忎簩杩涘埗鐨勬墍鏈夋潈鏀逛负root鏁版嵁鐩綍鐨勬墍鏈夋潈鏀逛负浣犺繍琛mysqld鐨勭敤鎴枫傚鏋滀綅浜庡畨瑁呯洰褰(/usr/local/mysql)涓嬶紝鍛戒护搴斾负锛

20.        shell> chown -R root  .
21.        shell> chown -R mysql var
22.        shell> chgrp -R mysql .

绗竴涓懡浠ゅ皢鏂囦欢鐨勬墍鏈夊睘鎬ф敼涓root鐢ㄦ埛銆傜浜屼釜鍛戒护灏嗘暟鎹洰褰曠殑鎵鏈夊睘鎬ф敼涓mysql鐢ㄦ埛銆傜涓変釜鍛戒护灏嗙粍灞炴ф敼涓mysql缁勩

23.濡傛灉浣犲枩娆㈠湪寮曞鏈哄櫒鏃惰嚜鍔ㄥ惎鍔MySQL锛屼綘鍙互鎷疯礉support-files/mysql.server鏂囦欢鍒颁綘绯荤粺鏈夊惎鍔ㄦ枃浠剁殑鍦版柟銆傛洿澶氱殑淇℃伅鍙互鍦support-files/mysql.server鑴氭湰涓拰2.9.2.2鑺傦紝鈥滆嚜鍔ㄥ惎鍔ㄥ拰鍋滄MySQL鈥涓壘鍒般

24.濡傛灉瀹夎浜DBIDBD::mysql Perl妯″潡锛屽彲浠ヤ娇鐢bin/mysql_setpermission鑴氭湰澧炲姞鏂拌处鎴枫傚叧浜庤鏄庯紝鍙傝2.13鑺傦紝鈥淧erl瀹夎娉ㄦ剰浜嬮」鈥

鍦ㄦ墍鏈変笢瑗胯瀹夎浠ュ悗锛屼綘搴斿綋浣跨敤璇ュ懡浠ゅ垵濮嬪寲骞朵笖娴嬭瘯浣犵殑鍒嗗彂鐗堬細

shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &

濡傛灉杩欎釜鍛戒护鎻愮ずmysqld daemon ended骞堕┈涓婂け璐ワ紝閭d箞浣犺兘鍦ㄦ暟鎹洰褰曚腑鐨勬枃浠垛hostname'.err鈥濇壘鍒颁竴浜涗俊鎭

鍏充簬mysqld_safe鐨勮缁嗕俊鎭弬瑙5.1.3鑺傦紝鈥渕ysqld_safe锛歁ySQL鏈嶅姟鍣ㄥ惎鍔ㄨ剼鏈

娉ㄩ噴锛MySQL鎺堟潈琛ㄤ腑鐨勮处鎴峰紑濮嬫病鏈夊瘑鐮併傚惎鍔ㄦ湇鍔″櫒鍚庯紝浣犲簲褰撲娇鐢2.9鑺傦紝鈥滃畨瑁呭悗鐨勮缃拰娴嬭瘯鈥涓殑璇存槑鏉ヨ缃瘑鐮併

2.8.2. 鍏稿瀷閰嶇疆閫夐」

configure鑴氭湰缁欎綘涓涓緢澶х殑鎺у埗鏉冩潵鎺у埗濡備綍閰嶇疆MySQL婧愮爜鍒嗗彂鐗堛備竴鑸娇鐢configure鍛戒护琛岀殑閫夐」鏉ヨ繘琛屻備綘涔熷彲浠ョ敤鏌愪簺鐜鍙橀噺浣滅敤浜configure銆傝鍙傝闄勫綍F锛鐜鍙橀噺銆傝鏌ョ湅configure鏀寔鐨勯夋嫨鍒楄〃锛屽彲浠ヨ繍琛屽懡浠わ細

shell> ./configure --help
  • 濡傛灉鍙紪璇MySQL瀹㈡埛绔簱鍜屽鎴风绋嬪簭鑰屼笉鏄湇鍔″櫒锛屼娇鐢--without-server閫夐」锛
  • shell> ./configure --without-server

濡傛灉浣犳病鏈C++缂栬瘧鍣紝鍒欎笉鑳界紪璇mysql(鏈変竴涓鎴风绋嬪簭闇瑕C++)銆傚湪杩欑鎯呭喌涓嬶紝浣犲彲浠ュ幓鎺configure閲岄潰娴嬭瘯C++缂栬瘧鍣ㄧ殑浠g爜锛岀劧鍚庤繍琛屽甫鏈 --without-server閫夐」鐨./configure銆傜紪璇戞楠ゆ灏嗕粛鐒跺皾璇曟瀯閫mysql锛屼絾鏄綘鍙互蹇界暐浠讳綍鍏充簬鈥mysql.cc鈥濈殑璀﹀憡銆傦紙濡傛灉make鍋滄锛岃瘯璇make -k鍛婅瘔瀹冨嵆浣垮嚭閿欑户缁墿涓嬬殑鏋勯犳楠わ級銆

         濡傛灉浣犳兂瑕佹瀯寤哄祵鍏ュ紡MySQL (libmysqld.a),浣犲簲褰撲娇鐢--with-embedded-server閫夐」銆

  • 濡傛灉浣犱笉鎯宠浣嶄簬鈥/usr/local/var鈥濈洰褰曚笅闈㈢殑鏃ュ織(log)鏂囦欢鍜屾暟鎹簱锛屼娇鐢ㄧ被浼间簬涓嬪垪configure鍛戒护鐨勪竴涓細
  • shell>./configure--prefix=/usr/local/mysql
  • shell>./configure--prefix=/usr/local
  •        localstatedir=/usr/local/mysql/data

绗竴涓懡浠ゆ敼鍙樺畨瑁呭墠缂浠ヤ究灏嗘墍鏈夊唴瀹瑰畨瑁呭埌鈥/usr/local/mysql鈥濅笅闈㈣岄潪 榛樿鐨勨/usr/local鈥濄傜浜屼釜鍛戒护淇濈暀榛樿瀹夎鍓嶇紑锛屼絾鏄鐩栦簡鏁版嵁搴撶洰褰曢粯璁ょ洰褰(閫氬父鏄/usr/local/var)骞朵笖鎶婂畠鏀逛负/usr/local/mysql/data銆傜紪璇戝畬MySQL鍚庯紝鍙互閫氳繃閫夐」鏂囦欢鏇存敼杩欎簺閫夐」銆傝鍙傝4.3.2鑺傦紝鈥滀娇鐢ㄩ夐」鏂囦欢鈥

  • 濡傛灉浣犳鍦ㄤ娇鐢Unix骞朵笖浣犳兂瑕MySQL鐨勫鎺ュ瓧浣嶄簬 榛樿浣嶇疆浠ュ鐨勬煇涓湴鏂(閫氬父鍦ㄧ洰褰曗/tmp鈥濇垨鈥/var/run鈥濓紝浣跨敤璞¤繖鏍风殑configure鐨勫懡浠わ細
  • shell> ./configure\-- with-unix-socket-
  • path=/usr/local/mysql/tmp/mysql.sock

娉ㄦ剰缁欏嚭鐨勬枃浠跺悕蹇呴』鏄竴涓粷瀵硅矾寰勩備綘杩樺彲浠ュ湪浠ュ悗浣跨敤MySQL閫夐」鏂囦欢鏇存敼mysql.sock鐨勪綅缃傝鍙傝A.4.5鑺傦紝鈥滃浣曚繚鎶ゆ垨鏇存敼MySQL濂楁帴瀛楁枃浠/tmp/mysql.sock

  • 濡傛灉浣犳兂缂栬瘧闈欐侀摼鎺ョ▼搴(渚嬪锛屽埗浣滀簩杩涘埗鍒嗗彂鐗堛佽幏寰楁洿蹇殑閫熷害鎴栦笌瑙e喅涓RedHat鍒嗗彂鐗堢殑涓浜涢棶棰)锛屽儚杩欐牱杩愯configure

                shell>./configure --with-client-ldflags=-all-static\

                        --with-mysqld-ldflags=-all-static

  • 濡傛灉浣犳鍦ㄤ娇鐢gcc骞朵笖娌℃湁瀹夎libg++libstdc++锛屼綘鍙互鍛婅瘔configure浣跨敤gcc浣滀负C++缂栬瘧鍣細
  • shell> CC=gcc  CXX=gcc  ./configure

褰撲綘浣跨敤gcc浣滀负C++缂栬瘧鍣ㄧ敤鏃讹紝瀹冨皢涓嶈瘯鍥鹃摼鎺libg++libstdc++銆傚嵆浣夸綘瀹夎浜嗚繖浜涘簱锛岃繖鏍蜂篃寰堝ソ锛屽洜涓鸿繃鍘讳娇鐢MySQL鏃讹紝瀹冧滑鐨勯儴鍒嗙増鏈細鍑虹幇涓浜涘鎬殑闂銆

涓嬮潰鍒楀嚭浜嗕竴浜涚粡甯镐娇鐢ㄧ殑缂栬瘧鍣ㄥ拰鐜鍙橀噺璁惧畾鍊笺

o        gcc 2.7.2

o                     CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors"

o        egcs 1.0.3a

o                     CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors \
o                     -fno-exceptions -fno-rtti"

o        gcc 2.95.2

o                     CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
o                     -felide-constructors -fno-exceptions -fno-rtti"

o        pgcc 2.90.29 鎴栨洿鏂扮増锛

o                     CFLAGS="-O3 -mpentiumpro -mstack-align-double" CXX=gcc \
o                     CXXFLAGS="-O3 -mpentiumpro -mstack-align-double \
o                     -felide-constructors -fno- exceptions -fno-rtti"

鍦ㄥぇ澶氭暟鎯呭喌锛屽湪configure琛屼娇鐢ㄥ墠闈㈠垪鍑虹殑閫夐」骞跺姞鍏ヤ笅闈㈢殑閫夐」锛屽彲浠ュ緱鍒板悎鐞嗙殑浼樺寲鐨MySQL浜岃繘鍒讹細

--prefix=/usr/local/mysql --enable-assembler \
--with-mysqld-ldflags=-all-static

鎹㈠彞璇濊锛屽浜庢墍鏈夋渶杩戠殑gcc鐗堬紝鏁翠釜configure琛屽簲涓猴細

CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
-felide-constructors -fno- exceptions -fno-rtti" ./ configure \
--prefix=/usr/local/mysql --enable-assembler \
--with-mysqld-ldflags=-all-static

鎴戜滑鍦MySQL缃戝潃http://www.mysql.com/鎻愪緵鐨勪簩杩涘埗鍧囧凡缁忕紪璇戣繃骞惰繘琛屼簡浼樺寲锛屽浜庡ぇ澶氭暟鐢ㄦ埛搴斿綋姣旇緝瀹屽杽銆傝鍙傝2.1.2.5鑺傦紝鈥淢ySQL AB缂栬瘧鐨凪ySQL浜岃繘鍒剁増鏈銆傚叾涓湁涓浜涢厤缃瀹氬硷紝鍙互閫夌敤鏉ユ瀯寤烘洿蹇殑浜岃繘鍒讹紝浣嗘槸鍙傜敤楂樼骇鐢ㄦ埛銆傝鍙傝7.5.4鑺傦紝鈥滅紪璇戝拰閾炬帴鎬庢牱褰卞搷MySQL鐨勯熷害鈥

濡傛灉鏋勯犲け璐ュ苟涓斾骇鐢熸湁鍏崇紪璇戝櫒鎴栭摼鎺ュ櫒鐨勯敊璇紝涓嶈兘鍒涘缓鍏变韩搴撯libmysqlclient.so.#(#鈥濇槸涓涓増鏈彿), 浣犲彲浠ラ氳繃涓configure鎸囧畾--disable-shared閫夐」鏉ヨВ鍐虫闂銆傚湪杩欑鎯呭喌涓嬶紝configure灏嗕笉鏋勯犱竴涓叡浜libmysqlclient.so.#搴撱

  • 榛樿鍦帮紝MySQL浣跨敤latin1(cp1252)瀛楃闆嗐備负浜嗘敼鍙 榛樿璁剧疆锛屼娇鐢--with-charset閫夐」锛
  • shell> ./configure -- with-charset=CHARSET

CHARSET鍙互鏄big5cp1251cp1257czechdanishdec8doseuc_krgb2312gbkgerman1hebrewhp8hungariankoi8_rukoi8_ukrlatin1latin2sjisswe7tis620ujisusa7win1251ukr銆傝鍙傝5.10.1鑺傦紝鈥滄暟鎹拰鎺掑簭鐢ㄥ瓧绗﹂泦鈥

鍙互鎸囧畾榛樿鏍″瑙勫垯銆MySQL榛樿浣跨敤latin1_swedish_ci鏍″瑙勫垯銆傝鎯虫洿鏀癸紝浣跨敤--with-collation閫夐」锛

shell> ./configure --with-collation=COLLATION

瑕佹兂鏇存敼瀛楃闆嗗拰鏍″瑙勫垯锛岃鍚屾椂浣跨敤--with-charset--with-collation閫夐」銆 鏍″瑙勫垯蹇呴』鏄瓧绗﹂泦鐨勫悎娉曟牎瀵硅鍒欍(浣跨敤SHOW COLLATION璇彞鏉ョ‘瀹氭瘡涓瓧绗﹂泦浣跨敤鍝釜鏍″瑙勫垯)

濡傛灉鎯冲湪鏈嶅姟鍣ㄥ拰瀹㈡埛绔箣闂村彉鎹㈠瓧绗︼紝浣犲簲璇ョ湅涓涓SET OPTION CHARACTER SET鍛戒护銆傝鍙傝13.5.3鑺傦紝鈥淪ET璇硶鈥

璀﹀憡锛濡傛灉浣犲湪鍒涘缓浜嗕换浣曟暟鎹簱琛ㄤ箣鍚庢敼鍙樺瓧绗﹂泦锛屼綘灏嗗繀椤诲姣忎釜琛ㄨ繍琛myisamchk -r -q --set-character-set=charset锛屽惁鍒欑储寮曞彲鑳戒笉姝g‘鍦版帓搴忋傦紙濡傛灉瀹夎浜MySQL锛屽垱寤轰竴浜涜〃锛岀劧鍚庨噸鏂伴厤缃MySQL浣跨敤涓涓笉鍚岀殑瀛楃闆嗗苟涓旈噸鏂板畨瑁呭畠锛岃繖鏃跺氨鍙兘鍙戠敓杩欑鎯呭喌銆傦級

閫氳繃configure閫夐」--with-extra-charsets=LIST锛屼綘鍙互瀹氫箟鍦ㄦ湇鍔″櫒涓啀瀹氫箟鍝簺瀛楃闆嗐LIST 鎸囦笅闈换浣曚竴椤癸細

o        绌烘牸闂撮殧鐨勪竴绯诲垪瀛楃闆嗗悕

o        complex -锛屼互鍖呮嫭涓嶈兘鍔ㄦ佽杞界殑鎵鏈夊瓧绗﹂泦

o        all 鈥擄紝浠ュ皢鎵鏈夊瓧绗﹂泦鍖呮嫭杩涗簩杩涘埗

  • 涓轰簡閰嶇疆MySQL甯︽湁璋冭瘯浠g爜锛屼娇鐢--with-debug閫夐」锛
  • shell> ./configure --with-debug

杩欏鑷村寘鍚竴涓畨鍏ㄧ殑鍐呭瓨鍒嗛厤鍣紝鑳藉彂鐜颁竴浜涢敊璇拰骞舵彁渚涘叧浜庢鍦ㄥ彂鐢熺殑浜嬫儏鐨勮緭鍑恒傝鍙傝E.1鑺傦紝鈥滆皟璇昅ySQL鏈嶅姟鍣ㄢ

         濡傛灉瀹㈡埛绔▼搴忎娇鐢ㄧ嚎绋嬶紝杩樺繀椤讳娇鐢--enable-thread-safe-client閰嶇疆閫夐」鏉ョ紪璇戠嚎绋嬪畨鍏ㄧ増鐨MySQL瀹㈡埛绔簱銆傚皢鍒涘缓涓涓libmysqlclient_r搴擄紝鍙互鐢ㄦ潵杩炴帴搴旂敤绋嬪簭绾跨▼銆傝鍙傝25.2.15鑺傦紝鈥滃浣曠敓鎴愮嚎绋嬪紡瀹㈡埛绔

         鍙互浣跨敤--with-big-tables閫夐」鏋勫缓鏀寔澶ф暟鎹簱琛ㄧ殑MySQL

璇ラ夐」浣垮彉閲忕敤鏉ュ皢琛ㄨ鏁颁繚瀛樺埌unsigned long long涓屼笉鏄unsigned long銆傜粨鏋滄槸鍏佽琛ㄦ湁澶х害1.844E+19 ((232)2)琛岃屼笉鏄232 (~4.295E+09) 琛屻傚湪浠ュ墠锛岃瀹屾垚璇ュ姛鑳藉繀椤绘墜鍔ㄥ皢-DBIG_TABLES浼犻掔粰缂栬瘧鍣ㄣ

灞炰簬鐗瑰畾绯荤粺鐨勯夐」鍙湪鏈珷鐗瑰畾绯荤粺鐨勫皬鑺傞噷鎵惧埌銆傝鍙傝2.12鑺傦紝鈥滃叿浣撴搷浣滅郴缁熺浉鍏崇殑娉ㄦ剰浜嬮」鈥

2.8.3. 浠庡紑鍙戞簮鐮佹爲瀹夎

娉ㄦ剰锛氬鏋滀綘鎯冲府鍔╂垜浠祴璇曟柊浠g爜锛屽簲褰撻槄璇绘湰鑺傘傚鏋滀綘鍙兂鍦ㄧ郴缁熶笂瀹夎骞惰繍琛MySQL锛屽簲褰撲娇鐢ㄦ爣鍑嗗彂甯冨垎鍙戠増(浜岃繘鍒舵垨婧愮爜鍒嗗彂鐗)

瑕佹兂鑾峰緱鎴戜滑鐨勬渶鏂板紑鍙戞簮鐮佹爲锛屽簲浣跨敤璇存槑锛

1.    http://www.bitmover.com/bk-client.shar涓嬭浇BitKeeper鍏嶈垂瀹㈡埛绔

2.    Unix涓婂畨瑁呭厤璐瑰鎴风锛

3.            shell> sh bk-client.shar
4.            shell> cd bk_client-1.1
5.            shell> make all
6.            shell> PATH=$PWD:$PATH

Windows涓婄殑瀹夎鏂规硶锛

         http://cygwin.com涓嬭浇骞跺畨瑁Cygwin

         纭繚gccmake宸茬粡瀹夎鍒Cygwin銆傚彲浠ョ敤which gcc which make鍛戒护杩涜娴嬭瘯銆傚鏋滀换浣曚竴涓病鏈夊畨瑁咃紝杩愯 Cygwin瀹夎鍖呯鐞嗗櫒锛岄夋嫨gccmake瀹夎銆

         Cygwin涓紝杩愯锛

                      shell> sh bk-client.shar
                      shell> cd bk_client-1.1

鐒跺悗缂栬緫Makefile骞跺皢琛s $(CC) $(CFLAGS) -o sfio -lz sfio.c鏇存敼涓猴細

$(CC) $(CFLAGS) -o sfio sfio.c -lz

鐜板湪杩愯make鍛戒护骞惰缃矾寰勶細

shell> make all
shell> PATH=$PWD:$PATH

7.    瀹夎BitKeeper鍏嶈垂瀹㈡埛绔悗锛岄鍏堣繘鍏ュ伐浣滅洰褰曪紝鐒跺悗浣跨敤浠ヤ笅鍛戒护鍦ㄦ湰鍦板鍒MySQL 5.1

8.            shell> sfioball -r+ bk://mysql.bkbits.net/mysql-5.1 mysql-5.1

涓鑸儏鍐碉紝浣犱笉闇瑕佽嚜宸辨瀯寤烘枃妗o紝鍥犱负鎴戜滑宸茬粡鍦http://dev.mysql.com/doc/鎻愪緵浜嗚澶氭牸寮忋傛垜浠瘡澶╂洿鏂颁綘鍙互涓嬭浇鐨勬牸寮(HTMLPDF)锛屽洜姝や綘娌℃湁蹇呰浠MySQLdoc鏍戜腑鐨DocBook XML鍩烘湰鏍煎紡鏉ュ垱寤恒傚鏋滀綘鎯宠澶嶅埗鏂囨。搴擄紝浣跨敤涓嬮潰鐨勫懡浠わ細

shell> sfioball -r+ bk://mysql.bkbits.net/mysqldoc mysqldoc

鍦ㄥ墠闈㈢殑渚嬪瓙涓紝鍦ㄥ綋鍓嶇洰褰曠殑MySQL-5.1/瀛愮洰褰曚腑璁剧疆婧愮爜鏍戙

濡傛灉浣犱綅浜庨槻鐏鍚庨潰锛屽彧鑳藉垵濮嬪寲HTTP杩炴帴锛岃繕鍙互閫氳繃HTTP浣跨敤BitKeeper

濡傛灉闇瑕佷娇鐢ㄤ唬鐞嗘湇鍔″櫒锛岃缃幆澧冨彉閲http_proxy鎸囧悜浠g悊锛

shell> export http_proxy="http://your.proxy.server:8080/"

褰撳鍒跺簱鏃剁敤http://鏇挎崲bk//銆備緥濡傦細

shell> sfioball -r+ http://mysql.bkbits.net/mysql-5.1 mysql-5.1

涓嬭浇婧愮爜鏍戝彲鑳介渶瑕佷竴娈垫椂闂达紝鍙栧喅浜庤繛鎺ラ熷害銆傝鑰愬績绛夊緟銆

9.    瑕佹兂鏇存柊鏈湴MySQL 5.1搴撳鍒讹紝浣跨敤鍛戒护锛

10.        shell> update bk://mysql.bkbits.net/mysql-5.1

11.浣犻渶瑕GNU makeautoconf 2.58 (鎴栨洿鏂扮増)automake 1.8libtool 1.5m4鏉ヨ繍琛屽悗闈㈢殑鍛戒护銆傚敖绠¤澶氭搷浣滅郴缁熷畨瑁呬簡make锛屽緢鍙兘缂栬瘧澶辫触锛屽嚭鐜拌澶氬鎬殑缂洪櫡娑堟伅銆傚洜姝わ紝寮虹儓寤鸿浣犱娇鐢GNU make(鏈夋椂鍚嶄负gmake)

骞歌繍鐨勬槸锛屽ぇ閲忕殑鎿嶄綔绯荤粺棰勮浜GNU宸ュ叿閾炬垨鎻愪緵浜嗗彲瀹夎杞欢鍖呫備綘鍙互闅忔椂浠庝笅闈㈢殑鍦板潃涓嬭浇锛

         http://www.gnu.org/software/autoconf/

         http://www.gnu.org/software/automake/

         http://www.gnu.org/software/libtool/

         http://www.gnu.org/software/m4/

         http://www.gnu.org/software/make/

瑕佹兂閰嶇疆MySQL 5.1,浣犺繕闇瑕GNU bison 1.75鎴栨洿鏂扮増銆傛棫鐗堟湰鐨bison浼氭姤鍛婇敊璇細

sql_yacc.yy:#####: fatal error: maximum table size (32767) exceeded

娉ㄩ噴锛氬疄闄呬笂骞舵病鏈夎秴鍑烘渶澶ц〃绌洪棿锛涜繖鏄敱鏃х増鏈殑bison缂洪櫡閫犳垚鐨勮闂銆

涓嬮潰鐨勪緥瀛愭樉绀轰簡閰嶇疆婧愮爜鏍戦渶瑕佺殑鍏稿瀷鍛戒护銆傜涓涓cd鍛戒护灏嗕綅缃敼涓烘爲鐨勯《绾х洰褰曪紱鐢ㄧ浉搴旂洰褰曞悕鏇挎崲MySQL-5.1

shell> cd mysql-5.1
shell> bk -r edit
shell> aclocal; autoheader
shell> libtoolize --automake --force
shell> automake --force --add-missing; autoconf
shell> (cd innobase; aclocal; autoheader; autoconf; automake)
shell> (cd bdb/dist; sh s_all)
shell> ./configure  # Add your favorite options here
shell> make

瀵逛簬涓嬮潰鐨勫懡浠わ紝鍙互浣跨敤BUILD/autorun.sh浣滀负蹇嵎鏂瑰紡锛

shell> aclocal; autoheader
shell> libtoolize --automake --force
shell> automake --force --add-missing; autoconf
shell> (cd innobase; aclocal; autoheader; autoconf; automake)
shell> (cd bdb/dist; sh s_all)

浣跨敤灏嗙洰褰曟敼涓innobasebdb/dist鐩綍鐨勫懡浠よ鏉ラ厤缃InnoDB Berkeley DB (BDB)鍌ㄥ瓨寮曟搸銆傚鏋滀綘涓嶉渶瑕InnoDBBDB鏀寔锛屼綘鍙互鐪佺暐杩欎簺鍛戒护琛屻

濡傛灉鍦ㄨ闃舵浣犻亣鍒颁竴浜涘鎬殑閿欒锛岃纭浣犳槸鍚﹀凡缁忓畨瑁呬簡 libtool

鏍囧噯閰嶇疆鑴氭湰浣嶄簬BUILD/瀛愮洰褰曘備綘浼氬彂鐜颁娇鐢BUILD/compile-pentium-debug鑴氭湰姣斾娇鐢ㄥ墠闈㈢殑澶栧3鍛戒护瑕佹柟渚垮緱澶氥傝鎯冲湪涓嶅悓鐨勬灦鏋勪笂缂栬瘧锛屽彲浠ヤ慨鏀硅剼鏈紝鍗冲幓鎺Pentium鐩稿叧鏍囧織銆

12.鏋勫缓瀹屾垚鍚庯紝杩愯make install銆傚湪浜у搧鏈哄櫒涓婅繍琛屾椂搴旀敞鎰忥紱璇ュ懡浠や細瑕嗙洊浣犳浣跨敤鐨勭増鏈傚鏋滀綘瀹夎浜嗗彟涓涓MySQL锛屾垜浠缓璁綘浣跨敤 涓庝綘鐨勪骇鍝佹湇鍔″櫒涓婁笉鍚岀殑--prefix--with-tcp-port--unix-socket-path閫夐」鍊兼潵杩愯./configure

13.寮哄埗杩愯鏂板畨瑁呭拰灏濊瘯浼氱牬鍧忔柊鍔熻兘銆傚簲鍏堣繍琛make test銆傝鍙傝27.1.2鑺傦紝鈥淢ySQL娴嬭瘯濂椾欢鈥

14.濡傛灉浣犲凡缁忚繘鍏make闃舵鑰屽垎鍙戠増涓嶇紪璇戯紝璇锋姤鍛婄粰鎴戜滑鐨http://bugs.mysql.com/涓殑缂洪櫡鏁版嵁搴撱傚鏋滀綘宸茬粡瀹夎浜GNU宸ュ叿鐨勬渶鏂扮増鏈紝濡傛灉瑙嗗浘澶勭悊閰嶇疆鏂囦欢鏃跺嚭閿欙紝璇锋姤鍛婄粰鎴戜滑銆備絾鏄紝濡傛灉浣犳墽琛aclocal骞朵笖閬囧埌command not found error鎴栫被浼奸棶棰橈紝涓嶈鎶ュ憡缁欐垜浠傝屾槸搴旂‘淇濆畨瑁呬簡鎵鏈夊繀瑕佺殑宸ュ叿锛屽苟涓PATH鍙橀噺璁剧疆姝g‘锛屼繚璇佸澹冲懡浠ゅ彲浠ユ壘鍒板畠浠

15.澶嶅埗瀹屽簱(sfioball)鑾峰緱婧愮爜鏍戝悗锛屼綘搴斿綋瀹氭湡鏇存柊搴(update)

16.浣犲彲浠ユ鏌ユ爲鐨勬洿鏀瑰彶锛屾祻瑙堟簮鐮佹爲涓殑BK/ ChangeLog鏂囦欢骞舵煡鐪ChangeSet鎻忚堪鎵惧埌鎵鏈変笉鍚岀偣銆傝鎯虫鏌ョ壒娈婄殑鏇存敼闆嗭紝蹇呴』浣跨敤sfioball鍛戒护鎻愬彇婧愮爜鏍戠殑涓ゆ涓嶅悓鐨勪慨璁紝鐒跺悗浣跨敤澶栭儴diff鍛戒护鏉ユ瘮杈冦傚鏋滀綘鐪嬪埌鏈夌枒闂殑濂囨殑涓嶅悓涔嬪鎴栦唬鐮侊紝涓瀹氳鍚MySQL internals閭欢鍒楄〃鍙戦侀偖浠躲傝鍙傝1.7.1.1鑺傦紝鈥淭he MySQL閭欢鍒楄〃鈥銆傚苟涓旓紝濡傛灉浣犳湁鏇村ソ鐨勬濇兂锛岃鍚戜笂杩板湴鍧鍙戦侀偖浠躲

17.BitKeeper鍏嶈垂瀹㈡埛绔瑁呬簡婧愮爜銆傚厤璐瑰鎴风鍙敤鐨勫敮涓鏂囨。鏄簮鐮佹湰韬

浣犺繕鍙互鍦ㄧ嚎娴忚鏇存敼闆嗐佹敞閲婂拰婧愮爜銆傝鎯虫祻瑙MySQL 5.1鐨勭浉鍏充俊鎭紝璇峰埌http://mysql.bkbits.net:8080/mysql-5.1

2.8.4. 澶勭悊MySQL缂栬瘧闂

鎵鏈MySQL绋嬪簭鍦SolarisLinux涓婁娇鐢gcc缂栬瘧骞朵笖娌℃湁浠讳綍璀﹀憡銆傚湪鍏跺畠绯荤粺涓婏紝鐢变簬绯荤粺鍖呭惈鏂囦欢鐨勫樊鍒彲鑳戒細鍙戠敓璀﹀憡銆傚浜庝娇鐢MIT-pthreads鏃跺彂鐢熺殑璀﹀憡銆傝鍙傝2.8.5鑺傦紝鈥淢IT-pthreads娉ㄦ剰浜嬮」鈥銆傚叾瀹冮棶棰橈紝妫鏌ヤ笅闈㈢殑琛ㄣ

璁稿闂鐨勮В鍐虫柟妗堟秹鍙婇噸鏂伴厤缃傚鏋滀綘纭疄闇瑕侀噸鏂伴厤缃紝娉ㄦ剰涓嬪垪浜嬮」锛

  • 濡傛灉configure鍦ㄥ畠宸茬粡琚繍琛屼簡浠ュ悗杩愯锛屽畠鍙互浣跨敤鍏堝墠鏀堕泦鐨勪俊鎭傝繖涓俊鎭瓨鍌ㄥ湪鈥config.cache鈥濋噷闈€傚綋configure鍚姩鏃讹紝瀹冨鎵捐鏂囦欢鑰屼笖濡傛灉瀹冨瓨鍦紝鍋囧畾淇℃伅浠嶇劧鏄纭殑锛岃鍏ュ畠鐨勫唴瀹广傚綋浣犻噸鏂伴厤缃椂锛岃鍋囪鏃犳晥銆
  • 姣忔杩愯configure鐨勬椂鍊欙紝蹇呴』杩愯make鍐嶉噸鏂扮紪璇戙傜劧鑰, 浣犲彲鑳芥兂瑕佹妸鍏堝墠鏋勯犵殑鑰佺殑鐩爣鏂囦欢鍒犻櫎锛屽洜涓哄畠浠娇鐢ㄤ笉鍚岀殑閰嶇疆閫夐」缂栬瘧鑰屾垚銆

涓轰簡闃叉浣跨敤鏃х殑閰嶇疆淇℃伅鎴栫洰鏍囨枃浠讹紝閲嶆柊杩愯configure鍓嶈繍琛岃繖浜涘懡浠わ細

shell> rm  config.cache

shell> make clean

鍙﹀锛屼綘鍙互杩愯make distclean

涓嬭〃鎻忚堪浜嗕竴浜涙渶甯稿彂鐢熺殑缂栬瘧MySQL鐨勯棶棰橈細

  • 濡傛灉鍦ㄧ紪璇戔sql_yacc.cc鈥濇椂锛岄亣鍒板涓嬮敊璇紝鍙兘鏄瓨鍌ㄥ櫒鎴栦氦鎹㈢┖闂存孩鍑猴細
                Internal compiler error: program cc1plus got fatal signal 11
                Out of virtual memory
                Virtual memory exhausted

璇ラ棶棰樻槸gcc瑕佹眰澶ч噺鐨勫唴瀛樼紪璇戝甫鏈夊祵鍏ュ嚱鏁(inline function)鐨勨sql_yacc.cc鈥濄傝瘯璇曚互--with-low-memory閫夐」杩愯configure

shell> ./configure -- with-low-memory

濡傛灉浣犳鍦ㄤ娇鐢gcc锛岃閫夐」浣垮緱灏-fno-inline鍔犲埌缂栬瘧琛岋紝濡傛灉浣犳浣跨敤鍏跺畠鐨勭紪璇戝櫒锛屽垯鍔犲叆-O0銆備綘搴旇璇曚竴璇--with-low-memory閫夐」锛屽嵆浣夸綘鏈夌壒鍒鐨勫瓨鍌ㄥ櫒鍜屼氦鎹㈢┖闂达紝鑰屼綘璁や负涓嶅彲鑳借繍琛屽緱婧㈠嚭銆傝繖涓棶棰樼敋鑷充細鍦ㄥ緢鎱锋叏鐨勭‖浠堕厤缃殑绯荤粺涓婂嚭鐜帮紝閫氬父鐢--with-low-memory閫夐」淇瀹冦

  • 榛樿鎯呭喌锛configure閫夊垯c++浣滀负缂栬瘧鍣ㄥ苟鐢-lg++閫夐」鐨GNU c++閾炬帴銆傚鏋滀綘姝e湪浣跨敤gcc锛岃繖涓壒鎬у湪閰嶇疆鏈熼棿瀵艰嚧濡備笅闂锛

                configure: error: installation or configuration problem:

                C++ compiler cannot create executables.

涔熷彲鑳藉湪缂栬瘧鏈熼棿鐪嬪埌g++libg++libstdc++鐩稿叧鐨勯棶棰樸

杩欎簺闂鐨勪竴涓師鍥犳槸浣犲彲鑳芥病鏈g++锛屾垨鍙兘鏈g++浣嗘棤libg++libstdc++銆傜湅涓涓嬧config.log鈥濇枃浠躲傚畠搴旇鍖呭惈c++缂栬瘧鍣ㄤ笉鑳藉伐浣滅殑鍑嗙‘鍘熷洜锛佷负浜嗚В鍐宠繖浜涢棶棰橈紝鍙互浣跨敤gcc浣滀负C++缂栬瘧鍣ㄣ傝瘯璇曡缃幆澧冨彉閲CXX"gcc -O3"銆備緥濡傦細

shell> CXX="gcc -O3" ./configure

鍙互宸ヤ綔锛屽洜涓gccg++涓鏍风紪璇C++婧愮爜锛屼絾 榛樿鍦板畠涓嶉摼鎺libg++libstdc++

瑙e喅杩欎簺闂鐨勫叾瀹冩柟娉曞綋鐒舵槸瀹夎g++libg++libstdc++銆傜劧鑰岋紝鎴戜滑寤鸿涓嶈鍦MySQL涓娇鐢libg++libstdc++鍥犱负鍙細澧炲姞mysqld浜岃繘鍒剁┖闂磋屼笉浼氬甫鏉ヤ换浣曞ソ澶勩傞儴鍒嗙増鏈殑搴撳湪杩囧幓鏇剧粡缁欑敤鎴峰甫鏉ヤ竴浜涘鎬殑闂銆

         濡傛灉浣犵殑缂栬瘧浠ヤ笅闈换浣曢敊璇屽け璐ワ紝蹇呴』鍗囩骇make鐗堟湰鍒GNUmake

                making all in mit-pthreads
                make: Fatal error in reader: Makefile, line 18:
                Badly formed macro assignment

鎴栵細

make: file `Makefile' line 18: Must be a separator (:

鎴栵細

pthread.h: No such file or directory

宸茬煡SolarisFreeBSDmake绋嬪簭鏈夐棶棰樸

宸茬煡GNU make 3.75鑳藉伐浣溿

         濡傛灉浣犳兂瑕佸畾涔CC++缂栬瘧鍣ㄦ墍浣跨敤鐨勬爣蹇楋紝鎶婃爣蹇楀姞鍒CFLAGSCXXFLAGS鐜鍙橀噺涓嵆鍙備篃鍙互浣跨敤CCCXX鏉ユ寚瀹氱紪璇戝櫒鍚嶅瓧銆備緥濡傦細

                shell> CC=gcc
                shell> CFLAGS=-O3
                shell> CXX=gcc
                shell> CXXFLAGS=-O3
                shell> export CC CFLAGS CXX CXXFLAGS

瀵逛簬宸茬粡鐭ラ亾鍦ㄤ笉鍚岀郴缁熶笂鏈夌敤鐨勬爣蹇楀畾涔夊垪琛紝鍙傝2.1.2.5鑺傦紝鈥淢ySQL AB缂栬瘧鐨凪ySQL浜岃繘鍒剁増鏈

         濡傛灉浣犻亣鍒拌薄濡備笅鐨勪竴鏉¢敊璇秷鎭紝鍒欓渶瑕佸崌绾gcc缂栬瘧鍣細

                client/libmysql.c:273: parse error before `__attribute__'

gcc2.8.1宸茬煡鍙互宸ヤ綔锛屼絾鏄垜浠帹鑽愪娇鐢gcc 2.95.2egcs 1.0.3a

         濡傛灉缂栬瘧mysqld鏃舵樉绀轰緥濡備笅闈㈢殑閭d簺閿欒, configure娌℃湁姝g‘鍦版娴嬩紶鍒accept()getsockname()getpeername()鏈鍚庡弬鏁扮殑绫诲瀷锛

                cxx: Error: mysqld.cc, line 645: In this statement, the referenced
                     type of the pointer value ''length'' is ''unsigned long'',
                     which is not compatible with ''int''.
                new_sock = accept(sock, (struct sockaddr *)&cAddr, &length);

涓轰簡淇瀹冿紝缂栬緫鈥config.h鈥濇枃浠(瀹冪敱configure鐢熸垚)銆傚鎵捐繖浜涜锛

/* Define as the base type of the last arg to accept */
#define SOCKET_SIZE_TYPE XXX
  • 鏇存敼XXXsize_tint锛屽彇鍐充簬浣犵殑鎿嶄綔绯荤粺銆傦紙娉ㄦ剰锛氭瘡娆¤繍琛configure閮藉繀椤昏繖鏍峰仛锛屽洜涓configure閲嶆柊鐢熸垚鈥config.h鈥濓級
  • sql_yacc.cc鈥濇枃浠剁敱鈥sql_yacc.yy鈥濈敓鎴愩傞氬父鏋勯犺繃绋嬩笉闇瑕佸垱閫犫sql_yacc.cc鈥濓紝鍥犱负MySQL鏈変竴涓凡缁忕敓鎴愮殑鎷疯礉锛岀劧鑰岋紝濡傛灉浣犵‘瀹為渶瑕佸啀鍒涘缓瀹冿紝鍙兘浼氱鍒拌繖涓敊璇細

                "sql_yacc.yy", line xxx fatal: default action causes potential...

杩欐槸涓涓yacc鐗堟湰涓嶅畬鍠勭殑杩硅薄銆備綘鍙兘闇瑕佸畨瑁bisonGNUyacc)骞朵娇鐢ㄥ畠銆

         Debian Linux 3.0, 濡傛灉浣犵紪璇戠殑MySQL 5.1瑕佹敮鎸Berkeley DB锛岄渶瑕佸畨瑁gawk浠f浛榛樿鐨mawk

         濡傛灉浣犻渶瑕佽皟璇mysqldMySQL瀹㈡埛绔紝杩愯configure锛屼娇鐢--with-debug閫夐」锛岀劧鍚庨噸鏂扮紪璇戝苟涓斿皢瀹㈡埛绔▼搴忛摼鎺ュ埌鏂扮殑瀹㈡埛绔簱銆傝鍙傝E.2鑺傦紝鈥滆皟璇昅ySQL瀹㈡埛绔

         濡傛灉浣犲湪Linux(渚嬪锛SuSE Linux 8.1Red Hat Linux 7.3)涓嬮亣鍒扮被浼间笅闈㈢殑缂栬瘧閿欒锛

                libmysql.c:1329: warning: passing arg 5 of `gethostbyname_r' from
                incompatible pointer type
                libmysql.c:1329: too few arguments to function `gethostbyname_r'
                libmysql.c:1329: warning: assignment makes pointer from integer
                without a cast
                make[2]: *** [libmysql.lo] Error 1

榛樿鎯呭喌锛configure鑴氭湰璇曞浘浣跨敤g++ GNU C++缂栬瘧鍣ㄦ潵纭畾姝g‘鐨勫弬鏁般傚鏋滄湭瀹夎g++灏嗕細浜х敓閿欒鐨勭粨鏋溿傛湁涓ょ鏂规硶鍙互瑙e喅璇ラ棶棰橈細

o        纭繚瀹夎浜GNU C++ g++銆傚湪鏌愪簺Linux鍒嗗彂鐗堜笂锛岄渶瑕佸畨瑁呯殑杞欢鍖呭彨鍋gpp锛涘湪鍏跺畠鍒嗗彂鐗堜笂鍚嶄负gcc-c++

o        浣跨敤gcc浣滀负C++ 缂栬瘧鍣紝灏CXX鐜鍙橀噺璁剧疆涓gcc

o                     export CXX="gcc"

璇锋敞鎰忎箣鍚庨渶瑕佸啀娆¤繍琛configure

2.8.5. MIT-pthreads娉ㄦ剰浜嬮」

杩欒妭鎻忚堪浣跨敤MIT-pthreads鏃舵墍娑夊強鐨勪竴浜涢棶棰樸

Linux涓婏紝搴旇涓嶄娇鐢MIT-pthreads鑰屾槸瀹夎LinuxThreads锛佸弬瑙2.12.1鑺傦紝鈥淟inux娉ㄦ剰浜嬮」鈥

濡傛灉浣犵殑绯荤粺涓嶆彁渚涘師鐢熺殑绾跨▼鏀寔锛屽皢闇瑕佷娇鐢MIT-pthreads鍖呮瀯閫MySQL銆傝繖鍖呮嫭澶у鏁FreeBSD绯荤粺銆SunOS 4.xSolaris 2.4鍜屾洿鏃╃増鏈強鍏跺畠锛屽弬瑙2.1.1鑺傦紝鈥淢ySQL鏀寔鐨勬搷浣滅郴缁熲

MIT-pthreads涓嶆槸MySQL 5.1婧愮爜鍒嗗彂鐗堢殑涓閮ㄥ垎銆傚鏋滀綘闇瑕佽瀹夎鍖咃紝闇瑕佸崟鐙粠http://www.mysql.com/Downloads/Contrib/pthreads-1_60_beta6-mysql.tar.gz涓嬭浇銆

涓嬭浇鍚庯紝灏嗘簮鏂囦欢鎻愬彇鍒MySQL婧愮爜鐩綍鐨勯《绾х洰褰曘傚皢鍒涘缓鏂扮殑mit-pthreads瀛愮洰褰曘

  • 鍦ㄥぇ澶氭暟绯荤粺涓婏紝浣犺兘閫氳繃浣跨敤configure骞剁敤--with-mit-threads閫夐」鏉ュ己杩繍琛MIT-pthreads
  • shell> ./configure -- with-mit-threads

褰撲娇鐢MIT-pthreads鏃讹紝涓嶆敮鎸佸湪涓涓潪婧愮爜鐩綍鏋勯狅紝鍥犱负鎴戜滑鎯宠浣挎垜浠浠g爜鐨勬敼鍙樺噺鍒版渶灏忋

         鍐冲畾鏄惁浣跨敤MIT-pthreads鐨勬鏌ヤ粎鍦ㄥ鐞嗘湇鍔″櫒浠g爜鐨勯厤缃繃绋嬫湡闂村彂鐢熴傚鏋滃凡缁忕敤--without-server閰嶇疆浜嗗垎鍙戠増骞跺彧鏋勯犲鎴风浠g爜锛屽鎴风灏嗕笉鐭ラ亾MIT-pthreads鏄惁姝e湪琚娇鐢ㄥ苟涓旀槸鍚︿娇鐢 榛樿鐨Unix濂楁帴瀛楄繛鎺ャ傚洜涓哄湪鏌愪簺骞冲彴涓Unix濂楁帴瀛楁枃浠朵笉鑳藉湪MIT-pthreads涓嬮潰宸ヤ綔锛岃繖鎰忓懗鐫褰撲綘杩愯瀹㈡埛绔▼搴忔椂锛屼綘闇瑕佷娇鐢-h--host

         褰撲娇鐢MIT-pthreads缂栬瘧MySQL鏃讹紝鍥犱负鎬ц兘鍘熷洜锛岀郴缁熼攣瀹 榛樿涓虹姝娇鐢ㄣ備綘鍙互鐢--external-locking閫夐」鍛婅瘔鏈嶅姟鍣ㄤ娇鐢ㄧ郴缁熼攣瀹氥傚彧鏄湪鐩稿悓鏁版嵁鏂囦欢涓婅繍琛屼袱涓MySQL鏈嶅姟鍣ㄦ椂閲囬渶瑕侊紝鍥犳涓嶆帹鑽愩

  • 鏈夋椂pthreadbind()鍛戒护涓嶈兘缁戝畾涓涓鎺ュ瓧浣嗘病鏈変换浣曢敊璇秷鎭(鑷冲皯鍦Solaris)锛岀粨鏋滄槸鎵鏈夊埌鏈嶅姟鍣ㄧ殑杩炴帴鍧囧け璐ャ備緥濡傦細
  • shell> mysqladmin version
  • mysqladmin: connect to server at '' failed;
  • error: 'Can't connect to mysql server on localhost (146)'

瑙e喅瀹冪殑鏂规硶鏄潃姝mysqld鏈嶅姟鍣ㄥ苟涓旈噸鍚畠銆傝繖鍙湁褰撴垜浠己杩湇鍔″櫒鍋滄骞堕┈涓婅繘琛岄噸鍚椂鍦ㄥ彂鐢熴

  • 浣跨敤MIT-pthreads锛屼笉鑳界敤SIGINTbreak)涓柇sleep()绯荤粺璋冪敤銆傝繖鍙湁鍦ㄨ繍琛mysqladmin --sleep鏃舵墠鑳芥敞鎰忓埌銆傚湪涓柇璧蜂綔鐢ㄥ苟涓旇繘绋嬪仠姝箣鍓嶅繀椤荤瓑寰sleep()缁堟銆
  • 褰撻摼鎺ユ椂锛屼綘鍙兘浼氭敹鍒拌繖鏍风殑璀﹀憡娑堟伅(鑷冲皯鍦Solaris)锛涘畠浠彲浠ヨ蹇借锛
  • ld: warning: symbol `_iob' has differing sizes:
  •     (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
  • file /usr/lib/libc.so value=0x140);
  •     /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
  • ld: warning: symbol `__iob' has differing sizes:
  •     (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
  • file /usr/lib/libc.so value=0x140);
  •     /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken

 

  • 涓浜涘叾瀹冪殑璀﹀憡涔熷彲琚拷鐣ワ細
  • implicit declaration of function `int strtoll(...)'
  • implicit declaration of function `int strtoul(...)'
  • 鎴戜滑杩樻病鏈夎readlineMIT-pthreads涓婂伐浣溿傦紙杩欎笉闇瑕侊紝浣嗘槸鍙兘鏌愪簺浜轰細鎰熷叴瓒c傦級

2.8.6.聽鍦╓indows涓嬩粠婧愮爜瀹夎MySQL

涓嬮潰鐨勮鏄庢弿杩颁簡濡備綍鍦Windows涓嬩粠5.1鐗堟簮鐮佹瀯寤MySQL浜岃繘鍒躲傝鏄庣敤浜庝粠鍖呭惈鏈鏂板紑鍙戞簮鐮佺殑鏍囧噯婧愮爜鍒嗗彂鐗堟垨浠BitKeeper鏍戞潵鏋勫缓浜岃繘鍒躲

娉ㄩ噴锛鏈枃妗d腑鐨勮鏄庝弗鏍奸檺浜庡湪Windows涓嬩粠鏈鏂版簮鐮佸垎鍙戠増鎴栦粠BitKeeper鏍戞潵娴嬭瘯MySQL鐨勭敤鎴枫備綔涓轰骇鍝佷娇鐢ㄦ椂锛MySQL AB涓嶅缓璁娇鐢ㄤ綘鑷繁浠庢簮鐮佹瀯寤虹殑MySQL鏈嶅姟鍣ㄣ備竴鑸儏鍐碉紝鏈濂戒娇鐢MySQL AB棰勭紪璇戠殑瀵规ц兘杩涜浼樺寲鐨勯傜敤WindowsMySQL浜岃繘鍒跺垎鍙戠増銆傚畨瑁呬簩杩涘埗鍒嗗彂鐗堢殑璇存槑鍙傝2.3鑺傦紝鈥滃湪Windows涓婂畨瑁匨ySQL鈥

瑕佹兂鍦Windows涓粠婧愮爜鏋勫缓MySQLWindows绯荤粺涓簲鏈変笅闈㈢殑缂栬瘧鍣ㄥ拰璧勬簮锛

         Visual Studio 2003缂栬瘧鍣ㄧ郴缁(VC++ 7.0)

         35GB鐨勭‖鐩樼┖闂淬

         Windows 2000鎴栨洿楂樼増鏈

纭垏鐨勭郴缁熼渶姹傝锛http://msdn.microsoft.com/vstudio/productinfo/sysreqs/default.aspx

杩橀渶瑕侀傜敤WindowsMySQL婧愮爜鍒嗗彂鐗堛傛湁涓ょ鏂规硶鍙互鑾峰緱MySQL 5.1 婧愮爜鍒嗗彂鐗堬細

1.    鑾峰緱MySQL AB鎵撳寘鐨勬簮鐮佸垎鍙戠増杞欢鍖呫傞鎵撳寘鐨勬簮鐮佸垎鍙戠増鍙粠 http://dev.mysql.com/downloads/鑾峰緱銆

2.    浣犲彲浠ョ敤鏈鏂BitKeeper寮鍙戞簮鐮佹爲鏋勫缓婧愮爜鍒嗗彂鐗堛傚鏋滀綘璁″垝鏋勫缓锛屽繀椤诲湪Unix绯荤粺涓垱寤哄畨瑁呰蒋浠跺寘锛屽苟灏嗗畠杞Щ鍒Windows绯荤粺銆(杩欐牱鎿嶄綔鐨勭悊鐢辨槸閮ㄥ垎閰嶇疆鍜屾瀯寤烘楠ら渶瑕佸彧鑳藉湪Unix涓伐浣滅殑宸ュ叿锛銆侭itKeeper鏂规硶闇瑕侊細

         杩愯Unix鎴栫被浼Unix鐨勭郴缁燂紝渚嬪Linux

         璇ョ郴缁熶笂瀹夎鐨BitKeeper 3.0銆傚叧浜庡浣曚笅杞藉拰瀹夎BitKeeper鐨勮鏄庡弬瑙2.8.3鑺傦紝鈥滀粠寮鍙戞簮鐮佹爲瀹夎鈥

濡傛灉浣犱娇鐢Windows婧愮爜鍒嗗彂鐗堬紝浣犲彲浠ョ洿鎺ヨ烦鍒2.8.6.1鑺傦紝鈥滀娇鐢╒C++鏋勫缓MySQL鈥銆傝鎯充粠BitKeeper鏍戞瀯寤猴紝缁х画2.8.6.2鑺傦紝鈥滀粠鏈鏂扮殑寮鍙戞簮鐮佸垱寤篧indows婧愮爜瀹夎鍖呪

濡傛灉浣犲彂鐜版煇浜涚粍浠朵笉鑳芥寜棰勬枡鐨勫伐浣滐紝鎴栬呬綘鏈夊ソ鐨勫缓璁彲浠ユ敼杩涚洰鍓嶇殑鍦Windows涓殑鏋勫缓杩囩▼锛岃鍚win32閭欢鍒楄〃鍙戦佹秷鎭傝鍙傝1.7.1.1鑺傦紝鈥淭he MySQL閭欢鍒楄〃鈥

2.8.6.1. 浣跨敤VC++鏋勫缓MySQL

娉ㄩ噴锛MySQL 4.1鍜屼互涓婄増鏈殑VC++宸ヤ綔鍖烘枃浠朵笌Microsoft Visual Studio 2003鐗堟湰鍏煎锛MySQL AB浜哄憳宸茬粡鍦ㄦ瘡涓増鏈箣鍓嶈繘琛屼簡娴嬭瘯銆

鎸夌収浠ヤ笅姝ラ鏋勫缓MySQL

1.    鍒涘缓宸ヤ綔鐩綍(渚嬪锛C\ workdir)

2.    浣跨敤WinZip鎴栧叾瀹冨彲浠ヨ鍙.zip鏂囦欢鐨Windows宸ュ叿灏嗘簮鐮佸垎鍙戠増瑙e帇缂╁埌涓婅堪鐩綍銆

3.    鍚姩Visual Studio

4.    File鑿滃崟锛岄夋嫨Open Workspace

5.    鎵撳紑宸ヤ綔鐩綍涓殑MySQL.dsw宸ヤ綔鍖恒

6.    Build 鑿滃崟锛岄夋嫨Set Active Configuration鑿滃崟銆

7.    鐐瑰嚮绐楀彛閫夋嫨mysqld - Win32 Debug骞剁偣鍑OK

8.    F7寮濮嬫瀯寤鸿皟璇曟湇鍔″櫒銆佸簱鍜屽鎴风搴旂敤绋嬪簭銆

9.    鎸夊悓鏍锋柟娉曠紪璇戝彂甯冪増鏈

10.绋嬪簭鍜屽簱鐨勮皟璇曠増鏈綅浜client_debuglib_debug鐩綍銆傜▼搴忓拰搴撶殑鍙戝竷鐗堟湰浣嶄簬client_releaselib_release鐩綍銆傝娉ㄦ剰濡傛灉浣犳兂瑕佹瀯寤鸿皟璇曠増鏈拰鍙戝竷鐗堟湰锛屽彲浠ヤ粠Build鑿滃崟閫夋嫨Build All閫夐」銆

11.娴嬭瘯鏈嶅姟鍣ㄣ備娇鐢ㄥ墠闈㈢殑璇存槑鏋勫缓鏈嶅姟鍣ㄦ椂锛岄粯璁MySQL鍩烘湰鐩綍鍜屾暟鎹洰褰曚綅浜C:\mysqlC:\mysql\data銆傚鏋滀綘鎯宠浣跨敤婧愮爜鏍戞牴鐩綍鍜屾暟鎹洰褰曚綔涓哄熀鏈洰褰曞拰鏁版嵁鐩綍鏉ユ祴璇曟湇鍔″櫒锛岄渶瑕佸憡璇夋湇鍔″櫒鍏惰矾寰勫悕銆傚彲浠ュ湪鍛戒护琛岀敤--basedir--datadir閫夐」鏉ュ畬鎴愶紝鎴栧皢鐩稿簲閫夐」鏀惧叆閫夐」鏂囦欢(Windows鐩綍鎴C\my.cnf涓殑my.ini鏂囦欢)銆傚鏋滄兂瑕佷娇鐢ㄧ殑鏁版嵁鐩綍鍦ㄥ叾瀹冨湴鏂癸紝鍙互鎸囧畾鍏惰矾寰勫悕銆

12.鏍规嵁浣犳兂瑕佷娇鐢ㄧ殑鏈嶅姟鍣紝浠client_releaseclient_debug鐩綍鍚姩鏈嶅姟鍣ㄣ傚父鐢ㄦ湇鍔″櫒鍚姩璇存槑瑙2.3鑺傦紝鈥滃湪Windows涓婂畨瑁匨ySQL鈥銆傚鏋滄兂瑕佷娇鐢ㄥ叾瀹冨熀鏈洰褰曟垨鏁版嵁鐩綍锛岄渶瑕佺浉搴斿湴鏇存敼鎸囦护銆

13.褰撴湇鍔″櫒鏍规嵁浣犵殑閰嶇疆鐙珛杩愯鎴栦綔涓烘湇鍔℃椂锛屽皾璇曚粠client_releaseclient_debug鐩綍涓殑MySQL浜や簰寮忓懡浠よ瀹炵敤宸ュ叿杩炴帴瀹冦

濡傛灉鏋勫缓鐨勭▼搴忓伐浣滄甯革紝鍋滄鏈嶅姟鍣ㄣ傛寜鐓т互涓嬫楠ゅ畨瑁MySQL

1.    鍒涘缓瀹夎MySQL鐨勭洰褰曘備緥濡傦紝瑕佸畨瑁呭埌C\mysql锛屼娇鐢ㄥ懡浠わ細

2.            C:\> mkdir C:\mysql
3.            C:\> mkdir C:\mysql\bin
4.            C:\> mkdir C:\mysql\data
5.            C:\> mkdir C:\mysql\share
6.            C:\> mkdir C:\mysql\scripts

濡傛灉鎯宠缂栬瘧鍏跺畠瀹㈡埛绔▼搴忓苟杩炴帴鍒MySQL锛屼綘杩橀渶瑕佸垱寤哄嚑涓洰褰曪細

C\> mkdir C\mysql\include
C\> mkdir C\mysql\lib
C\> mkdir C\mysql\lib\debug
C\> mkdir C\mysql\lib\opt

濡傛灉鎯宠瀵MySQL杩涜鍩哄噯妫鏌ワ紝鍒涘缓鐩綍锛

C\> mkdir C\mysql\sql-bench

鍩哄噯妫鏌ラ渶瑕Perl鏀寔銆傝鍙傝2.13鑺傦紝鈥淧erl瀹夎娉ㄦ剰浜嬮」鈥

7.    灏嗕笅闈㈢殑鐩綍浠workdir鐩綍澶嶅埗鍒C\mysql鐩綍锛

8.            C:\> cd \workdir
9.            C:\workdir> copy client_release\*.exe C:\mysql\bin
10.        C:\workdir> copy client_debug\mysqld.exe C:\mysql\bin\mysqld-debug.exe
11.        C:\workdir> xcopy scripts\*.* C:\mysql\scripts /E
12.        C:\workdir> xcopy share\*.* C:\mysql\share /E

濡傛灉鎯宠缂栬瘧鍏跺畠瀹㈡埛绔▼搴忓苟杩炴帴鍒MySQL锛岃繕搴斿綋澶嶅埗鍑犱釜搴撳拰澶存枃浠讹細

C:\workdir> copy lib_debug\mysqlclient.lib C:\mysql\lib\debug
C:\workdir> copy lib_debug\libmysql.* C:\mysql\lib\debug
C:\workdir> copy lib_debug\zlib.* C:\mysql\lib\debug
C:\workdir> copy lib_release\mysqlclient.lib C:\mysql\lib\opt
C:\workdir> copy lib_release\libmysql.* C:\mysql\lib\opt
C:\workdir> copy lib_release\zlib.* C:\mysql\lib\opt
C:\workdir> copy include\*.h C:\mysql\include
C:\workdir> copy libmysql\libmysql.def C:\mysql\include

濡傛灉浣犳兂瑕佸MySQL杩涜鍩哄噯娴嬭瘯锛屼綘杩樺簲褰擄細

C:\workdir> xcopy sql-bench\*.* C:\mysql\bench /E

鎸夌収浜岃繘鍒Windows鍒嗗彂鐗堢浉鍚岀殑鏂规硶璁剧疆骞跺惎鍔ㄦ湇鍔″櫒銆傝鍙傝2.3鑺傦紝鈥滃湪Windows涓婂畨瑁匨ySQL鈥

2.8.6.2. 浠庢渶鏂扮殑寮鍙戞簮鐮佸垱寤篧indows婧愮爜瀹夎鍖

瑕佹兂浠庡綋鍓嶇殑BitKeeper婧愮爜鏍戝垱寤Windows婧愮爜瀹夎鍖咃紝浣跨敤涓嬮潰鐨勮鏄庛傝娉ㄦ剰蹇呴』鍦ㄨ繍琛Unix鎴栫被Unix鎿嶄綔绯荤粺鐨勭郴缁熶笂鎵ц璇ヨ繃绋嬨備緥濡傦紝宸茬煡璇ヨ繃绋嬪湪Linux涓婂伐浣滃緱寰堝ソ銆

1.    澶嶅埗MySQL 5.1BitKeeper婧愮爜鏍戙傚叧浜庡浣曞鍒舵簮鐮佹爲鐨勮缁嗕俊鎭紝鐩稿叧璇存槑鍙傝2.8.3鑺傦紝鈥滀粠寮鍙戞簮鐮佹爲瀹夎鈥

2.    閰嶇疆鍜屾瀯寤哄垎鍙戠増锛屽緱鍒板彲宸ヤ綔鐨勬湇鍔″櫒浜岃繘鍒躲傚疄鐜扮殑涓涓柟娉曟槸鍦ㄦ簮鐮佹爲椤剁骇鐩綍杩愯涓嬮潰鐨勫懡浠わ細

3.            shell> ./BUILD/compile-pentium-max

4.    纭繚鏋勫缓杩囩▼鎴愬姛瀹屾垚鍚庯紝浠庢簮鐮佹爲椤剁骇鐩綍杩愯涓嬮潰鐨勫疄鐢ㄥ伐鍏疯剼鏈細

5.            shell> ./scripts/make_win_src_distribution

璇ヨ剼鏈垱寤哄湪Windows 绯荤粺涓娇鐢ㄧ殑婧愮爜瀹夎鍖呫傚彲浠ユ牴鎹綘鐨勯渶姹備负鑴氭湰鎻愪緵涓嶅悓鐨勯夐」銆傚畠鎺ュ彈涓嬮潰鐨勯夐」锛

         --help

鏄剧ず甯姪娑堟伅銆

         --debug

鎵撳嵃鍏充簬鑴氭湰鎿嶄綔鐨勪俊鎭紝涓嶅垱寤哄寘銆

         --tmp

鎸囧畾涓存椂浣嶇疆銆

         --suffix

瀹夎杞欢鍖呭悗缂鍚嶃

         --dirname

澶嶅埗鏂囦欢鐨勭洰褰曞悕(濯掍粙涔嬮棿)

         --silent

涓嶆墦鍗版澶勭悊鏂囦欢鐨勮缁嗗垪琛ㄣ

         --tar

鍒涘缓tar.gz瀹夎杞欢鍖呰屼笉鏄.zip瀹夎杞欢鍖呫

榛樿鎯呭喌锛make_win_src_distribution鍒涘缓Zip-鏍煎紡鐨勬枃浠讹紝鏂囦欢鍚嶄负mysql-VERSION-win-src.zip锛屽叾涓VERSION浠h〃MySQL婧愮爜鏍戠殑鐗堟湰銆

6.    灏嗗垱寤虹殑Windows婧愮爜瀹夎鍖呭鍒舵垨涓婅浇鍒Windows鏈哄櫒涓娿傝鎯崇紪璇戯紝浣跨敤2.8.6.1鑺傦紝鈥滀娇鐢╒C++鏋勫缓MySQL鈥涓殑璇存槑銆

2.8.7. 鍦╓indows涓嬬紪璇慚ySQL瀹㈡埛绔

鍦ㄦ簮鐮佹枃浠朵腑锛屽簲褰撳湪MySQL.h涔嬪墠鍖呮嫭my_global.h

#include <my_global.h>
#include <mysql.h>

my_global.h鍖呮嫭浣犲湪Windows涓紪璇戠▼搴忔墍闇瑕佺殑Windows鍏煎鏂囦欢(渚嬪 windows.h)

鍙互灏嗕唬鐮佽繛鎺ュ埌鍔ㄦlibmysql.lib搴擄紝瀹冨彧鏄竴涓寘瑁呭櫒浠ヤ究鏍规嵁闇瑕佽杞libmysql.dll锛屾垨杩炴帴闈欐mysqlclient.lib搴撱

MySQL瀹㈡埛绔簱缂栬瘧涓虹嚎绋嬪簱锛屽洜姝や綘搴斿綋灏嗕唬鐮佺紪璇戜负澶氱嚎绋嬨

2.9. 瀹夎鍚庣殑璁剧疆鍜屾祴璇

瀹夎瀹MySQL鍚庯紝鏈変竴浜涢棶棰樹綘搴斿綋澶勭悊銆備緥濡傦紝鍦Unix涓紝浣犲簲褰撳垵濮嬪寲鏁版嵁鐩綍骞跺垱寤MySQL鎺堟潈琛ㄣ傚浜庢墍鏈夊钩鍙帮紝涓涓噸瑕佸畨鍏ㄩ棶棰樻槸 鎺堟潈琛ㄤ腑鐨勫垵濮嬭处鎴锋病鏈夊瘑鐮併備綘搴斿綋鎸囧畾瀵嗙爜浠ラ槻姝㈡湭鎺堟潈璁块棶MySQL鏈嶅姟鍣ㄣ備綘鍙互鍒涘缓鏃跺尯琛ㄤ互璇嗗埆鍛藉悕鐨勬椂鍖恒(鐩墠锛屽彧鍦Unix涓婅浜嗚繖浜涜〃銆備笉涔呭皢鍦Windows涓В鍐宠闂锛

涓嬮潰绔犺妭鍖呮嫭閫傜敤Windows绯荤粺鍜Unix绯荤粺鐨勫畨瑁呭悗鐨勮繃绋嬨傚彟涓鑺傦紝2.9.2.3鑺傦紝鈥滃惎鍔∕ySQL鏈嶅姟鍣ㄤ互鍙婂叾鏁呴殰璇婃柇鍜屾帓闄も锛岄傜敤鎵鏈夊钩鍙帮紱瀹冩弿杩颁簡鍚姩鏈嶅姟鍣ㄦ椂閬囧埌闂鏃跺浣曡В鍐炽2.9.3鑺傦紝鈥滀娇鍒濆MySQL璐︽埛瀹夊叏鈥涔熼傜敤鎵鏈夊钩鍙般備綘搴斿綋鎸夌収璇存槑纭繚浣犲凡缁忔纭湴涓轰綘鐨MySQL璐︽埛鎸囧畾瀵嗙爜鏉ヤ繚鎶ゅ叾瀹夊叏銆

濡傛灉浣犲噯澶囧垱寤哄叾瀹冪敤鎴疯处鎴凤紝浣犲彲浠ュ湪5.7鑺傦紝鈥淢ySQL璁块棶鏉冮檺绯荤粺鈥5.8鑺傦紝鈥淢ySQL鐢ㄦ埛璐︽埛绠$悊鈥鎵惧埌鍏充簬MySQL璁块棶鎺у埗绯荤粺鍜岃处鎴风鐞嗙殑淇℃伅銆

2.9.1. Windows涓嬪畨瑁呭悗鐨勮繃绋

Windows涓紝涓嶉渶瑕佸垱寤烘暟鎹洰褰曞拰鎺堟潈琛ㄣMySQL Windows鍒嗗彂鐗堝寘鎷湪鏁版嵁鐩綍涓嬬殑MySQL鏁版嵁搴撲腑鐨勪竴濂楅鍒濆鍖栫殑璐︽埛鐨 鎺堟潈琛ㄣ備笉瑕佽繍琛Unix涓娇鐢ㄧ殑mysql_install_db鑴氭湰銆備絾鏄紝濡傛灉浣犳病鏈変娇鐢Windows Installation Wizard锛堝畨瑁呭府鍔╋級鏉ュ畨瑁MySQL锛屽簲褰撲负璐︽埛鎸囧畾瀵嗙爜銆傝鍙傝2.3.4.1鑺傦紝鈥滃墠瑷鈥銆傚湪2.9.3鑺傦紝鈥滀娇鍒濆MySQL璐︽埛瀹夊叏鈥

璁剧疆瀵嗙爜鍓嶏紝浣犲彲鑳芥兂瑕佽繍琛屼竴浜涘鎴风绋嬪簭鏉ョ‘淇濅綘鑳藉杩炴帴鏈嶅姟鍣紝骞朵笖鎿嶄綔姝g‘銆傜‘淇濇湇鍔″櫒鍦ㄨ繍琛(鍙傝2.3.10鑺傦紝鈥滈娆″惎鍔ㄦ湇鍔″櫒鈥)锛岀劧鍚庡彂鍑轰笅闈㈢殑鍛戒护鏉ラ獙璇佷綘鍙互浠庢湇鍔″櫒鑾峰彇淇℃伅銆傝緭鍑哄簲褰撶被浼间簬锛

C:\> C:\mysql\bin\mysqlshow
+-----------+
| Databases |
+-----------+
| mysql     |
| test      |
+-----------+
 
C:\> C:\mysql\bin\mysqlshow mysql
Database: mysql
+--------------+
|    Tables    |
+--------------+
| columns_priv |
| db           |
| func         |
| host         |
| tables_priv  |
| user         |
+--------------+
 
C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM db" mysql
+------+-------+------+
| host | db    | user |
+------+-------+------+
| %    | test% |      |
+------+-------+------+

濡傛灉浣犳杩愯鏀寔鏈嶅姟鐨Windows鐗堟湰锛屼綘鎯宠MySQL鏈嶅姟鍣ㄥ湪Windows鍚姩鏃惰嚜鍔ㄨ繍琛岋紝鍙傝2.3.12鑺傦紝鈥滀互Windows鏈嶅姟鏂瑰紡鍚姩MySQL鈥

2.9.2. Unix涓嬪畨瑁呭悗鐨勮繃绋

Unix涓婂畨瑁MySQL鍚庯紝闇瑕佸垵濮嬪寲 鎺堟潈琛ㄣ佸惎鍔ㄦ湇鍔″櫒锛屽苟纭繚鏈嶅姟鍣ㄥ伐浣滄甯搞備綘杩樿璁╂湇鍔″櫒闅忕郴缁熺殑鍚姩鍜屽仠姝㈣嚜鍔ㄥ惎鍔ㄥ拰鍋滄銆傚簲褰撲负鎺堟潈琛ㄤ腑鐨勮处鎴锋寚瀹氬瘑鐮併

Unix涓紝鐢mysql_install_db璁剧疆 鎺堟潈琛ㄣ傚湪鏌愪簺瀹夎涓紝璇ョ▼搴忚嚜鍔ㄨ繍琛岋細

         濡傛灉浣犱娇鐢RPM鍒嗗彂鐗堝湪Linux涓婂畨瑁MySQL锛屾湇鍔″櫒RPM杩愯mysql_install_db

         濡傛灉浣犱娇鐢PKG鍒嗗彂鐗堝湪Mac OS X涓婂畨瑁MySQL锛屽畨瑁呭櫒杩愯mysql_install_db

鍚﹀垯锛屼綘闇瑕佽嚜宸辫繍琛mysql_install_db

涓嬮潰鐨勮繃绋嬫弿杩颁簡濡備綍鍒濆鍖栨巿鏉冭〃 (濡傛灉杩樻病鏈夊垵濮嬪寲)骞跺惎鍔ㄦ湇鍔″櫒銆傝繕鎺ㄨ崘浜嗕竴浜涗綘鍙互鐢ㄦ潵娴嬭瘯鏈嶅姟鍣ㄦ槸鍚﹀彲浠ヨ闂互鍙婃槸鍚﹀伐浣滄纭殑鍛戒护銆傚叧浜庤嚜鍔ㄥ惎鍔ㄥ拰鍋滄鏈嶅姟鍣ㄧ殑淇℃伅锛屽弬瑙2.9.2.2鑺傦紝鈥滆嚜鍔ㄥ惎鍔ㄥ拰鍋滄MySQL鈥

浣犲畬鎴愯繃绋嬪苟璁╂湇鍔″櫒杩愯鍚庯紝浣犲簲褰撲负mysql_install_db鍒涘缓鐨勮处鎴锋寚瀹氬瘑鐮併2.9.3鑺傦紝鈥滀娇鍒濆MySQL璐︽埛瀹夊叏鈥涓垪鍑轰簡鐩稿叧璇存槑銆

鍦ㄦ湰鑺傜殑渚嬪瓙涓紝鏈嶅姟鍣ㄧ敤MySQL鐧诲綍璐︽埛鐨勭敤鎴ID杩愯銆傚亣瀹氬瓨鍦ㄨ繖鏍风殑璐︽埛銆傚鏋滀笉瀛樺湪锛岃涔堝垱寤鸿处鎴凤紝鎴栫敤鍏跺畠宸叉湁鐨勭敤鏉ヨ繍琛屾湇鍔″櫒鐨勭櫥褰曡处鎴锋潵鏇夸唬銆

1.    杩涘叆MySQL鐨勯《绾у畨瑁呯洰褰曪紝姝ゅ涓BASEDIR

2.            shell> cd BASEDIR

BASEDIR鍙兘涓/usr/local/mysql /usr/local銆備互涓嬫楠ゅ亣瀹氫綘浣嶄簬璇ョ洰褰曘

3.    鏍规嵁闇瑕侊紝杩愯mysql_install_db 绋嬪簭璁剧疆鍚湁纭畾濡備綍璁╃敤鎴疯繛鎺ユ湇鍔″櫒鐨勬潈闄愮殑鍒濆MySQL鎺堟潈琛ㄣ傚鏋滀綘浣跨敤鐨勫垎鍙戠増绫诲瀷涓嶈兘杩愯绋嬪簭锛屼綘闇瑕佹墽琛岃姝ラ銆

鍏稿瀷锛屽彧鏈夐娆″畨瑁MySQL鏃讹紝鎵嶉渶瑕佽繍琛mysql_install_db锛屽洜姝ゅ鏋滀綘鍗囩骇宸叉湁鐨勫畨瑁呬綘鍙互璺宠繃璇ユ楠わ紝浣mysql_install_db涓嶄細瑕嗙洊宸叉湁鐨 鎺堟潈琛紝鍥犳鍙互鍦ㄤ换浣曠幆澧冧笅瀹夊叏杩愯銆

瑕佹兂鍒濆鍖栨巿鏉冭〃锛屾牴鎹mysql_install_db鏄綅浜bin杩樻槸scripts鐩綍涓嬶紝浣跨敤涓嬮潰鐨勪竴涓懡浠わ細

shell> bin/mysql_install_db --user=mysql
shell> scripts/mysql_install_db --user=mysql

mysql_install_db鑴氭湰鍒涘缓鏁版嵁鐩綍銆佹嫢鏈夋墍鏈夋暟鎹簱鏉冮檺鐨mysql鏁版嵁搴撳拰鍙互鐢ㄦ潵娴嬭瘯MySQLtest鏁版嵁搴撱傝剼鏈负root璐︽埛鍜屽尶鍚嶇敤鎴疯处鎴峰垱寤 鎺堟潈琛ㄦ潯鐩傝处鎴蜂竴寮濮嬫病鏈夊瘑鐮併2.9.3鑺傦紝鈥滀娇鍒濆MySQL璐︽埛瀹夊叏鈥涓弿杩颁簡鍒濆鏉冮檺銆傜畝鍗曡锛岃繖浜涙潈闄愬厑璁MySQL root鐢ㄦ埛鎵ц浠讳綍鎿嶄綔锛屽厑璁镐换浣曚汉浣跨敤test鍚嶅垱寤烘垨浣跨敤鏁版嵁搴撴垨鐢test_鍚姩銆

涓瀹氳纭繚鐢mysql鐧诲綍璐︽埛鎷ユ湁鏁版嵁搴撶洰褰曞拰鏂囦欢锛屼互渚垮湪浠ュ悗杩愯鏃 鏈嶅姟鍣ㄥ叿鏈夎銆佸啓璁块棶鏉冮檺銆備负姝わ紝濡傛灉浣犵敤root鐢ㄦ埛杩愯mysql_install_db锛屽簲褰撲娇鐢--user閫夐」銆傚惁鍒欙紝褰撲互mysql鐧诲綍鏃讹紝搴斿綋鎵ц鑴氭湰锛屼綘鍙互鐪佺暐鍛戒护涓殑--user閫夐」銆

mysql_install_dbmysql鏁版嵁搴撲腑鍒涘缓鍑犱釜琛紝鍖呮嫭userdbhosttables_privcolumns_privfunc浠ュ強鍏跺畠銆5.7鑺傦紝鈥淢ySQL璁块棶鏉冮檺绯荤粺鈥涓湁瀹屾暣鐨勫垪琛ㄥ拰鎻忚堪銆

濡傛灉浣犱笉鎯宠test鏁版嵁搴擄紝鍚姩鏈嶅姟鍣ㄥ悗锛屽彲浠ョ敤mysqladmin -u root drop test鍗告帀銆

濡傛灉鏈mysql_install_db鐩稿叧闂锛屽弬瑙2.9.2.1鑺傦紝鈥滀笌杩愯mysql_install_db鏈夊叧鐨勯棶棰

鏈変竴浜涢夋嫨杩愯mysql_install_db鑴氭湰,姝eMySQL鍒嗗彂鐗堜腑鎵鎻愪緵鐨勶細

         濡傛灉鎯宠鍒濆鏉冮檺涓庢爣鍑嗛粯璁ゅ间笉鍚岋紝浣犲彲浠ュ湪杩愯鍓嶄慨鏀mysql_install_db銆傜劧鑰岋紝鏈濂芥槸鍦ㄨ缃 鎺堟潈琛ㄥ悗浣跨敤GRANTREVOKE鏉ユ洿鏀规潈闄愩傛崲鍙ヨ瘽璇达紝浣犲彲浠ヨ繍琛mysql_install_db锛岀劧鍚庨氳繃MySQL root鐢ㄦ埛浣跨敤mysql -u rootMySQL鏉ヨ繛鎺ユ湇鍔″櫒锛屼互渚垮彂鍑GRANTREVOKE鍛戒护銆

濡傛灉浣犳兂瑕佸湪鍑犱釜鏈哄櫒涓婄敤鐩稿悓鐨勬潈闄愬畨瑁MySQL锛屽彲浠ュ皢GRANTREVOKE璇彞鏀惧叆涓涓枃浠朵腑锛屼互鑴氭湰鏂瑰紡鎵ц鏂囦欢锛岃繍琛mysql_install_db涔嬪悗浣跨敤mysql銆備緥濡傦細

shell> bin/ mysql_install_db --user=mysql
shell> bin/mysql -u root < your_script_file
 

杩欐牱锛屼綘灏卞彲浠ラ伩鍏嶅湪姣忓彴鏈哄櫒涓婃墜鍔ㄥ彂鍑哄懡浠ゃ

         瀹屽叏鍙互閲嶆柊鍒涘缓鎺堟潈琛ㄣ傚鏋滀綘鍒氬垰鐭ラ亾濡備綍浣跨敤GRANTREVOKE骞朵笖杩愯mysql_install_db 涔嬪悗杩涜浜嗚澶氫慨鏀癸紝鎯宠鍏抽棴琛ㄩ噸鏂板惎鍔紝浣犲彲鑳芥兂瑕佽繖鏍锋搷浣溿

瑕佹兂閲嶆柊鍒涘缓鎺堟潈琛紝浠庡惈鏈MySQL鏁版嵁搴撶殑鐩綍涓Щ璧版墍鏈 .frm.MYI.MYD鏂囦欢銆(杩欐槸鏁版嵁鐩綍涓嬮潰鐨mysql鐩綍锛屽綋浣犺繍琛mysqld --help 鏃讹紝鍒椾负datadir)銆傜劧鍚庡啀娆¤繍琛mysql_install_db 鑴氭湰銆

         鍙互浣跨敤--skip-grant-tables閫夐」鎵嬪姩鍚姩mysqld锛屽苟浣跨敤mysql鑷繁澧炲姞鏉冮檺淇℃伅锛

                      shell> bin/mysqld_safe --user=mysql --skip-grant-tables &
                      shell> bin/mysql mysql

鎵嬪姩浠mysql鎵цmysql_install_db涓殑SQL鍛戒护銆傜‘淇濆悗闈㈤挜杩愯mysqladmin flush-privilegesmysqladmin reload锛岃鏈嶅姟鍣ㄩ噸杞芥巿鏉冭〃銆

璇锋敞鎰忎笉浣跨敤mysql_install_db锛屼笉浠呴渶瑕佹墜鍔ㄥ畨瑁呮巿鏉冭〃锛岃繕闇瑕佸厛鍒涘缓銆

4.    鍚姩MySQL鏈嶅姟鍣細

5.                     shell> bin/mysqld_safe --user=mysql &

涓瀹氳璁MySQL鏈嶅姟鍣ㄤ娇鐢ㄩ潪鏉冮檺(non-root) 鐧诲綍璐︽埛杩愯銆備负姝わ紝濡傛灉浣犱互绯荤粺root杩愯mysql_safe锛屽簲褰撲娇鐢--user閫夐」銆傚惁鍒欙紝浣犲簲褰撶敤mysql鐧诲綍鍒扮郴缁熸潵鎵ц鑴氭湰锛岃繖鏍峰彲浠ョ渷鐣ュ懡浠や腑鐨--user閫夐」銆

A.3.2鑺傦紝鈥滃浣曚互鏅氱敤鎴疯韩浠借繍琛孧ySQL鈥涓粰鍑轰簡闈炵壒鏉冪敤鎴疯繍琛MySQL鐨勮鏄庛

濡傛灉鍦ㄦ墽琛岃姝ュ墠浣犲繕璁颁簡鍒涘缓鎺堟潈琛紝褰撲綘鍚姩鏈嶅姟鍣ㄦ椂锛屽湪閿欒鏃ュ織鏂囦欢涓皢鍑虹幇涓嬮潰鐨勬秷鎭細

mysqld: Can't find file: 'host.frm'

濡傛灉鍚姩鏈嶅姟鍣ㄦ椂閬囧埌鍏跺畠闂锛屾煡闃2.9.2.3鑺傦紝鈥滃惎鍔∕ySQL鏈嶅姟鍣ㄤ互鍙婂叾鏁呴殰璇婃柇鍜屾帓闄も

6.    浣跨敤mysqladmin楠岃瘉鏈嶅姟鍣ㄥ湪杩愯涓備互涓嬪懡浠ゆ彁渚涗簡绠鍗曠殑娴嬭瘯锛屽彲妫鏌ユ湇鍔″櫒鏄惁宸茬粡鍚姩骞惰兘鍝嶅簲杩炴帴锛

7.            shell> bin/mysqladmin version
8.            shell> bin/mysqladmin variables

 mysqladmin version鐨勮緭鍑烘牴鎹钩鍙板拰MySQL鐗堟湰鐨勪笉鍚岃岀◢鏈夊彉鍖栵紝浣嗘槸搴斿綋绫讳技浜庯細

shell> bin/mysqladmin version
mysqladmin  Ver 8.41 Distrib 5.1.2-alpha, for pc-linux-gnu on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
 
Server version          5.1.2-alpha-Max
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/lib/mysql/mysql.sock
Uptime:                 14 days 5 hours 5 min 21 sec
 
Threads: 1  Questions: 366  Slow queries: 0  
Opens: 0  Flush tables: 1  Open tables: 19  
Queries per second avg: 0.000
 

瑕佹兂鐪嬭繕鍙互鎬庢牱浣跨敤mysqladmin锛岀敤-- help閫夐」璋冪敤瀹冦

9.    楠岃瘉鍙互鍏抽棴鏈嶅姟鍣細

10.        shell> bin/mysqladmin -u root shutdown

11.楠岃瘉鏄惁鍙互閲嶅惎鏈嶅姟鍣ㄣ傚彲浠ョ洿鎺ヤ娇鐢mysqld_safe鎴栬皟鐢mysqld銆備緥濡傦細

12.        shell> bin/mysqld_safe --user=mysql --log &

濡傛灉mysqld_safe澶辫触锛屽弬瑙2.9.2.3鑺傦紝鈥滃惎鍔∕ySQL鏈嶅姟鍣ㄤ互鍙婂叾鏁呴殰璇婃柇鍜屾帓闄も

13.杩涜涓浜涚畝鍗曠殑娴嬭瘯锛岄獙璇佷綘鍙互浠庢湇鍔″櫒鏌ヨ淇℃伅銆傝緭鍑哄簲褰撶被浼间簬锛

14.        shell> bin/mysqlshow
15.        +-----------+
16.        | Databases |
17.        +-----------+
18.        | mysql     |
19.        | test      |
20.        +-----------+
21.         
22.        shell> bin/mysqlshow mysql
23.        Database: mysql
24.        +---------------------------+
25.        |          Tables           |
26.        +---------------------------+
27.        | columns_priv              |
28.        | db                        |
29.        | func                      |
30.        | help_category             |
31.        | help_keyword              |
32.        | help_relation             |
33.        | help_topic                |
34.        | host                      |
35.        | proc                      |
36.        | procs_priv                |
37.        | tables_priv               |
38.        | time_zone                 |
39.        | time_zone_leap_second     |
40.        | time_zone_name            |
41.        | time_zone_transition      |
42.        | time_zone_transition_type |
43.        | user                      |
44.        +---------------------------+
45.         
46.        shell> bin/mysql -e "SELECT Host,Db,User FROM db" mysql
47.        +------+--------+------+
48.        | host | db     | user |
49.        +------+--------+------+
50.        | %    | test   |      |
51.        | %    | test_% |      |
52.        +------+--------+------+

53.sql-bench鐩綍(MySQL瀹夎鐩綍涓)涓湁涓涓熀鍑嗗浠讹紝鍙互鐢ㄦ潵姣旇緝MySQL鍦ㄤ笉鍚屽钩鍙颁笂鐨勬墽琛屾儏鍐点傚熀鍑嗗浠跺湪Perl涓紪鍐欍傚畠浣跨敤Perl DBI妯″潡鏉ヤ负鍚勭鏁版嵁搴撴彁渚涗竴涓笌鏁版嵁搴撴棤鍏崇殑鎺ュ彛锛屽苟涓旇繕闇瑕佸叾瀹Perl妯″潡鏉ヨ繍琛屽熀鍑嗗浠躲傚繀椤诲畨瑁呬互涓嬫ā鍧楋細

54.        DBI
55.        DBD::mysql
56.        Data::Dumper
57.        Data::ShowTable

鍙互浠CPAN(http://www.cpan.org/)鑾峰緱杩欎簺妯″潡銆傝鍙傝2.13.1鑺傦紝鈥滃湪Unix涓畨瑁匬erl鈥

 sql-bench/Results鐩綍鍖呭惈浜嗗湪涓嶅悓鏁版嵁搴撳拰骞冲彴涓婄殑鍚勭杩愯缁撴灉銆傝鎯宠繘琛屾祴璇曪紝鎵ц鍛戒护锛

shell> cd sql-bench
shell> perl run-all-tests

濡傛灉娌℃湁sql-bench鐩綍锛屼綘鍙兘浣跨敤RPM鏂囦欢瀹夎浜MySQL锛屾病鏈変娇鐢ㄦ簮鐮RPM(婧愮爜RPM鍖呮嫭sql-bench benchmark鐩綍锛姝ゆ椂锛屽繀椤诲厛瀹夎鍩哄噯濂椾欢鍚庢墠鑳戒娇鐢ㄣ傛湁涓涓崟鐙殑mysql-bench-VERSION-i386.rpm鍩哄噯RPM鏂囦欢锛屽叾涓寘鍚簡鍩哄噯浠g爜鍜屾暟鎹

濡傛灉浣犳湁婧愮爜鍒嗗彂鐗堬紝鍏tests瀛愮洰褰曚腑涔熸湁涓浜涙祴璇曞彲渚涜繍琛屻備緥濡傦紝瑕佽繍琛auto_increment.tst锛屼粠婧愮爜鍒嗗彂鐗堢殑椤剁骇鐩綍鎵ц璇ュ懡浠わ細

shell> mysql -vvf test < ./tests/auto_increment.tst

鏈熸湜鐨勭粨鏋滆鏄剧ず鍦 ./tests/auto_increment.res鏂囦欢涓

58.鑷虫锛屼綘搴斿綋鍙互杩愯鏈嶅姟鍣ㄤ簡銆傜劧鑰岋紝鍒濆MySQL璐︽埛鍧囨病鏈夊瘑鐮侊紝鍥犳搴斿綋浣跨敤2.9.3鑺傦紝鈥滀娇鍒濆MySQL璐︽埛瀹夊叏鈥涓殑璇存槑鏉ユ寚瀹氬瘑鐮併

MySQL 5.1瀹夎杩囩▼鍦MySQL鏁版嵁搴撲腑鍒涘缓鏃跺尯琛ㄣ備絾鏄紝蹇呴』鎵嬪姩瑁呰浇琛ㄣ傜浉鍏宠鏄庡弬瑙5.10.8鑺傦紝鈥淢ySQL鏈嶅姟鍣ㄦ椂鍖烘敮鎸佲

2.9.2.1. 涓庤繍琛宮ysql_install_db鏈夊叧鐨勯棶棰

mysql_install_db 鑴氭湰鐨勭洰鐨勬槸鐢熸垚鏂扮殑MySQL鎺堟潈琛ㄣ傚畠涓嶈鐩栧凡鏈夌殑MySQL鎺堟潈琛紝骞朵笖瀹冧笉褰卞搷浠讳綍鍏跺畠鏁版嵁銆

濡傛灉浣犳兂瑕侀噸鏂板垱寤烘巿鏉冭〃锛岄鍏堝仠姝mysqld鏈嶅姟鍣紙濡傛灉瀹冩杩愯锛夈傜劧鍚庨噸鏂板懡鍚嶆暟鎹洰褰曚笅鐨MySQL鐩綍骞朵繚瀛橈紝鐒跺悗杩愯mysql_install_db銆備緥濡傦細

shell> mv mysql-data-directory/mysql mysql-data-directory/mysql-old
shell> mysql_install_db --user=mysql

鏈妭鍒楀嚭浜嗚繍琛mysql_install_db鏃朵綘鍙兘閬囧埌鐨勯棶棰橈細

         mysql_install_db fails to install the grant tables

浣犱細鍙戠幇mysql_install_db涓嶈兘瀹夎 鎺堟潈琛紝鏄剧ず涓嬮潰鐨勬秷鎭悗缁堟锛

Starting mysqld daemon with databases from XXXXXX
mysqld ended

鍦ㄨ繖绉嶆儏鍐典笅锛屼綘搴旇寰堝皬蹇冨湴妫楠屾棩蹇楁枃浠讹紒鏃ュ織鏂囦欢搴旇浣嶄簬鐩綍XXXXXX锛岀敤閿欒娑堟伅鍛藉悕锛屽苟涓斿簲璇ユ寚鍑轰负浠涔mysqld娌″惎鍔ㄣ傚鏋滀綘涓嶇悊瑙e彂鐢熺殑浜嬫儏锛岄偖瀵勪竴浠介敊璇姤鍛婏紝鍖呭惈鏃ュ織鏂囦欢锛佸弬瑙1.7.1.3鑺傦紝鈥滃浣曢氭姤缂洪櫡鍜岄棶棰樷

         宸茬粡鏈変竴涓amysqld杩涚▼鍦ㄨ繍琛

琛ㄧず鏈嶅姟鍣ㄥ湪杩愯锛岃繖绉嶆儏鍐典笅鍙兘宸茬粡鍒涘缓浜嗘巿鏉冭〃銆傚鏋滃姝わ紝鍒欎笉鍐嶉渶瑕佽繍琛mysql_install_db锛屽洜涓哄彧闇瑕佽繍琛屼竴娆(褰撲綘棣栨瀹夎MySQL)

         褰撲竴涓湇鍔″櫒姝h繍琛屾椂锛屽畨瑁呯浜屼釜鏈嶅姟鍣ㄤ笉宸ヤ綔

杩欏彧鏈夊湪褰撲綘宸茬粡鏈夊凡瀛樺湪鐨MySQL瀹夎浣嗘槸鎯宠鎶婃柊瀹夎鏀惧湪涓涓笉鍚岀殑鍦版柟鏃舵墠浼氬彂鐢熴備緥濡傦紝浣犲彲鑳藉凡缁忔湁浜嗕竴涓骇鍝佸畨瑁咃紝浣嗕负浜嗘祴璇曟兂瑕佸悓鏃惰繍琛2涓畨瑁呫傞氬父褰撲綘璇曠潃杩愯绗簩涓湇鍔″櫒鏃讹紝鍙戠敓鐨勯棶棰樻槸瀹冭瘯鍥惧拰绗竴涓娇鐢ㄥ悓鏍风殑濂楁帴瀛楀拰绔彛銆傚湪杩欑鎯呭喌涓嬶紝浣犲皢閬囧埌閿欒娑堟伅锛

Can't start server: Bind on TCP/IP port:
Address already in use
Can't start server: Bind on unix socket...

鍏充簬璁剧疆澶氫釜鏈嶅姟鍣ㄧ殑璇存槑锛屽弬瑙5.12鑺傦紝鈥滃湪鍚屼竴鍙版満鍣ㄤ笂杩愯澶氫釜MySQL鏈嶅姟鍣ㄢ

         浣犳病鏈 /tmp 鐨勫啓鏉冮檺

濡傛灉浣犳病鏈夊啓鏉冮檺鍦ㄩ粯璁や綅缃(/tmp)鍒涘缓涓涓Unix濂楁帴瀛楁枃浠讹紝鎴栨病鏈鍦ㄢ/tmp鍒涘缓涓存椂鏂囦欢鐨勮鍙紝鍦ㄨ繍琛mysql_install_dbmysqld鏈嶅姟鍣鏃讹紝浣犲皢閬囧埌涓涓敊璇

浣犲彲浠ュ湪寮濮mysql_install_dbmysqld涔嬪墠鎵ц浠ヤ笅鍛戒护鎸囧畾涓涓笉鍚岀殑Unix濂楁帴瀛楁枃浠朵綅缃拰涓存椂鐩綍锛

shell> TMPDIR=/some_tmp_dir/
shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysql.sock
shell> export TMPDIR MYSQL_UNIX_PORT

some_tmp_dir搴旇鏄綘鏈夊啓璁稿彲鐨勬煇涓洰褰曠殑鍏ㄨ矾寰勩

鐒跺悗锛屼綘搴斿綋鑳藉鐢ㄨ繖浜涘懡浠よ繍琛mysql_install_db骞跺惎鍔ㄦ湇鍔″櫒锛

shell> bin/mysql_install_db --user=mysql
shell> bin/mysqld_safe --user=mysql &

濡傛灉mysql_install_db浣嶄簬scripts鐩綍涓嬶紝棣栧厛淇敼鍛戒护scripts/mysql_install_db

鍙傝A.4.5鑺傦紝鈥滃浣曚繚鎶ゆ垨鏇存敼MySQL濂楁帴瀛楁枃浠/tmp/mysql.sock銆傝鍙傝闄勫綍F锛鐜鍙橀噺

2.9.2.2. 鑷姩鍚姩鍜屽仠姝ySQL

閫氬父浣犲彲浠ョ敤浠ヤ笅鏂规硶鍚姩mysqld鏈嶅姟鍣細

         鐩存帴璋冪敤mysqld銆傝鏂规硶閫傚悎浠讳綍骞冲彴銆

         浣滀负Windows鏈嶅姟杩愯MySQL鏈嶅姟鍣ㄣ傚彲浠ュ湪鏀寔鏈嶅姟鐨Windows鐗堟湰(渚嬪 NT2000XP2003)涓婂疄鐜般傚彲浠ュ皢鏈嶅姟璁剧疆涓哄湪Windows 鍚姩鏃惰嚜鍔ㄥ惎鍔ㄦ湇鍔″櫒锛屾垨鏍规嵁闇瑕佸惎鍔ㄧ殑鎵嬪姩鏈嶅姟銆傜浉鍏宠鏄庡弬瑙2.3.12鑺傦紝鈥滀互Windows鏈嶅姟鏂瑰紡鍚姩MySQL鈥

         璋冪敤mysqld_safe锛屽彲浠ヤ负mysqld纭畾姝g‘鐨勯夐」鐒跺悗浣跨敤杩欎簺閫夐」鏉ヨ繍琛屻傝鑴氭湰閫傜敤浜庡熀浜BSD Unix鐨勭郴缁熴傝鍙傝5.1.3鑺傦紝鈥渕ysqld_safe锛歁ySQL鏈嶅姟鍣ㄥ惎鍔ㄨ剼鏈

         璋冪敤mysql.server銆傝鑴氭湰涓昏鐢ㄤ簬浣跨敤绯荤粺V-style杩愯鐩綍鐨勭郴缁熺殑鍚姩鍜屽叧闂紝瀹冮氬父瀹夎鍒mysql涓嬨mysql.server鑴氭湰璋冪敤mysqld_safe鏉ュ惎鍔ㄦ湇鍔″櫒銆傝鍙傝5.1.4鑺傦紝鈥渕ysql.server锛歁ySQL鏈嶅姟鍣ㄥ惎鍔ㄨ剼鏈

         浣犲彲浠ュ湪Mac OS X涓婂畨瑁呬竴涓崟鐙殑MySQL Startup Item瀹夎鍖呮潵浣跨郴缁熷惎鍔ㄦ椂鑷姩鍚姩MySQLStartup Item璋冪敤mysql.server鏉ュ惎鍔ㄦ湇鍔″櫒銆傝缁嗕粙缁嶅弬瑙 2.5鑺傦紝鈥滃湪Mac OS X涓婂畨瑁匨ySQL鈥

mysql.servermysqld_safe鑴氭湰鍜Mac OS X Startup Item鍙互鐢ㄦ潵鎵嬪姩鍚姩鏈嶅姟鍣紝鎴栬嚜鍔ㄥ惎鍔ㄧ郴缁熴mysql.serverStartup Item杩樺彲浠ョ敤鏉ュ仠姝㈡湇鍔″櫒銆

mysql.server鑴氭湰鍙互琚敤鏉ュ惎鍔ㄦ垨鍋滄鏈嶅姟鍣紝閫氳繃鐢startstop鍙傛暟璋冪敤瀹冿細

shell> mysql.server start
shell> mysql.server stop

mysql.server鍚姩鏈嶅姟鍣ㄤ箣鍓嶏紝瀹冩妸鐩綍鏀瑰彉鍒MySQL瀹夎鐩綍锛岀劧鍚庤皟鐢safe_mysqld銆傚鏋滀綘鎯宠浣滀负涓浜涚壒瀹氱殑鐢ㄦ埛杩愯鏈嶅姟鍣紝鍦/etc/my.cnf閫夐」鏂囦欢鐨[mysqld]缁勫鍔犵浉搴user閫夐」锛屽鏈妭鍚庨潰鎵绀恒(濡傛灉浣犳湁鍦ㄤ竴涓潪鏍囧噯鐨勫湴鐐瑰畨瑁呯殑浜岃繘鍒跺垎鍙戠増锛屼綘鍙兘闇瑕佺紪杈mysql.server銆備慨鏀瑰畠锛岃繍琛safe_mysqld鍓嶏紝cd鍒版纭殑鐩綍銆傛敞鎰忓鏋滀綘淇敼mysql.server锛岄偅涔堟煇涓椂鍊欏崌绾MySQL鏃讹紝浣犵殑淇敼鐗堟湰灏嗚瑕嗙洊锛屽洜姝や綘搴旇鍋氫竴涓綘鍙噸鏂板畨瑁呯殑缂栬緫杩囩殑鐗堟湰鐨勬嫹璐濓級

mysql.server stop閫氳繃鍚戞湇鍔″櫒鍙戝嚭涓涓俊鍙峰仠姝㈠畠銆備綘鍙墜鍔ㄦ墽琛mysqladmin shutdown鍏抽棴鏈嶅姟鍣ㄣ

瑕佹兂鍦ㄦ湇鍔″櫒涓婅嚜鍔ㄥ惎鍔ㄥ拰鍋滄MySQL锛屽簲鍦/etc/rc * 鏂囦欢涓傚綋鐨勫湴鏂瑰鍔犲惎鍔ㄣ佸仠姝㈠懡浠ゃ

濡傛灉浣犱娇鐢Linux鏈嶅姟鍣RPM瀹夎杞欢鍖(MySQL-server-VERSION.rpm)mysql.server鑴氭湰瀹夎鍦/etc/init.d鐩綍涓紝鍚嶄负MySQL銆備綘涓嶉渶瑕佹墜鍔ㄥ畨瑁呭畠銆傚叧浜Linux RPM杞欢鍖呯殑璇︾粏淇℃伅鍙傝2.4鑺傦紝鈥滃湪Linux涓嬪畨瑁匨ySQL鈥

涓浜涗緵搴斿晢鎻愪緵鐨RPM杞欢鍖呭畨瑁呯殑鍚姩鑴氭湰鍚嶅瓧涓嶅悓锛屼緥濡mysqld

濡傛灉浠庝笉鑷姩瀹夎mysql.server鐨勬簮鐮佸垎鍙戠増鎴栦簩杩涘埗鍒嗗彂鐗堟牸寮忔潵瀹夎MySQL锛屽彲浠ユ墜鍔ㄥ畨瑁呭畠銆傚彲浠ュ湪MySQL瀹夎鐩綍涓嬫垨MySQL 婧愮爜鏍戠殑support-files鐩綍涓壘鍒拌剼鏈

瑕佹兂鎵嬪姩瀹夎mysql.server锛岀敤鍚嶇Оmysql灏嗗畠澶嶅埗鍒/etc/init.d鐩綍锛岀劧鍚庡皢瀹冨彉涓哄彲鎵ц鏂囦欢銆傚彧闇瑕佸皢浣嶇疆鏇存敼涓mysql.serveris鎵鍦ㄥ苟鎵ц杩欎簺鍛戒护鐨勭浉搴旂洰褰曪細

shell> cp mysql.server /etc/init.d/mysql
shell> chmod +x /etc/init.d/mysql

鏃х殑Red Hat绯荤粺浣跨敤/etc/rc.d/init.d鐩綍锛屼笉浣跨敤/etc/init.d銆傜浉搴斿湴璋冭妭鍓嶉潰鐨勫懡浠ゃ備篃鍙互棣栧厛鍒涘缓鎸囧悜/etc/rc.d/init.d鐨勭鍙疯繛鎺/etc/init.d

shell> cd /etc
shell> ln -s rc.d/init.d .

瀹夎鑴氭湰鍚庯紝鐢ㄦ潵婵娲诲畠浠ヤ究鍦ㄧ郴缁熷惎鍔ㄦ椂杩愯鎵闇瑕佺殑鍛戒护鍙栧喅浜庝綘鐨勬搷浣滅郴缁熴傚湪Linux涓紝浣犲彲浠ヤ娇鐢chkconfig

shell> chkconfig --addMySQL

鍦ㄤ竴浜Linux绯荤粺涓紝杩橀渶瑕佷笅闈㈢殑鍛戒护鏉ュ畬鍏ㄦ縺娲MySQL鑴氭湰锛

shell> chkconfig --level 345MySQL on

FreeBSD涓紝鍚姩鑴氭湰閫氬父搴斿綋浣嶄簬/usr/local/etc/rc.d/銆傛墜鍐岀殑rc(8)椤靛唴璇存槑鍙湁璇ョ洰褰曡剼鏈殑鍩烘湰鍚嶅尮閰*.sh shell鏂囦欢鍚嶆ā寮忥紝鑴氭湰鎵嶄細鎵ц銆傜洰褰曞唴鐨勫叾瀹冩枃浠舵垨鐩綍灏嗚蹇界暐鎺夈傛崲鍙ヨ瘽璇达紝鍦FreeBSD涓紝搴斿綋灏mysql.server鑴氭湰瀹夎涓 /usr/local/etc/rc.d/mysql.server.sh浠ヤ究鑷姩鍚姩銆

鍓嶉潰璁剧疆鐨勫彟涓绉嶆儏鍐垫槸锛屼竴浜涙搷浣滅郴缁熷惎鍔ㄦ椂涔熶娇鐢/etc/rc.local/etc/init.d/boot.local 鏉ュ惎鍔ㄥ叾瀹冩湇鍔°傝鎯充娇鐢ㄨ鏂规硶鍚姩MySQL锛屼綘鍙互鍦ㄧ浉搴斿惎鍔ㄦ枃浠跺悗闈㈣拷鍔犱竴鏉″懡浠わ細

/bin/sh -c 'cd /usr/local/mysql; ./bin/mysqld_safe --user=mysql &'

瀵逛簬鍏跺畠绯荤粺锛屾煡闃呮搷浣滅郴缁熺殑鏂囨。鏉ユ煡鐪嬪畨瑁呭惎鍔ㄨ剼鏈殑鏂规硶銆

浣犱篃鍙互鍦ㄤ竴涓叏灞/etc/my.cnf鏂囦欢涓鍔mysql.server鐨勯夐」銆備竴涓吀鍨鐨勨/etc/my.cnf鏂囦欢鍙兘鐪嬭捣鏉ュ儚杩欐牱锛

[mysqld]
datadir=/usr/local/mysql/var
socket=/var/tmp/mysql.sock
port=3306
user=mysql
 
[mysql.server]
basedir=/usr/local/mysql

mysql.server鑴氭湰浣跨敤涓嬪垪鍙橀噺锛basedirdatadirpid-file銆傚畾涔夊悗锛屽繀椤诲皢瀹冧滑鏀惧埌閫夐」鏂囦欢涓紝涓嶈兘鏀惧埌鍛戒护琛屻mysql.server鍙瘑鍒startstop鍛戒护琛屽弬鏁般

涓嬮潰鐨勮〃鏄剧ず浜嗘湇鍔″櫒鍜屾瘡涓惎鍔ㄨ剼鏈粠閫夐」鏂囦欢璇诲彇鍝釜閫夐」缁勶細

鑴氭湰

閫夐」缁

mysqld

[mysqld], [server], [mysqld-major-version]

mysql.server

[mysqld], [mysql.server], [server]

mysqld_safe

[mysqld], [server], [mysqld_safe]

[mysqld-major-version]鎰忓懗鐫鍚嶄负[mysqld-5.0][mysqld-5.1]鐢ㄤ簬鐗堟湰涓5.0.x5.1.x绛夌殑鏈嶅姟鍣ㄣ傝鐗规у彲浠ョ敤鏉ユ寚瀹氬彧琚粰瀹氬彂甯冪郴鍒楃殑鏈嶅姟鍣ㄨ鍙栫殑閫夐」銆

涓轰簡鍚戝悗鍏煎锛mysql.server杩樿鍙[mysql_server]缁勶紝mysqld_safe杩樿鍙[safe_mysqld]缁勩傜劧鑰岋紝褰撲娇鐢MySQL 5.1鏃讹紝浣犲簲褰撴洿鏂伴夐」鏂囦欢锛屼娇鐢[mysql.server][mysqld_safe]缁勩

鍙傝4.3.2鑺傦紝鈥滀娇鐢ㄩ夐」鏂囦欢鈥

2.9.2.3. 鍚姩MySQL鏈嶅姟鍣ㄤ互鍙婂叾鏁呴殰璇婃柇鍜屾帓闄

濡傛灉鍚姩鏈嶅姟鍣ㄦ椂鏈夐棶棰橈紝鍙互灏濊瘯锛

         鎸囧畾浣犱娇鐢ㄧ殑鍌ㄥ瓨寮曟搸闇瑕佺殑浠讳綍鐗规畩閫夐」銆

         纭繚鏈嶅姟鍣ㄧ煡閬撲粠鍝噷鎵惧埌鏁版嵁鐩綍銆

         纭繚鏈嶅姟鍣ㄥ彲浠ヤ娇鐢ㄦ暟鎹洰褰曘傛暟鎹洰褰曞拰鍐呭鐨勬墍鏈夋潈鍜屽厑璁稿繀椤昏缃垚鏈嶅姟鍣ㄥ彲浠ヨ闂拰淇敼瀹冧滑銆

         妫鏌ラ敊璇棩蹇楁煡鐪嬫湇鍔″櫒涓轰綍涓嶅惎鍔ㄣ

         楠岃瘉鏈嶅姟鍣ㄦ兂瑕佷娇鐢ㄧ殑缃戠粶鎺ュ彛鍙敤銆

涓浜涘偍瀛樺紩鎿庢湁涓浜涢夐」鍙互鎺у埗鍏惰涓恒備綘鍙互鍒涘缓涓涓my.cnf鏂囦欢骞朵负璁″垝浣跨敤鐨勫紩鎿庤缃惎鍔ㄩ夐」銆傚鏋滀綘灏嗚浣跨敤鏀寔浜嬪姟澶勭悊琛 (InnoDBBDB)鐨勫偍瀛樺紩鎿庯紝搴旂‘淇濆惎鍔ㄦ湇鍔″櫒涔嬪墠鎸夌収浣犵殑鏈熸湜瀵瑰畠浠繘琛屼簡閰嶇疆锛

         濡傛灉浣犳浣跨敤InnoDB琛紝鍙傞槄InnoDB-specific鍚姩閫夐」銆傚鏋滀綘鏈寚瀹氶夐」锛InnoDB浣跨敤榛樿鍊间綔涓洪厤缃夐」銆傝鍙傝15.2.3鑺傦紝鈥淚nnoDB閰嶇疆鈥

         濡傛灉浣犳浣跨敤BDB (Berkeley DB)琛紝浣犲簲褰撶啛鎮変笉鍚岀殑BDB-specific鍚姩閫夐」銆傝鍙傝15.5.3鑺傦紝鈥淏DB鍚姩閫夐」鈥

mysqld鏈嶅姟鍣ㄥ惎鍔ㄦ椂锛屽畠杩涘叆鏁版嵁鐩綍銆傚湪杩欓噷瀹冨彲浠ユ壘鍒版暟鎹簱骞跺啓鍏ユ棩蹇楁枃浠躲傚湪Unix涓紝鏈嶅姟鍣ㄨ繕鍦ㄦ暟鎹洰褰曚腑鍐pid(杩囩▼ ID)鏂囦欢銆

褰撶紪璇戞湇鍔″櫒鏃剁‘瀹氭暟鎹洰褰曘傝繖鏄湇鍔″櫒榛樿瀵绘壘鏁版嵁鐩綍鐨勪綅缃傚鏋滄暟鎹洰褰曚綅浜庣郴缁熶腑鐨勫叾瀹冧綅缃紝鏈嶅姟鍣ㄤ笉鑳芥纭伐浣溿傜敤--verbose--help閫夐」璋冪敤mysqld浣犲彲浠ユ壘鍑洪粯璁よ矾寰勮瀹氬笺

濡傛灉榛樿鍊间笌浣犵殑绯荤粺涓殑MySQL瀹夎甯冨眬涓嶅尮閰嶏紝浣犲彲浠ュ湪鍛戒护琛屼腑涓mysqld mysqld_safe鎸囧畾閫夐」鏉ヨ鐩栧畠浠備綘杩樺彲浠ュ湪閫夐」鏂囦欢涓垪鍑洪夐」銆

瑕佹兂鏄庢樉鎸囧畾鏁版嵁鐩綍鐨勪綅缃紝浣跨敤--datadir閫夐」銆備竴鑸儏鍐典笅锛屼綘鍙互鍛婅瘔mysqld鍩烘湰鐩綍鐨勪綅缃紝MySQL瀹夎鍦ㄨ鐩綍涓嬶紝骞朵笖瀹冨湪璇ョ洰褰曚腑瀵绘壘鏁版嵁鐩綍銆備綘鍙互浣跨敤--basedir閫夐」鏉ュ疄鐜般

瑕佹兂妫鏌ユ寚瀹氳矾寰勯夐」鐨勭粨鏋滐紝鐢--verbose--help閫夐」璋冪敤mysqld銆備緥濡傦紝濡傛灉浣犺繘鍏mysqld鐨勫畨瑁呯洰褰曪紝鐒跺悗杩愯涓嬮潰鐨勫懡浠わ紝瀹冩樉绀哄惎鍔ㄦ湇鍔″櫒鐨勭粨鏋滐紝鍩烘湰鐩綍涓/usr/local

shell> ./mysqld --basedir=/usr/local --verbose --help

浣犲彲浠ユ寚瀹氬叾瀹冮夐」锛屼緥濡--datadir锛屼絾鏄娉ㄦ剰--verbose--help蹇呴』涓烘渶鍚庣殑閫夐」銆

涓鏃︿綘纭畾浜嗕綘鎯宠鐨勮矾寰勮瀹氬硷紝鐢--verbose-- help鍚姩鏈嶅姟鍣ㄣ

濡傛灉mysqld姝e湪杩愯锛屾墽琛屼笅鍒楀懡浠や綘鍙互鎵惧嚭瀹冩墍浣跨敤鐨勮矾寰勮瀹氬硷細

shell> mysqladmin variables

鎴栵細

shell> mysqladmin -h host_name variables

host_nameMySQL鏈嶅姟鍣ㄤ富鏈虹殑鍚嶇О銆

濡傛灉鍚姩mysqld鏃堕亣鍒Errcode 13(鎰忓懗鐫Permission denied)锛岃繖鎰忓懗鐫鏁版嵁鐩綍鎴栧叾鍐呭鐨勮闂潈闄愪笉鍏佽鏈嶅姟鍣ㄨ闂傛鏃讹紝浣犻渶瑕佹洿鏀规墍璋冪敤鏂囦欢鍜岀洰褰曠殑鏉冮檺锛屼娇鏈嶅姟鍣ㄦ湁鏉冧娇鐢ㄥ畠浠備綘杩樺彲浠ョ敤root鍚姩鏈嶅姟鍣紝浣嗘槸杩欐牱浼氶犳垚瀹夊叏闂锛屽簲褰撻伩鍏嶃

Unix涓紝杩涘叆鏁版嵁鐩綍锛屾鏌ユ暟鎹洰褰曞拰鍏跺唴瀹圭殑鎵鏈夋潈锛岀‘淇濇湇鍔″櫒鍙互璁块棶銆備緥濡傦紝濡傛灉鏁版嵁鐩綍鏄/usr/local/mysql/var锛屼娇鐢ㄥ懡浠わ細

shell> ls -la /usr/local/mysql/var

濡傛灉鏁版嵁鐩綍鎴栧叾鏂囦欢鎴栧瓙鐩綍涓嶅睘浜庝綘杩愯鏈嶅姟鍣ㄤ娇鐢ㄧ殑璐︽埛锛屽皢鎵鏈夋潈鏀逛负璇ヨ处鎴凤細

shell> chown R mySQL /usr/local/mysql/var
shell> chgrp R mySQL /usr/local/mysql/var

濡傛灉鏈嶅姟鍣ㄤ笉鑳芥纭惎鍔紝妫鏌ラ敊璇棩蹇楁枃浠讹紝鐪嬬湅鏄惁鍙互鎵惧埌鍘熷洜銆傛棩蹇楁枃浠朵綅浜庢暟鎹洰褰(Windows涓竴鑸负C:\Program Files\MySQL\MySQL Server 5.1\dataUnix浜岃繘鍒跺垎鍙戠増涓/usr/local/mysql/dataUnix婧愮爜鍒嗗彂鐗堜负/usr/local/var)銆傛煡鎵炬暟鎹洰褰曚腑鐨host_name.errhost_name.log鏂囦欢锛屽叾涓host_name鏄綘鐨勬湇鍔″櫒涓绘満鍚嶃傜劧鍚庢鏌ユ枃浠剁殑鏈鍚庡嚑琛屻傚湪Unix涓紝鍙互浣跨敤tail鏉ユ樉绀猴細

shell> tail host_name.err
shell> tail host_name.log

閿欒鏃ュ織鍖呭惈鎸囩ず鏈嶅姟鍣ㄤ笉鑳藉惎鍔ㄧ殑淇℃伅銆備緥濡傦紝浣犲彲浠ョ湅瑙佹棩蹇椾腑锛

000729 14:50:10  bdb:  Recovery function for LSN 1 27595 failed
000729 14:50:10  bdb:  warning: ./test/t1.db: No such file or directory
000729 14:50:10  Can't init databases

杩欐剰鍛崇潃浣犳病鏈夌敤--bdb-no-recover閫夐」鍚姩mysqldBerkeley DB鎭㈠鏁版嵁搴撴椂鍙戠幇鍏舵棩蹇楁枃浠舵湁涓浜涢棶棰樸傝鎯崇户缁紝浣犲簲褰撳皢鏃х殑Berkeley DB 鏃ュ織鏂囦欢浠庢暟鎹簱鐩綍绉诲埌鍏跺畠鍦版柟锛屼互鍚庝綘鍙互鍦ㄩ偅鍎挎鏌ュ畠浠BDB鏃ュ織鏂囦欢浠log.0000000001寮澶达紝鎸夐『搴忓懡鍚嶃

濡傛灉浣犺繍琛屾敮鎸BDB 琛ㄧ殑mysqld,mysqld鍚姩鏃跺唴鏍稿穿婧冿紝璇ュ彲鑳芥槸鐢变簬BDB 鎭㈠鏃ュ織鐨勯棶棰樸傛鏃讹紝浣犲彲浠ュ皾璇曠敤--bdb-no-recover鍚姩mysqld銆傚鏋滄湁甯姪锛屼綘搴斿綋浠庢暟鎹洰褰曠Щ璧版墍鏈BDB鏃ュ織鏂囦欢骞跺皾璇曚笉鐢--bdb-no-recover閫夐」閲嶆柊鍚姩mysqld

濡傛灉鍑虹幇涓嬮潰鐨勯敊璇紝璇存槑鍏跺畠绋嬪簭(涔熻鏄彟涓涓mysqld鏈嶅姟鍣)姝d娇鐢mysqld姝h瘯鍥句娇鐢ㄧ殑TCP/IP绔彛鎴Unix 濂楁帴瀛楁枃浠讹細

Can't start server: Bind on TCP/IP port: Address already in use
Can't start server: Bind Unix socket...

浣跨敤ps鏉ョ‘瀹氭槸鍚﹀彟鏈変竴涓mysqld鏈嶅姟鍣ㄦ鍦ㄨ繍琛屻傚鏋滃姝わ紝鍏抽棴鏈嶅姟鍣ㄩ噸鏂板惎鍔mysqld(濡傛灉鍙︿竴涓湇鍔″櫒姝h繍琛岋紝浣犵殑纭兂瑕佽繍琛屽涓湇鍔″櫒锛屼綘鍙互鍦5.12鑺傦紝鈥滃湪鍚屼竴鍙版満鍣ㄤ笂杩愯澶氫釜MySQL鏈嶅姟鍣ㄢ涓彂鐜扮浉鍏充俊鎭)

濡傛灉娌℃湁鍏跺畠鏈嶅姟鍣ㄥ湪杩愯锛屽皾璇曟墽琛屽懡浠 telnet your-host-name tcp-ip-port-number(榛樿MySQL绔彛鍙锋槸3306鐒跺悗鎸変袱娆Enter锛堝洖杞︼級閿傚鏋滃嚭鐜telnet: Unable to connect to remote host: Connection refused閿欒娑堟伅锛屽叾瀹冪▼搴忔浣跨敤mysqld璇曞浘浣跨敤鐨 TCP/IP绔彛銆備綘闇瑕佽窡韪繖鏄摢涓▼搴忓苟绂佺敤瀹冿紝鎴栬mysqld--port閫夐」甯у惉鍏跺畠绔彛銆傛鏃讹紝褰撻氳繃TCP/IP鍗忚杩炴帴鏈嶅姟鍣ㄦ椂锛屼綘杩橀渶瑕佷负瀹㈡埛绔▼搴忔寚瀹氱鍙e彿銆

绔彛涓嶈兘璁块棶鐨勫彟涓涓師鍥犲彲鑳芥槸闃茬伀澧欐杩愯锛岄樆鎸′簡涓庡畠鐨勮繛鎺ャ傚鏋滃姝わ紝淇敼闃茬伀澧欒缃厑璁稿璇ョ鍙g殑璁块棶銆

濡傛灉鏈嶅姟鍣ㄥ凡缁忓惎鍔ㄤ絾鏄綘涓嶈兘涓庡畠杩炴帴锛屼綘搴斿綋纭繚鍦/etc/hosts涓湁涓嬮潰鎵绀烘潯鐩細

127.0.0.1       localhost

璇ラ棶棰樺彧鍙戠敓鍦ㄦ病鏈夊伐浣滅嚎绋嬪簱锛屽苟涓MySQL蹇呴』閰嶇疆涓轰娇鐢MIT-pthreads鐨勭郴缁熴

濡傛灉浣犱笉鑳藉惎鍔mysqld锛屼綘鍙互浣跨敤--debug閫夐」灏濊瘯缂栧啓涓涓窡韪枃浠舵潵鎵惧埌闂銆傝鍙傝E.1.2鑺傦紝鈥滃垱寤鸿窡韪枃浠垛

鍏充簬鍦Windows瀹夎涓帓閿欑殑璇︾粏淇℃伅锛屽弬瑙2.3.14鑺傦紝鈥滃湪Windows鐜涓嬪MySQL瀹夎鐨勬晠闅滆瘖鏂笌鎺掗櫎鈥

2.9.3. 浣垮垵濮婱ySQL璐︽埛瀹夊叏

MySQL瀹夎杩囩▼鍖呮嫭璁剧疆鍚湁鎺堟潈琛ㄧ殑MySQL鏁版嵁搴擄細

         Windows鍒嗗彂鐗堝寘鍚鍒濆鍖栫殑鎺堟潈琛紝鍙互鑷姩瀹夎銆

         Unix涓紝鐢mysql_install_db绋嬪簭鏉ュ畨瑁 鎺堟潈琛ㄣ傚彲浠ラ氳繃涓浜涘畨瑁呮柟娉曟潵杩愯璇ョ▼搴忋傚惁鍒欎綘闇瑕佹墜鍔ㄦ墽琛屻傝缁嗕俊鎭弬瑙2.9.2鑺傦紝鈥淯nix涓嬪畨瑁呭悗鐨勮繃绋嬧

鎺堟潈琛ㄥ畾涔変簡鍒濆MySQL鐢ㄦ埛璐︽埛鍜岃闂潈闄愩傛寜鐓т互涓嬫楠ゅ杩欎簺璐︽埛杩涜璁剧疆锛

         鐢ㄧ敤鎴root 鍒涘缓涓や釜璐︽埛銆傝繖浜涜处鎴蜂负瓒呯敤鎴疯处鎴凤紝鍙互鎵ц浠讳綍鎿嶄綔銆傚垵濮root璐︽埛鐨勫瘑鐮佷负绌猴紝鍥犳浠讳綍浜哄彲浠ョ敤root璐︽埛涓嶇敤浠讳綍瀵嗙爜鏉ヨ繛鎺MySQL鏈嶅姟鍣紝骞跺叿鏈夋墍鏈夋潈闄愩

o        Windows涓紝涓涓root璐︽埛鐢ㄦ潵浠庢湰鏈鸿繛鎺MySQL鏈嶅姟鍣紝鍙︿竴涓厑璁镐粠浠讳綍涓绘満杩炴帴銆

o        Unix涓紝涓や釜root璐︽埛鍧囩敤浜庝粠鏈満杩炴帴銆蹇呴』浠庢湰鏈鸿繘琛岃繛鎺ワ紝涓涓处鎴蜂富鏈哄悕搴旀寚瀹氫负localhost锛屽彟涓涓处鎴蜂负瀹為檯鐨勪富鏈哄悕鎴IP鍙枫

         鍒涘缓浜嗕袱涓尶鍚嶇敤鎴疯处鎴凤紝姣忎釜璐︽埛鐨勭敤鎴峰悕鍧囦负绌恒傚尶鍚嶈处鎴锋病鏈夊瘑鐮侊紝鍥犳浠讳綍浜哄彲浠ヤ娇鐢ㄥ尶鍚嶈处鎴锋潵杩炴帴MySQL鏈嶅姟鍣ㄣ

o        Windows涓紝涓涓尶鍚嶈处鎴风敤鏉ヤ粠鏈満杩涜杩炴帴銆傚畠鍏锋湁鎵鏈夋潈闄愶紝鍚root 璐︽埛涓鏍枫傚彟涓涓彲浠ヤ粠浠讳綍涓绘満涓婅繛鎺ワ紝鍏锋湁test鏁版嵁搴撴垨鍏跺畠浠test寮濮嬬殑鏁版嵁搴撶殑鎵鏈夋潈闄愩

o        Unix涓紝涓や釜鍖垮悕璐︽埛鍧囩敤浜庝粠鏈満杩炴帴銆蹇呴』浠庢湰鏈鸿繘琛岃繛鎺ワ紝涓涓处鎴蜂富鏈哄悕搴旀寚瀹氫负localhost锛屽彟涓涓处鎴蜂负瀹為檯鐨勪富鏈哄悕鎴IP銆備袱涓处鎴峰叿鏈test鏁版嵁搴撴垨鍏跺畠浠test寮濮嬬殑鏁版嵁搴撶殑鎵鏈夋潈闄愩

濡傚墠闈㈡墍杩帮紝鎵鏈夊垵濮嬭处鎴峰潎娌℃湁瀵嗙爜銆傝繖鎰忓懗鐫鍦ㄤ綘鎵ц涓嬭堪鎿嶄綔鍓嶏紝MySQL瀹夎鏈彈淇濇姢锛

         濡傛灉浣犳兂瑕侀槻姝㈠鎴风涓嶄娇鐢ㄥ瘑鐮佺敤鍖垮悕鐢ㄦ埛鏉ヨ繛鎺ワ紝浣犲簲褰撲负鍖垮悕璐︽埛鎸囧畾瀵嗙爜鎴栧垹鎺夊尶鍚嶈处鎴枫

         浣犲簲褰撲负MySQL root璐︽埛鎸囧畾瀵嗙爜銆

涓嬮潰鐨勮鏄庢弿杩颁簡濡備綍涓哄垵濮MySQL璐︽埛璁剧疆瀵嗙爜锛屽厛涓哄尶鍚嶈处鎴疯缃劧鍚庝负root璐︽埛璁剧疆銆傚湪渚嬪瓙涓敤瀹為檯瀵嗙爜鏇挎崲鈥newpwd鈥濄傝鏄庤繕鍖呮嫭濡傛灉浣犱笉鎯崇敤鍖垮悕璐︽埛璁块棶锛屽浣曞垹鎺夊尶鍚嶈处鎴枫

浣犲彲鑳芥兂瑕佸湪浠ュ悗璁剧疆瀵嗙爜锛屽洜姝や笉闇瑕佸湪杩涗竴姝ョ殑璁剧疆鎴栨祴璇曚腑鎸囧畾瀵嗙爜銆備絾鏄紝涓瀹氳鍦ㄥ疄闄呯敓浜т綔涓氥佷娇鐢ㄥ畨瑁呭墠璁剧疆濂藉瘑鐮併

瑕佹兂涓哄尶鍚嶈处鎴锋寚瀹氬瘑鐮侊紝鍙互浣跨敤SET PASSWORDUPDATE銆傚湪涓ょ鎯呭喌涓紝涓瀹氳浣跨敤PASSWORD()鍑芥暟涓哄瘑鐮佸姞瀵嗐

Windows涓娇鐢PASSWORD鐨勬柟娉曪細

shell> mysql -u root
mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR ''@'%' = PASSWORD('newpwd');

Unix涓娇鐢PASSWORD鐨勬柟娉曪細

shell> mysql -u root
mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd');

鐢ㄦ湇鍔″櫒涓绘満鍚嶆浛鎹㈢浜屼釜SET PASSWORD璇彞涓殑host_name銆傝繖鏄寚瀹氱殑user琛ㄤ腑鐨root non-localhost璁板綍鐨Host鍒楀悕銆傚鏋滀綘涓嶇煡閬撴槸鍝釜涓绘満鍚嶏紝鍦SET PASSWORD涔嬪墠鎵ц涓嬮潰鐨勮鍙ワ細

mysql> SELECT Host, User FROM mysql.user;

鏌ユ壘鍦User鍒楁湁root鍜屽湪Host鍒楁病鏈localhost鐨勮褰曘傜劧鍚庡湪绗簩涓SET PASSWORD璇彞涓娇鐢ㄨHost鍊笺

涓哄尶鍚嶈处鎴锋寚瀹氬瘑鐮佺殑鍙︿竴绉嶆柟娉曟槸浣跨敤UPDATE鐩存帴淇敼鐢ㄦ埛琛ㄣ傜敤root杩炴帴鏈嶅姟鍣紝杩愯UPDATE璇彞涓虹浉搴user琛ㄨ褰曠殑Password鍒楁寚瀹氫竴涓笺傚湪WindowsUnix涓殑杩囩▼鏄浉鍚岀殑銆備笅闈㈢殑UPDATE璇彞鍚屾椂涓轰袱涓尶鍚嶈处鎴锋寚瀹氬瘑鐮侊細

shell> mysql -u root
mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd')
    ->     WHERE User = '';
mysql> FLUSH PRIVILEGES;

user琛ㄤ腑鐩存帴浣跨敤UPDATE鏇存柊瀵嗙爜鍚庯紝蹇呴』璁╂湇鍔″櫒鐢FLUSH PRIVILEGES閲嶆柊璇绘巿鏉冭〃銆傚惁鍒欙紝閲嶆柊鍚姩鏈嶅姟鍣ㄥ墠锛屼笉浼氫娇鐢ㄦ洿鏀广

濡傛灉浣犲畞鎰垮垹闄ゅ尶鍚嶈处鎴凤紝鎿嶄綔鏂规硶鏄細

shell> mysql -u root
mysql> DELETE FROM mysql.user WHERE User = '';
mysql> FLUSH PRIVILEGES;

鍙互鍦WindowsUnix涓娇鐢DELETE璇彞銆傚湪Windows涓紝濡傛灉浣犲彧鎯冲垹鎺夊叿鏈変笌root鐩稿悓鏉冮檺鐨勫尶鍚嶈处鎴凤紝鏂规硶涓猴細

shell> mysql -u root
mysql> DELETE FROM mysql.user WHERE Host='localhost' AND User='';
mysql> FLUSH PRIVILEGES;

璇ヨ处鎴峰厑璁稿尶鍚嶈闂紝浣嗘槸鎷ユ湁鍏ㄩ儴鐨勬潈闄愶紝鍥犳鍒犳帀瀹冨彲浠ユ彁楂樺畨鍏ㄣ

浣犲彲浠ョ敤鍑犵鏂规硶涓root璐︽埛鎸囧畾瀵嗙爜銆備互涓嬩粙缁嶄簡涓夌鏂规硶锛

         浣跨敤SET PASSWORD璇彞

         浣跨敤mysqladmin鍛戒护琛屽鎴风绋嬪簭

         浣跨敤UPDATE璇彞

瑕佹兂浣跨敤SET PASSWORD鎸囧畾瀵嗙爜锛岀敤root杩炴帴鏈嶅姟鍣ㄥ苟鎵ц涓や釜SET PASSWORD璇彞銆備竴瀹氳浣跨敤PASSWORD()鍑芥暟鏉ュ姞瀵嗗瘑鐮併

Windows涓殑璇彞锛

shell> mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('newpwd');

Unix涓殑璇彞锛

shell> mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd');

鐢ㄦ湇鍔″櫒涓绘満鍚嶆浛鎹㈢浜屼釜SET PASSWORD璇彞涓殑host_name銆傝繖鏄綘鎸囧畾鍖垮悕璐︽埛瀵嗙爜鐨勪富鏈哄悕銆

瑕佹兂浣跨敤mysqladminroot璐︽埛鎸囧畾瀵嗙爜锛屾墽琛屼笅闈㈢殑鍛戒护锛

  shell> mysqladmin -u root password "newpwd"
  shell> mysqladmin -u root -h host_name password "newpwd"

涓婅堪鍛戒护閫傜敤浜WindowsUnix銆傜敤鏈嶅姟鍣ㄤ富鏈哄悕鏇挎崲绗簩涓懡浠や腑鐨host_name銆備笉涓瀹氶渶瑕佸皢瀵嗙爜鐢ㄥ弻寮曞彿寮曡捣鏉ワ紝浣嗘槸浣犲鏋滃瘑鐮佷腑鍖呭惈绌烘牸鎴栦笓鐢ㄤ簬鍛戒护瑙i噴鐨勫叾瀹冨瓧绗︼紝鍒欓渶瑕佺敤鍙屽紩鍙峰紩璧锋潵銆

浣犺繕鍙互浣跨敤UPDATE鐩存帴淇敼user琛ㄣ備笅闈㈢殑UPDATE璇彞鍙互鍚屾椂涓轰袱涓root璐︽埛鎸囧畾瀵嗙爜锛

shell> mysql -u root
mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd')
    ->     WHERE User = 'root';
mysql> FLUSH PRIVILEGES;

UPDATE璇彞閫傜敤浜WindowsUnix

璁剧疆瀹屽瘑鐮佸悗锛屽綋浣犺繛鎺ユ湇鍔″櫒鏃朵綘蹇呴』鎻愪緵鐩稿簲瀵嗙爜銆備緥濡傦紝濡傛灉浣犳兂瑕佺敤mysqladmin 鍏抽棴鏈嶅姟鍣紝鍙互浣跨敤涓嬮潰鐨勫懡浠わ細

shell> mysqladmin -u root -p shutdown
Enter password: (enter root password here)

娉ㄩ噴锛濡傛灉浣犺缃簡root瀵嗙爜鍚庡繕璁颁簡瀵嗙爜锛屼粠A.4.1鑺傦紝鈥滃浣曞浣嶆牴鐢ㄦ埛瀵嗙爜鈥涓煡闃呴噸璁惧瘑鐮佺殑鏂规硶銆

浣犲彲浠ヤ娇鐢GRANT璇彞璁剧疆鏂拌处鎴枫傜浉鍏宠鏄庡弬瑙5.8.2鑺傦紝鈥滃悜MySQL澧炲姞鏂扮敤鎴疯处鎴封

2.10. 鍗囩骇MySQL

鍋氫负涓鑸師鍒欙紝鎴戜滑寤鸿浠庝竴涓彂甯冪郴鍒楀崌绾у埌鍙︿竴涓彂甯冪郴鍒楁椂锛屼綘搴斿綋鍏堝崌绾у埌瀹冪殑涓嬩竴涓郴鍒楄屼笉瑕佽烦杩囥備緥濡傦紝濡傛灉浣犵洰鍓嶆杩愯MySQL 3.23锛屾兂瑕佸崌绾у埌杈冩柊鐨勭郴鍒楋紝瑕佸崌绾у埌MySQL 4.0鑰屼笉瑕佸崌绾у埌5.05.1

涓嬮潰鐨勯」鍒楀嚭浜嗗崌绾ф椂鐨勭浉鍏充俊鎭細

         MySQL 5.0鍗囩骇鍒5.1,璇烽槄璇2.10.1鑺傦紝鈥滀粠5.0鐗堝崌绾р闄勫綍D锛MySQL鍙樻洿鍙銆傚叾涓彁渚涗簡MySQL 5.1鐩稿浜MySQL 5.0鐨勬柊鐗规ф垨涓嶅悓鐗规с傚鏋滀綘鎯宠浠MySQL 5.0浠ュ墠鐨勫彂甯冪郴鍒楀崌绾,搴斿綋渚濇鍗囩骇鍒颁笅涓涓彂甯冪郴鍒楋紝鐩村埌杈惧埌MySQL 5.0锛岀劧鍚庡啀鍗囩骇鍒MySQL 5.1銆傚叧浜庝粠MySQL 5.0鍗囩骇鐨勪俊鎭,鍙傝MySQL 5.0 鍙傝冩墜鍐锛涘浜庢洿鏃╃殑鍙戝竷锛屽弬瑙MySQL 4.1鍙傝冩墜鍐

         鍦ㄥ崌绾у墠搴斿厛澶囦唤鏁版嵁搴撱

         濡傛灉鍦Windows涓繍琛MySQL鏈嶅姟鍣紝鍙傝2.3.15鑺傦紝鈥滃湪Windows涓嬪崌绾ySQL鈥

         MySQL 5.0鍗囩骇鍒5.1鏇存敼MySQL鏁版嵁搴撲腑鐨 鎺堟潈琛紱澧炲姞浜嗗垪鍜岃〃浠ユ敮鎸佹柊鍔熻兘銆備负浜嗗厖鍒嗗埄鐢ㄨ繖浜涚壒鎬э紝搴旂‘淇濇巿鏉冭〃鏄渶鏂扮殑銆傚崌绾ф巿鏉冭〃鐨勮繃绋嬪弬瑙2.10.2鑺傦紝鈥滃崌绾ф巿鏉冭〃鈥銆傚湪鍗囩骇鍓嶏紝浣犲彲鑳芥兂瑕佷娇鐢mysqldump鏉ヨ浆鍌ㄨ〃锛涘崌绾у悗锛屽彲浠ヤ娇鐢mysqlmysqlimport閲嶅缓銆侀噸瑁 鎺堟潈琛ㄦ潵閲嶈浇dump(澶囦唤)鏂囦欢銆

         濡傛灉浣犳澶嶅埗锛屽叧浜庡崌绾у鍒惰缃殑淇℃伅鍙傝6.6鑺傦紝鈥滃崌绾у鍒惰缃

         濡傛灉瀹夎鍖呮嫭mysqld-max鏈嶅姟鍣ㄧ殑MySQL-Max鍒嗗彂鐗堬紝鍒欏悗闈㈣鍗囩骇鍒伴潪Max鐗堢殑MySQLmysqld_safe浠嶇劧璇曞浘杩愯鏃х殑mysqld-max鏈嶅姟鍣ㄣ傚鏋滃崌绾э紝搴斿綋鎵嬪姩鍒犳帀鏃х殑mysqld-max鏈嶅姟鍣ㄤ互纭繚mysqld_safe杩愯鏂扮殑mysqld鏈嶅姟鍣ㄣ

鍙浣犵殑MySQL鐗堟湰灞炰簬鐩稿悓鐨勫彂甯冪郴鍒楋紝鎬绘槸鍙互鍦ㄤ笉鍚岀殑鐗堟湰涔嬮棿鐨勭浉鍚屾灦鏋勪笂绉诲姩MySQL鏍煎紡鏂囦欢鍜屾暟鎹枃浠躲傜洰鍓嶇殑浜у搧鍙戝竷绯诲垪鏄5.1銆傚鏋滆繍琛MySQL鏃舵洿鏀瑰瓧绗﹂泦锛屽繀椤诲鎵鏈MyISAM琛ㄨ繍琛myisamchk -r -q --set-character-set=charset銆傚惁鍒欙紝绱㈠紩椤哄簭灏嗕細鍑洪敊锛屽洜涓烘洿鏀瑰瓧绗﹂泦涔熶細鏇存敼鎺掑簭銆

濡傛灉浣犱娇鐢ㄦ柊鐗堟湰鏃舵瘮杈冨皬蹇冿紝鍦ㄥ畨瑁呮柊鐨MySQL鍓嶅彲浠ラ噸鏂板懡鍚嶆棫鐨mysqld銆備緥濡傦紝濡傛灉浣犳兂瑕佷粠MySQL 5.0.13鍗囩骇鍒5.1.10, 灏嗗綋鍓嶇殑鏈嶅姟鍣ㄤ粠mysqld閲嶆柊鍛藉悕涓mysqld-5.0.13濡傛灉鏂扮殑mysqld鍑虹幇闂锛屽彧闇瑕佸叧闂苟鐢ㄦ棫鐨mysqld閲嶆柊鍚姩銆

鍗囩骇鍚庯紝濡傛灉浣犻亣鍒伴噸鏂扮紪璇戠殑瀹㈡埛绔▼搴忛棶棰橈紝渚嬪Commands out of sync鎴栦笉鏈熸湜鐨勫唴鏍歌浆鍌紝鍙兘鏄紪璇戠▼搴忔椂浣跨敤浜嗘棫鐨勫ご鏂囦欢鎴栧簱鏂囦欢銆傚嚭鐜拌繖绉嶆儏鍐碉紝搴斿綋妫鏌mysql.h鏂囦欢鍜libmysqlclient.a搴撶殑鏃ユ湡锛屼互楠岃瘉瀹冧滑鏄惁鏉ヨ嚜鏂扮殑MySQL鍒嗗彂鐗堛傚鏋滀笉鏄紝鐢ㄦ柊鐨勫ご鏂囦欢鍜屽簱閲嶆柊缂栬瘧绋嬪簭銆

濡傛灉鍑虹幇闂锛屼緥濡傛柊mysqld鏈嶅姟鍣ㄤ笉鍚姩鎴栨病鏈夊瘑鐮佷笉鑳借繛鎺ワ紝楠岃瘉鏄惁浣跨敤浜嗕互鍓嶅畨瑁呯殑鏃my.cnf鏂囦欢銆傚彲浠ョ敤--print-defaults閫夐」妫鏌(渚嬪锛mysqld --print-defaults)銆傚鏋滄樉绀虹▼搴忓悕涔嬪鐨勫叾瀹冨唴瀹癸紝璇存槑鏈変竴涓椿鍔my.cnf鏂囦欢褰卞搷浜嗘湇鍔″櫒鎴栧鎴风鎿嶄綔銆

褰撳畨瑁呮柊鐨MySQL鍙戝竷鏃讹紝鏈濂介噸寤哄苟閲嶈Perl DBD锛氾細mysql 妯″潡銆傚悓鏍烽傜敤浜庡叾瀹MySQL鎺ュ彛锛屼緥濡PHP mysql鎵╁睍鍚嶅拰Python MySQLdb妯″潡銆

2.10.1. 浠5.0鐗堝崌绾

褰撲粠5.0鍗囩骇鍒5.0.10鎴栨洿楂樼増鏈椂璇锋敞鎰蹇呴』杩愯mysql_fix_privilege_tables(鎴栧湪Windows涓繍琛mysql_fix_privilege_tables.sql)銆傚惁鍒欙紝涓嶈兘鍒涘缓淇濆瓨鐨勮繃绋嬨傜浉鍏宠繃绋嬪弬瑙2.10.2鑺傦紝鈥滃崌绾ф巿鏉冭〃鈥

2.10.2. 鍗囩骇鎺堟潈琛

涓浜涘彂甯冨鎺堟潈琛(MySQL鏁版嵁搴撲腑鐨勮〃)鐨勭粨鏋勮繘琛屼簡鏇存敼浠ュ鍔犳柊鐨勬潈闄愭垨鐗规с傚綋浣犳洿鏂板埌鏂扮増鏈 MySQL鏃讹紝瑕佹兂纭繚鎺堟潈琛ㄦ渶鏂帮紝搴斿綋杩愯mysql_fix_privilege_tables鑴氭湰鏉ユ洿鏂 鎺堟潈琛ㄣ傜浉鍏宠繃绋嬪弬瑙5.4鑺傦紝鈥渕ysql_fix_privilege_tables锛氬崌绾ySQL绯荤粺琛ㄢ

濡傛灉浣犱粠MySQL 4.1鎴栨洿鏃╃増鏈崌绾э紝鎺堟潈琛ㄥ崌绾ц繃绋嬩负CREATE VIEWSHOW VIEW鏉冮檺澧炲姞浜嗚鍥剧浉鍏崇殑鍒椼傝繖浜涙潈闄愪綅浜庡叏灞鍜屾暟鎹簱 绾с傚湪杩欑鎯呭喌涓嬶紝MySQL 5.1MySQL_fix_privilege_ tablesuser琛ㄤ腑鐨Create_priv鍊煎鍒跺埌Create_view_privShow_view_priv鍒椼

2.10.3. 灏哅ySQL鏁版嵁搴撴嫹璐濆埌鍙︿竴鍙版満鍣

浣犲彲浠ュ湪鏀寔鐩稿悓娴偣鏍煎紡鐨勪笉鍚屾灦鏋勪箣闂翠负MyISAM琛ㄥ鍒.frm.MYI.MYD鏂囦欢銆(MySQL鍏虫敞鎵鏈夊瓧鑺備氦鎹㈤棶棰橈級璇峰弬瑙15.1鑺傦紝鈥淢yISAM瀛樺偍寮曟搸鈥

濡傛灉浣犻渶瑕佸湪涓嶅悓鐨勬灦鏋勪箣闂磋浆绉绘暟鎹簱锛屽彲浠ヤ娇鐢mysqldump鍒涘缓鍚湁SQL璇彞鐨勬枃浠躲傜劧鍚庝綘鍙互灏嗘枃浠惰浆绉诲埌鍏跺畠鏈哄櫒涓婏紝骞跺皢瀹冭緭鍏ュ埌MySQL瀹㈡埛绔

浣跨敤mysqldump --help鏉ョ湅鏈夊摢浜涢夐」鍙敤銆傚鏋滀綘姝e皢鏁版嵁绉诲姩鍒版洿鏂扮増鏈殑MySQL锛屼綘搴斿綋浣跨敤mysqldump opt鍒╃敤鍚勭浼樺寲鎬ц兘鏉ヤ骇鐢熸洿灏忋佸彲浠ユ洿蹇鐞嗙殑杞偍鏂囦欢銆

鍦ㄤ袱鍙版満鍣ㄤ箣闂寸Щ鍔ㄦ暟鎹簱鐨勬渶绠鍗(灏界涓嶆槸鏈蹇)鐨勬柟娉曟槸鍦ㄦ暟鎹簱鎵鍦ㄧ殑鏈哄櫒涓婅繍琛屼笅闈㈢殑鍛戒护锛

shell> mysqladmin -h 'other_hostname' create db_name
shell> mysqldump --opt db_name | mysql -h 'other_hostname' db_name

濡傛灉浣犳兂瑕佷粠杩滅▼鏈哄櫒閫氳繃鎱㈤熺綉缁滃鍒舵暟鎹簱锛屽彲浠ヤ娇鐢細

shell> mysqladmin create db_name
shell> mysqldump -h 'other_hostname' --opt --compress db_name | mysql db_name

杩樺彲浠ュ皢缁撴灉淇濆瓨鍒版枃浠朵腑锛岀劧鍚庡皢鏂囦欢杞Щ鍒扮洰鏍囨満鍣ㄤ笂骞跺皢鏂囦欢瑁呰浇鍒版暟鎹簱涓備緥濡傦紝鍙互鍦ㄦ簮鏈哄櫒涓婁娇鐢ㄤ笅闈㈢殑鍛戒护灏嗘暟鎹簱澶囦唤鍒版枃浠朵腑锛

shell> mysqldump --quick db_name | gzip > db_name.contents.gz

(璇ヤ緥瀛愪腑鍒涘缓鐨勬枃浠舵槸鍘嬬缉鏍煎紡锛灏嗗惈鏈夋暟鎹簱鍐呭鐨勬枃浠跺埌鐩爣鏈轰笂骞惰繍琛屽懡浠わ細

shell> mysqladmin create db_name
shell> gunzip < db_name.contents.gz | mysql db_name

杩樺彲浠ヤ娇鐢mysqldumpmysqlimport鏉ヨ浆绉绘暟鎹簱銆傚浜庡ぇ鐨勮〃锛屾瘮鍙槸浣跨敤mysqldump瑕佸揩寰楀銆傚湪涓嬮潰鐨勫懡浠や腑锛DUMPDIR浠h〃鐢ㄦ潵淇濆瓨mysqldump杈撳嚭鐨勭洰褰曞叏璺緞鍚嶃

棣栧厛锛屽垱寤轰繚瀛樿緭鍑烘枃浠剁殑鐩綍骞跺浠芥暟鎹簱锛

shell> mkdir DUMPDIR
shell>mysqldump --tab=DUMPDIR db_name

鐒跺悗灏DUMPDIR鐩綍涓殑鏂囦欢杞Щ鍒扮洰鏍囨満涓婄浉搴旂殑鐩綍涓苟灏嗘枃浠惰杞藉埌MySQL

shell> mysqladmin create db_name           # create database
shell> cat DUMPDIR/*.sql | mysql db_name   # create tables in database
shell> mysqlimport db_name DUMPDIR/*.txt   # load data into tables

涓嶈蹇樿澶嶅埗MySQL鏁版嵁搴擄紝鍥犱负鎺堟潈琛ㄤ繚瀛樺湪璇ユ暟鎹簱涓備綘鍙兘闇瑕佸湪鏂版満鍣ㄤ笂鐢MySQL root鐢ㄦ埛杩愯鍛戒护锛岀洿鍒颁骇鐢MySQL鏁版嵁搴撱

mysql鏁版嵁搴撳鍏ョ洰鏍囨満鍣ㄥ悗锛屾墽琛mysqladmin flush-privileges锛屼互渚挎湇鍔″櫒閲嶈浇鎺堟潈琛ㄤ俊鎭

2.11. 闄嶇骇MySQL

鏈妭鎻忚堪浜嗘棫鐗堟湰MySQL姣旀柊鐗堟湰宸ヤ綔寰楀ソ鐨勬儏鍐典笅锛屽浣曢檷绾у埌鏃х殑MySQL鐗堟湰銆

濡傛灉浣犲湪鍚屼竴鍙戝竷绯诲垪(渚嬪锛屼粠 5.0.13 5.0.12)鍐呴檷绾э紝涓鑸鍒欐槸鍙渶瑕佸湪鏃х増鏈殑椤堕儴瀹夎鏂扮殑浜岃繘鍒躲備笉闇瑕佸鏁版嵁搴撹繘琛屼换浣曟搷浣溿備絾鏄紝鏈濂芥槸鍏堣繘琛屽浠姐

涓嬮潰鐨勯」鍒楀嚭浜嗚繘琛岄檷绾ф椂搴旀墽琛岀殑鎿嶄綔锛

         闃呰浣犲皢瑕侀檷绾х殑鍙戝竷绯诲垪鐨勫崌绾ч儴鍒嗭紝纭畾瀹冩病鏈変綘闇瑕佺殑鍔熻兘銆2.10鑺傦紝鈥滃崌绾ySQL鈥

         濡傛灉璇ョ増鏈湁闄嶇骇閮ㄥ垎锛屼綘涔熷簲褰撻槄璇汇

鍙MySQL鐗堟湰灞炰簬鐩稿悓鐨勫彂甯冪郴鍒楋紝浣犳绘槸鍙互鍦ㄤ笉鍚岀殑鐗堟湰涔嬮棿鐨勭浉鍚屾灦鏋勪笂绉诲姩MySQL鏍煎紡鏂囦欢鍜屾暟鎹枃浠躲傜洰鍓嶇殑浜у搧鍙戝竷绯诲垪鏄5.1

濡傛灉浣犱粠涓涓彂甯冪郴鍒楅檷绾у埌鍙︿竴涓彂甯冪郴鍒楋紝琛ㄥ偍瀛樻牸寮忓彲鑳戒笉鍏煎銆傚湪杩欑鎯呭喌涓嬶紝浣犲彲浠ュ湪闄嶇骇宓屼娇鐢mysqldump鏉ヨ浆鍌ㄨ〃銆傞檷绾у悗锛屼娇鐢mysqlmysqlimport閲嶈浇杞偍鏂囦欢鏉ラ噸鏂板垱寤鸿〃銆傝鍙傝2.10.3鑺傦紝鈥滃皢MySQL鏁版嵁搴撴嫹璐濆埌鍙︿竴鍙版満鍣ㄢ

琛ㄦ牸寮忎笉鍚戜笅鍏煎鐨勪竴鑸抗璞℃槸闄嶇骇鏃朵笉鑳芥墦寮琛ㄣ傚湪杩欑鎯呭喌涓嬶紝浣跨敤涓嬮潰鐨勮繃绋嬶細

1.    鍋滄浣犳兂瑕侀檷绾у埌鐨勬棫鐨MySQL鏈嶅姟鍣ㄣ

2.    閲嶆柊鍚姩灏嗚闄嶇骇鐨勬柊鐨MySQL鏈嶅姟鍣ㄣ

3.    浣跨敤mysqldump鍒涘缓涓涓dump锛堣浆鍌級鏂囦欢鏉ヨ浆鍌ㄤ笉鑳借鏃ф湇鍔″櫒璁块棶鐨勬墍鏈夎〃銆

4.    鍋滄鏂MySQL鏈嶅姟鍣紝閲嶆柊鍚姩鏃MySQL鏈嶅姟鍣ㄣ

dump锛堣浆鍌級鏂囦欢閲嶈浇鍏ユ棫鏈嶅姟鍣ㄣ傝〃搴斿綋鍙闂

2.12. 鍏蜂綋鎿嶄綔绯荤粺鐩稿叧鐨勬敞鎰忎簨椤

2.12.1. Linux娉ㄦ剰浜嬮」

鏈妭璁ㄨ鍙戠幇鐨勫湪Linux涓嚭鐜扮殑闂銆傚墠闈㈠嚑鑺傛弿杩颁簡涓鑸搷浣滅郴缁熺浉鍏崇殑闂锛屼娇鐢ㄤ簩杩涘埗鎴栨簮鐮佸垎鍙戠増鏃跺彲鑳藉嚭鐜扮殑闂鍜屽畨瑁呭悗鐨勯棶棰樸傚悗闈㈠嚑鑺傝璁哄湪鍏蜂綋Linux骞冲彴涓婂嚭鐜扮殑闂銆

璇锋敞鎰忚繖浜涢棶棰樼殑澶у鏁板嚭鐜板湪鏃х殑Linux 鐗堟湰涓傚鏋滀綘杩愯鏈鏂扮殑鐗堟湰锛屽彲鑳戒笉浼氬彂鐜拌繖浜涢棶棰樸

2.12.1.1. Linux鎿嶄綔绯荤粺娉ㄦ剰浜嬮」

MySQL鑷冲皯闇瑕Linux 2.0鐗堟湰銆

璀﹀憡锛鎴戜滑宸茬粡鍙戠幇鍦SMP绯荤粺涓Linux 2.2.14 MySQL浼氬嚭鐜颁竴浜涘鎬殑闂銆傛垜浠繕鏀跺埌鏉ヨ嚜涓浜MySQL鐢ㄦ埛鐨勬姤鍛婅浠栦滑鐢ㄥ唴鏍2.2.14浣跨敤MySQL鏃堕亣鍒颁簡涓ラ噸鐨勭ǔ瀹氭ч棶棰樸傚鏋滀綘姝d娇鐢ㄨ鍐呮牳锛屽簲褰撳崌绾у埌2.2.19 (鎴栨洿鏂扮増)鎴栧埌2.4鍐呮牳銆傚鏋滀綘鏈変竴涓CPU鐩掞紝搴斿綋鑰冭檻浣跨敤2.4锛屽洜涓哄畠鑳藉ぇ澶у姞閫熴備綘鐨勭郴缁熷皢浼氭洿绋冲畾銆

褰撲娇鐢LinuxThreads鏃讹紝浣犲簲褰撹嚦灏戝彲浠ョ湅瑙佹湁涓変釜mysqld 杩涚▼鍦ㄨ繍琛屻傝繖浜涘疄闄呬笂鏄嚎绋嬨傛湁涓涓嚎绋嬫槸LinuxThreads绠$悊鍣紝涓涓嚎绋嬪鐞嗚繛鎺ワ紝鍙︿竴涓嚎绋嬪鐞嗗憡璀﹀拰淇″彿銆

2.12.1.2. Linux浜岃繘鍒跺垎鍙戠増璇存槑

MySQLLinux-Intel浜岃繘鍒跺拰RPM鍙戝竷閰嶇疆涓烘渶楂樼殑鍙兘閫熷害銆傛垜浠竴鐩村湪灏濊瘯浣跨敤鍙敤鐨勬渶蹇殑绋冲畾鐨勭紪璇戝櫒銆

浜岃繘鍒跺彂甯冪敤-staticis杩炴帴锛岃鏄庝竴鑸儏鍐典綘涓嶉渶瑕佸叧蹇冪郴缁熷簱鐨勭増鏈備綘涔熶笉闇瑕佸畨瑁LinuxThreads銆傜敤-staticis杩炴帴鐨勭▼搴忕◢寰ぇ浜庡姩鎬佽繛鎺ョ▼搴忥紝浣嗕篃绋嶅井蹇竴浜(3-5%)銆備絾鏄紝闈欐佽繛鎺ョ▼搴忕殑涓涓棶棰樻槸浣犱笉鑳戒娇鐢ㄧ敤鎴峰畾涔夊嚱鏁(UDF)銆傚鏋滀綘灏嗚鍐欐垨浣跨敤UDF(鍙傜敤浜CC++ 缂栫▼浜哄憳)锛屼綘蹇呴』浣跨敤鍔ㄦ侀摼鎺ヨ嚜宸辩紪璇MySQL

浜岃繘鍒跺垎鍙戠増鐨勪竴涓凡鐭ラ棶棰樻槸鍦ㄤ娇鐢libc鐨勬棫鐨Linux绯荤粺(渚嬪Red Hat 4.xSlackware)涓婏紝浣犱細閬囧埌涓浜(闈炶嚧鍛)涓绘満鍚嶈В鏋愰棶棰樸傚鏋滅郴缁熶娇鐢libc娌℃湁浣跨敤glibc2,浣犲彲鑳戒細閬囧埌涓浜涗富鏈哄悕瑙f瀽鍜getpwnam()闂銆傝繖鏄洜涓glibc渚濋潬涓浜涘閮ㄥ簱鏉ユ墽琛屼富鏈哄悕瑙f瀽鍜getpwent(), 鍗充娇鐢-staticis缂栬瘧涔熷姝ゃ傝繖浜涢棶棰樺嚭鐜板湪涓や釜鏂归潰锛

         褰撹繍琛mysql_install_db鏃讹紝浣犱細鐪嬭涓嬮潰鐨勯敊璇秷鎭細

                Sorry, the host 'xxxx' could not be looked up

浣犲彲浠ラ氳繃鎵цmysql_install_db --force鏉ヨВ鍐宠闂锛屽苟涓嶅湪mysql_install_db涓墽琛resolveip娴嬭瘯銆備笉鍒╂柟闈㈡槸 浣犱笉鑳藉湪鎺堟潈琛ㄤ腑浣跨敤涓绘満鍚嶏細闄や簡localhost锛屽繀椤讳娇鐢IP鍙枫傚鏋滀綘姝d娇鐢ㄤ笉鏀寔force鐨勬棫鐗堟湰MySQL锛屽繀椤讳娇鐢ㄦ枃鏈紪杈戝櫒鎵嬪姩鍗歌浇mysql_install涓殑resolveip娴嬭瘯銆

         褰撲綘灏濊瘯鐢--user閫夐」杩愯mysqld浣犺繕浼氱湅瑙佷笅闈㈢殑閿欒锛

                getpwnam: No such file or directory

瑕佽В鍐宠闂锛屼娇鐢su鍛戒护鍚姩mysqld锛屼笉瑕佹寚瀹--user閫夐」銆傝繖鏍蜂娇绯荤粺鑷繁鏇存敼mysqld杩涚▼鐨勭敤鎴IDmysqld涓嶅啀闇瑕佽繖鏍峰仛銆

鍙︿竴涓В鍐冲姙娉曞彲浠ヨВ鍐充袱涓棶棰橈紝鍗充笉浣跨敤浜岃繘鍒跺垎鍙戠増銆傝幏寰MySQL婧愮爜鍒嗗彂鐗(RPMtar.gz鏍煎紡)骞跺畨瑁呫

鍦ㄤ竴浜Linux 2.2鐗堟湰涓紝褰撳鎴风閫氳繃TCP/IP寤虹珛澶ч噺涓mysqld鏈嶅姟鍣ㄧ殑鏂拌繛鎺ユ椂锛屼綘鍙兘浼氶亣鍒伴敊璇Resource temporarily unavailable銆傝闂鏄Linux鍦ㄤ綘鍏抽棴TCP/IP濂楁帴瀛楃殑鏃堕棿鍜岀郴缁熷疄闄呴噴鏀捐濂楁帴瀛楃殑鏃堕棿涔嬮棿鏈変竴涓欢杩熴傚彧鏈夋湁闄愭暟鐩殑TCP/IP鏃舵鏈夌┖闂达紝鍥犳濡傛灉瀹㈡埛绔瘯鍥惧湪鐭椂闂村唴寤虹珛璁稿鏂TCP/IP杩炴帴鏃讹紝浣犱細閬囧埌婧愪笉鍙敤閿欒銆備緥濡傦紝褰撲綘閫氳繃TCP/IP杩愯MySQL test-connect鍩哄噯娴嬭瘯鏃朵綘浼氱湅瑙佽閿欒銆

鎴戜滑宸茬粡澶氭鍚戜笉鍚岀殑 Linux 閭欢鍒楄〃璇㈤棶璇ラ棶棰橈紝浣嗘槸涓鐩存病鏈夋壘鍒板悎閫傜殑瑙e喅鍔炴硶銆傚敮涓鐭ラ亾鐨勨瑙e喅鍔炴硶鈥濇槸瀹㈡埛绔娇鐢ㄦ案涔呰繛鎺ワ紝鎴栵紝濡傛灉浣犲湪鍚屼竴鏈哄櫒涓婅繍琛屾暟鎹簱鏈嶅姟鍣ㄥ拰瀹㈡埛绔紝浣跨敤Unix濂楁帴瀛楁枃浠舵潵杩炴帴锛屼笉瑕佷娇鐢TCP/IP杩炴帴銆

2.12.1.3. Linux婧愮爜鍒嗗彂鐗堣鏄

涓嬮潰鍏充簬glibc鐨勬敞鎰忎簨椤瑰彧閫傜敤浣犺嚜宸辨瀯寤MySQL鏃躲傚鏋滃湪x86鏈哄櫒涓婅繍琛Linux锛屽湪澶у鏁版儏鍐典笅鏈濂戒娇鐢ㄦ垜浠殑浜岃繘鍒躲傛垜浠皢浜岃繘鍒惰繛鎺ュ埌浜嗘垜浠兘鎵惧埌鐨勬墦浜嗘渶濂借ˉ涓佺殑glibc鐗堟湰锛屽苟浣跨敤浜嗘渶浼樼殑缂栬瘧鍣ㄩ夐」锛屽敖鍔涗娇瀹冮傚悎楂樿礋鑽锋湇鍔″櫒銆傚浜庡吀鍨嬬敤鎴凤紝鍗充娇瀵逛簬瓒呰繃2GB闄愬埗鐨勫ぇ閲忓苟琛岃繛鎺ユ垨琛ㄨ缃紝鍦ㄥぇ澶氭暟鎯呭喌涓嬶紝鎴戜滑鐨勪簩杩涘埗浠嶇劧鏄渶浣抽夋嫨銆傞槄璇讳笅闈㈢殑鍐呭鍚庯紝濡傛灉浣犱笉娓呮鎬庢牱鍋氾紝鍏堣瘯鐢ㄦ垜浠殑浜岃繘鍒剁湅瀹冩槸鍚︽弧瓒充綘鐨勯渶姹傘傚鏋滀綘鍙戠幇瀹冧笉澶熷畬鍠勶紝閭d箞浣犲彲浠ュ皾璇曚綘鑷繁鐨勬瀯寤恒傚湪杩欑鎯呭喌涓嬶紝鎴戜滑寰堝笇鏈涜兘鐪嬪埌鐩稿叧娉ㄩ噴锛屼互渚挎垜浠笅娆″彲浠ユ瀯寤烘洿濂界殑浜岃繘鍒躲

MySQLLinux涓婁娇鐢 LinuxThreads 銆傚鏋滀綘姝e湪浣跨敤涓涓病鏈glibc2鐨勮佺殑Linux鐗堟湰锛屼綘蹇呴』鍦ㄥ皾璇曠紪璇MySQL鍓嶅畨瑁LinuxThreads銆備綘鍙互浠 http://dev.mysql.com/downloads/os-linux.html鑾峰緱LinuxThreads

娉ㄦ剰锛氬綋浣犳墽琛INSERT DELAYED鏃讹紝鎵鐢ㄧ殑鍖呮嫭2.1.1鍙婁互鍓嶇殑glibc鐗堟湰鍦pthread_浜掓枼_timedwait()澶勭悊涓婃湁涓涓嚧鍛介敊璇紝濡傛灉浣犳鍦ㄤ娇鐢INSERT DELAYED锛屾垜浠缓璁鍏堝崌绾glibc

璇锋敞鎰Linux 鍐呮牳鍜LinuxThreads搴撻粯璁ゆ儏鍐典笅鏈澶氬彲浠ュ鐞1,024涓嚎绋嬨傚鏋滀綘璁″垝浣跨敤瓒呰繃1,000涓苟琛岃繛鎺ワ紝闇瑕佸LinuxThreads杩涜涓浜涙洿鏀癸紝濡備笅鎵绀猴細

         sysdeps/unix/sysv/linux/bits/local_lim.h涓殑PTHREAD_THREADS_MAX 澧炲姞鍒4096锛屽皢LinuxThreads/internals.h 涓殑STACK_SIZE鍑忓皯鍒256KB銆傝矾寰勭浉瀵逛簬glibc鐨勬牴鐩綍銆(璇锋敞鎰忓鏋STACK_SIZE涓洪粯璁ゅ2MBMySQL600-1000涓繛鎺ユ椂涓嶇ǔ瀹氾級

         閲嶆柊缂栬瘧LinuxThreads锛岀敓鎴愭柊鐨libpthreads.a搴擄紝骞堕噸鏂拌繛鎺MySQL

鍙互浠http://www.volano.com/linuxnotes.html 鏌ラ槄鍏充簬LinuxThreads绾跨▼闄愬埗鐨勮缁嗕俊鎭

杩樻湁涓涓棶棰樹細涓ラ噸褰卞搷MySQL鐨勬ц兘锛岀壒鍒槸鍦SMP绯荤粺涓傚湪glibc 2.1LinuxThreads涓紝瀵逛簬鎷ユ湁寰堝鍙槸鐭椂闂村唴鍗犳湁浜掓枼浣撶殑绾跨▼鐨勭▼搴忥紝涓嶈兘寰堝ソ鍦版墽琛屼簰鏂ャ傜粨鏋滃嚭鐜拌崚璋殑鐜拌薄锛氬湪璁稿鎯呭喌涓嬶紝濡傛灉浣犱娇鐢ㄦ湭淇敼鐨LinuxThreads杩炴帴MySQL锛屼粠SMP涓幓鎺夊嵏杞藉鐞嗗櫒瀹為檯涓婁細鎻愰珮MySQL鐨勬ц兘銆傛垜浠彁渚涗簡涓涓glibc 2.1.3鐨勮ˉ涓佹潵绾犳璇ヨ涓(http://www.mysql.com/Downloads/Linux/linuxthreads-2.1-patch )

glibc 2.2.2,MySQL浣跨敤淇敼鍚庣殑浜掓枼锛岃繖鏍风敋鑷虫瘮鎵撲簡琛ヤ竵鐨glibc 2.1.3杩樿濂藉緱澶氥備絾鏄紝闇瑕佹敞鎰忕殑鏄湪鏌愪簺鏉′欢涓嬶紝褰撳墠glibc 2.2.2涓殑浜掓枼浠g爜浼氶珮鏃嬶紝褰卞搷浜MySQL鐨勬ц兘銆傞氳繃浼樺寲mysqld杩涚▼鍒版渶楂樹紭鍏堢骇锛屽彲浠ラ檷浣庡湪杩欑鎯呭喌涓嬪嚭鐜拌繖绉嶉棶棰樼殑鍙兘鎬с傛垜浠繕鍙互閫氳繃琛ヤ竵鏉ョ籂姝i珮鏃嬮棶棰橈紝鍙互浠http://www.mysql.com/Downloads/Linux/linuxthreads-2.2.2.patch涓嬭浇銆傚畠闆嗘垚楂樻棆鐨勭籂姝c佺嚎绋嬫渶澶ф暟鐩拰鍫嗘爤绌洪棿浜庝竴浣撱備綘闇瑕佺敤琛ヤ竵patch -p0 </tmp/linuxthreads-2.2.2.patchLinuxThreads鐩綍涓嬩娇鐢ㄣ傛垜浠 甯屾湜鍦ㄥ皢鏉ョ殑glibc 2.2鍙戝竷涓兘浠ユ煇绉嶅舰寮忓皢瀹冨寘鎷繘鏉ャ傚湪浠讳綍鎯呭喌涓嬶紝濡傛灉浣犺繛鎺glibc 2.2.2,浠嶇劧闇瑕佺籂姝STACK_SIZE PTHREAD_THREADS_MAX鎴戜滑甯屾湜鍦ㄥ皢鏉ヨ兘灏嗛粯璁ゅ肩籂姝e埌鏌愮绋嬪害涓婂彲浠ユ帴鍙楃殑鍊硷紝閫傚悎楂樿礋鑽MySQL璁剧疆锛屽洜姝ょ敤鏉ヤ骇鐢熶綘鑷繁鐨勬瀯寤虹殑  鍛戒护鍙互绠鍖栧埌鍒./configure; make; make install

鎴戜滑寤鸿浣犱娇鐢ㄨ繖浜涜ˉ涓佹潵鏋勫缓涓撶敤鐨libpthreads.a闈欐佺増鏈紝骞跺彧浣跨敤瀹冨悓MySQL瀹炵幇闈欐侀摼鎺ャ傛垜浠煡閬撹繖浜涜ˉ涓佸浜MySQL寰堝畨鍏 骞跺ぇ澶ф敼鍠勪簡瀹冪殑鎬ц兘锛屼絾鏄垜浠繕涓嶈兘鏂█瀹冨湪鍏跺畠搴旂敤绋嬪簭涓婄殑鏁堟灉濡備綍銆傚鏋滀綘闇瑕佸皢鍏跺畠浣跨敤LinuxThreads鐨勫簲鐢ㄧ▼搴忓悓鎵撲簡琛ヤ竵鐨勯潤鎬佺増鏈殑搴撹繛鎺ワ紝鎴栨瀯寤轰竴涓墦浜嗚ˉ涓佺殑鍏变韩鐗堟湰锛屽苟灏嗗畠瀹夎鍒扮郴缁熶腑锛屼綘灏嗚嚜宸辨壙鎷呴闄┿

濡傛灉浣犲湪瀹夎MySQL鐨勮繃绋嬩腑閬囧埌浠讳綍濂囨殑闂锛屾垨涓浜涘父鐢ㄥ疄鐢ㄥ伐鍏疯鎮寕璧锋潵锛屽緢鍙兘鏄簱鎴栫紪璇戝櫒鐩稿叧闂銆傚湪杩欑鎯呭喌涓嬶紝浣跨敤鎴戜滑鐨勪簩杩涘埗鏉ヨВ鍐炽

濡傛灉浣犺繛鎺ヤ綘鑷繁鐨MySQL瀹㈡埛绔▼搴忥紝杩愯鏃朵綘浼氱湅瑙佷笅闈㈢殑閿欒锛

ld.so.1: fatal: libmysqlclient.so.#:
open failed: No such file or directory

浣跨敤涓嬮潰鐨勬柟娉曞彲浠ラ伩鍏嶈闂锛

         -Wl,r/full/path/to/libmysqlclient.so鏍囪杩炴帴瀹㈡埛绔紝涓嶈浣跨敤-Lpath)

         libmysqclient.so澶嶅埗鍒/usr/lib

         杩愯瀹㈡埛绔▼搴忓墠锛屽皢libmysqlclient.so鎵鍦ㄧ洰褰曠殑璺緞鍚嶅鍔犲埌LD_RUN_PATH鐜鍙橀噺銆

濡傛灉浣跨敤Fujitsu缂栬瘧鍣 (fcc/FCC)锛岀紪璇MySQ鏃跺彲鑳戒細鍑虹幇涓浜涢棶棰橈紝鍥犱负Linux澶存枃浠朵富瑕侀潰鍚gcc銆備互涓嬬殑configure琛屽簲褰撶粨鍚fcc/FCC浣跨敤锛

CC=fcc CFLAGS="-O -K fast -K lib -K omitfp -Kpreex -D_GNU_SOURCE \
    -DCONST=const -DNO_STRTOLL_PROTO" \
CXX=FCC CXXFLAGS="-O -K fast -K lib \
    -K omitfp -K preex --no_exceptions --no_rtti -D_GNU_SOURCE \
    -DCONST=const -Dalloca=__builtin_alloca -DNO_STRTOLL_PROTO \
    '-D_EXTERN_INLINE=static __inline'" \
./configure \
    --prefix=/usr/local/mysql --enable-assembler \
    --with-mysqld-ldflags=-all-static --disable-shared \
    --with-low-memory

2.12.1.4. Linux鍚庢湡瀹夎娉ㄦ剰浜嬮」

MySQL瀹夎鐩綍鎴MySQL婧愮爜鏍戜笅鐨support-files鐩綍涓嬪彲浠ユ壘鍒mysql.server銆備綘鍙互灏嗗畠瀹夎涓/etc/init.d/mysql锛屼互渚胯嚜鍔ㄥ惎鍔ㄥ拰鍏抽棴MySQL銆傝鍙傝2.9.2.2鑺傦紝鈥滆嚜鍔ㄥ惎鍔ㄥ拰鍋滄MySQL鈥

濡傛灉MySQL涓嶈兘鎵撳紑瓒冲鐨勬枃浠舵垨杩炴帴锛屽彲鑳芥槸浣犳病鏈夊皢Linux閰嶇疆涓哄鐞嗚冻澶熺殑鏂囦欢銆

Linux 2.2鍙婁互涓婄増鏈腑锛屼綘鍙互妫鏌ュ垎閰嶇殑鏂囦欢鐨勬暟鐩細

shell> cat /proc/sys/fs/file -max
shell> cat /proc/sys/fs/dquot-max
shell> cat /proc/sys/fs/super-max

濡傛灉鏈夎秴杩16MB鐨勫唴瀛橈紝搴斿綋鍦ㄥ惎鍔ㄨ剼鏈腑澧炲姞濡備笅鍐呭(渚嬪锛屽湪SuSE Linux涓細/etc/init.d/boot.local)

echo 65536 > /proc/sys/fs/file-max
echo 8192 > /proc/sys/fs/dquot-max
echo 1024 > /proc/sys/fs/super-max

杩樺彲浠ョ敤root浠庡懡浠よ杩愯echo鍛戒护锛屼絾鏄笅涓娆¢噸鏂板惎鍔ㄨ绠楁満鏃惰繖浜涜瀹氬间細涓㈡帀銆

鍙﹀锛屽彲浠ヤ娇鐢ㄨ澶Linux鍒嗗彂鐗堜娇鐢ㄧ殑sysctl宸ュ叿璁剧疆鍚姩鍙傛暟(鍖呮嫭SuSE Linux 8.0鍜屼互鍚庣増鏈)銆傚皢涓嬮潰鐨勫兼斁鍒版枃浠 /etc/sysctl.conf涓細

# Increase some values for MySQL
fs.file-max = 65536
fs.dquot-max = 8192
fs.super-max = 1024

浣犺繕搴斿皢浠ヤ笅鍐呭鍔犲叆/etc/my.cnf

[mysqld_safe]
open-files-limit=8192

杩欐牱鏈嶅姟鍣ㄨ繛鎺ュ拰鎵撳紑鏂囦欢鐨勬绘暟鐩彲浠ヨ揪鍒8,192

LinuxThreadsSTACK_SIZE甯告暟鎺у埗鍦ㄥ鍧绌洪棿涓嚎绋嬪爢鏍堢殑鍗犵敤绌洪棿銆傚畠闇瑕佽冻澶熷ぇ锛屼互淇濊瘉姣忎釜绾跨▼鍫嗘爤鏈夎冻澶熺殑绌洪棿锛屼絾鏄簲瓒冲灏忥紝闃叉鏌愪簺绾跨▼鐨勫爢鏍堣繍琛屽叏灞mysqld鏁版嵁銆傞仐鎲剧殑鏄紝鏍规嵁鎴戜滑鐨勫彂鐜帮紝濡傛灉浣犵敤mmap()鏄犲皠鐩墠姝d娇鐢ㄧ殑瀵诲潃锛Linux鎴愬姛杩愯  鍚庝笉浼氭槧灏勬槧灏勫尯锛屽皢浼氭竻绌烘暣涓湴鍧椤典笂鐨勬暟鎹屼笉浼氳繑鍥為敊璇俊鎭傚洜姝わ紝mysqld鎴栧叾瀹冪嚎绋嬪簲鐢ㄧ▼搴忕殑瀹夊叏渚濋潬鍒涘缓绾跨▼鐨勪唬鐮佺殑鈥缁呭+鈥濊涓恒傜敤鎴峰繀椤婚噰鍙栨帾鏂戒互纭繚鍦ㄤ换浣曟椂闂磋繍琛岀嚎绋嬬殑鏁扮洰鐩稿绾跨▼鍫嗘爤搴旇冻澶熶綆锛屼互闃叉鍏ㄥ眬鍫嗗唴瀛樸備娇鐢mysqld鏃讹紝浣犲簲褰撲负max_connections鍙橀噺璁剧疆鍚堢悊鐨勫煎己鍒惰琛屼负銆

濡傛灉浣犺嚜宸辨瀯寤MySQL锛屼綘鍙互涓LinuxThreads鎵撹ˉ涓佷互渚挎洿濂藉湴浣跨敤鍫嗘爤銆傝鍙傝2.12.1.3鑺傦紝鈥淟inux婧愮爜鍒嗗彂鐗堣鏄庘銆傚鏋滀綘涓嶆兂涓LinuxThreads鎵撹ˉ涓侊紝浣犲簲褰撳皢max_connections鐨勫艰缃负涓嶈秴杩500銆傚鏋滀綘鏈夊ぇ鐨勫叧閿瓧缂撳啿鍖恒佸ぇ鐨勫爢鍐呭瓨琛紝鎴栧叾瀹冧娇mysqld鍒嗛厤澶ч噺鍐呭瓨鐨勪笢瑗匡紝鎴栧鏋滀綘鐢2GB鐨勮ˉ涓佽繍琛2.2鍐呮牳锛max_connections鐨勫煎簲褰撴洿浣庛傚鏋滀綘姝d娇鐢ㄦ垜浠殑浜岃繘鍒舵垨RPM鐗堟湰锛屽彲浠ュ畨鍏ㄥ湴灏max_connections璁剧疆涓1500锛堝亣瀹氭病鏈夊ぇ鐨勫叧閿瓧缂撳啿鍖烘垨鏈夊ぇ閲忔暟鎹殑鍫嗗唴瀛樿〃銆傚皢LinuxThreads涓殑STACK_SIZE闄嶄綆寰楄秺浣庯紝鍙互瀹夊叏鍦板垱寤鸿秺澶氱殑绾跨▼銆傛垜浠帹鑽愮殑鍊肩殑鑼冨洿涓128KB256KB

濡傛灉浣犳浣跨敤澶ч噺鐨勫苟琛岃繛鎺ワ紝鍦2.2鍐呮牳涓綘鍙兘浼氶亣鍒颁竴涓滅壒鎬р濓紝鍗抽氳繃瀵硅繘绋嬬殑鍒嗘敮鎴栧厠闅嗗瓙杩涚▼鐨勮涓鸿繘琛岀綒鍒嗭紝鏉ヨ瘯鍥鹃槻姝㈣桨鐐告敾鍑汇傝繖鏍蜂綘澧炲姞骞惰瀹㈡埛绔殑鏁伴噺鏃讹紝MySQL涓嶈兘姝g‘鍝嶅簲銆傚湪鍗CPU绯荤粺涓紝鎴戜滑宸茬粡鍙戠幇璇ョ幇璞★紝鍗崇嚎绋嬪垱寤哄湴寰堟參锛涜繛鎺MySQL鐨勬椂闂村緢闀(闀胯揪1鍒嗛挓)锛屽苟涓斿叧闂殑鏃堕棿涔熷緢闀裤傚湪澶CPU绯荤粺涓紝鎴戜滑宸茬粡瑙傚療鍒伴殢鐫瀹㈡埛绔暟鐩殑澧炲姞锛屾煡璇㈤熷害閫愭笎涓嬮檷銆傚湪瀵绘眰瑙e喅鍔炴硶鐨勮繃绋嬩腑锛屾垜浠敹鍒颁簡涓涓敤鎴风殑鍐呮牳琛ヤ竵锛屼粬澹扮О璇ヨˉ涓佸彲浠ヨВ鍐充粬鐨勯棶棰樸備粠http://www.mysql.com/Downloads/Patches/linux-fork.patch鍙互涓嬭浇璇ヨˉ涓併傛垜浠凡缁忓湪寮鍙戝拰鐢熶骇绯荤粺涓婂璇ヨˉ涓佽繘琛屼簡骞挎硾鐨勬祴璇曘傚畠鍙互澶уぇ鏀瑰杽MySQL鐨勬ц兘锛岃屼笉浼氶犳垚浠讳綍闂锛屾垜浠悜浠嶇劧鍦2.2鍐呮牳杩愯楂樿礋鑽锋湇鍔″櫒鐨勭敤鎴锋帹鑽愬畠銆

2.4鍐呮牳涓凡缁忓璇ラ棶棰樿繘琛屼簡淇锛屽洜姝ゅ鏋滀綘涓嶆弧鎰忓綋鍓嶇郴缁熺殑鎬ц兘锛屼笉瑕佷负2.2 鍐呮牳鎵撹ˉ涓侊紝鍦SMP绯荤粺涓崌绾у埌2.4鐗堣瀹规槗鍦板锛屽崌绾т笉浠呭彲浠ヤ慨澶嶉敊璇紝杩樺彲浠ヤ娇SMP鏇村ソ鍦板姞閫熴

鎴戜滑宸茬粡鍦ㄥ弻CPU鏈哄櫒涓婂湪2.4鍐呮牳涓MySQL杩涜浜嗘祴璇曪紝鍙戠幇MySQL鐨勬瘮渚嬭濂藉緱澶氥1,000鍚嶅鎴锋煡璇㈡椂锛岃繕鐪嬩笉鍒伴熷害鏈夊疄璐ㄤ笂鐨勪笅闄嶏紝MySQL鐨勬瘮渚嬪洜瀛(鏈澶у悶鍚愰噺涓庝竴涓鎴风鐨勫悶鍚愰噺鐨勬瘮渚)180%銆傛垜浠湪鍥-CPU绯荤粺涓篃瑙傚療鍒颁簡绫讳技鐨勭粨鏋滐細褰撳鎴锋暟鐩笂鍗囧埌1,000鍚嶆椂杩樻病鏈夊疄璐ㄤ笂鐨勫噺鎱, 姣斾緥鍥犲瓙涓300%銆傛牴鎹繖浜涚粨鏋滐紝瀵逛簬浣跨敤2.2鍐呮牳鐨勯珮璐熻嵎SMP鏈嶅姟鍣紝鎴戜滑缁濆寤鸿鍗囩骇鍒 2.4鍐呮牳銆

鎴戜滑宸茬粡鍙戠幇锛屽湪2.4鍐呮牳涓簲浣跨敤鍙兘鐨勬渶楂樹紭鍏堢骇鏉ヨ繍琛mysqld杩涚▼锛屼互鑾峰緱鏈浣虫ц兘銆傚彲浠ラ氳繃涓mysqld_saferenice -20 $$鍛戒护鏉ュ疄鐜般傚湪鍥-CPU绯荤粺涓殑娴嬭瘯涓紝鎻愰珮浼樺厛绾у湪400涓鎴锋椂浼氫娇鍚炲悙閲忓鍔60%

鎴戜滑鐩墠杩樻兂鎼滈泦鍏充簬MySQLfour-wayeight-way绯荤粺涓婄敤2.4鍐呮牳鎵ц鐨勬ц兘鐨勬洿璇︾粏淇℃伅銆傚鏋滀綘璁块棶浜嗚繖浜涚郴缁熷苟杩涜浜嗕竴浜涘熀鍑嗘祴璇曪紝璇峰皢缁撴灉鐢email鍙戦佸埌<benchmarks@mysql.com>銆傛垜浠皢瀵瑰畠浠繘琛屽鏌ヤ互鍖呮嫭杩涙墜鍐屼腑銆

濡傛灉鐢ps杩愯mysqld鏈嶅姟鍣ㄨ繘绋嬫椂鍙戠幇杩涚▼姝绘帀浜嗭紝涓鍗婃槸MySQL涓湁缂洪櫡鎴栨暟鎹簱琛ㄥ穿婧冧簡銆傝鍙傝A.4.2鑺傦紝鈥滃鏋淢ySQL渚濈劧宕╂簝锛屽簲浣滀簺浠涔堚

濡傛灉mysqld姝绘帀骞剁粰鍑SIGSEGV淇″彿锛岃鎯冲湪Linux涓鍐呮牳杩涜璋冭瘯锛屼綘鍙互鐢--core-file閫夐」鍚姩mysqld銆傛敞鎰忎綘杩樺彲鑳介渶瑕侀氳繃鍚mysqld_safe娣诲姞ulimit -c 1000000鎴栫敤--core-file-size=1000000鍚姩mysqld_safe鏉ュ姞澶у唴鏍告枃浠剁殑澶у皬銆傝鍙傝5.1.3鑺傦紝鈥渕ysqld_safe锛歁ySQL鏈嶅姟鍣ㄥ惎鍔ㄨ剼鏈

2.12.1.5. Linux x86娉ㄦ剰浜嬮」

MySQL闇瑕5.4.12鎴栨洿鏂扮増鏈殑libc銆傚凡鐭ュ畠鍙互鍦libc 5.4.46涓伐浣溿glibc 2.0.6鍜屾洿鏂扮増鏈簲褰撲篃鍙互宸ヤ綔銆Red Hatglibc RPM鏈変竴浜涢棶棰橈紝鍥犳濡傛灉浣犻亣鍒伴棶棰橈紝搴旂湅鐪嬫槸鍚︽湁鏇存柊鐗堛傚凡鐭glibc 2.0.7-192.0.7-29 RPM鍙互宸ヤ綔銆

濡傛灉浣犳浣跨敤Red Hat 8.0鎴栨洿鏂扮殑glibc 2.2.x搴擄紝浣犱細鐪嬭mysqld鎵цgethostbyaddr()鏃朵細姝绘帀銆傝繖鏄洜涓烘柊鐨glibc搴撳湪鎵ц璇ヨ皟鐢ㄦ椂闇瑕佸ぇ浜128KB鐨勫爢鏍堢┖闂淬傝鎯充慨澶嶈闂锛岀敤--thread-stack=192K閫夐」鍚姩mysqld(MySQL 4浠ュ墠鐨勭増鏈腑搴斾娇鐢-O thread_stack=192KMySQL 4.0.10鍜屼互涓婄増鏈腑锛岃鍫嗘爤绌洪棿鍊煎嵆涓洪粯璁ゅ硷紝鍥犳浣犱笉浼氱湅瑙佽闂銆

濡傛灉浣犳浣跨敤gcc 3.0鍜屼互涓婄増鏈紪璇MySQL锛屽湪缂栬瘧MySQL鍓嶄綘蹇呴』鍏堝畨瑁libstdc++v3搴擄紱濡傛灉涓嶈繖鏍峰仛锛屽湪鑱旀帴杩囩▼涓細閬囧埌鍏充簬涓㈠け__cxa_pure_virtual绗﹀彿鐨勯敊璇

鍦ㄤ竴浜涙棫鐨Linux鍒嗗彂鐗堜腑锛configure浼氱敓鎴愬涓嬮敊璇細

Syntax error in sched.h. Change _P to __P in the
/usr/include/sched.h file.
See the Installation chapter in the Reference Manual.

鍙渶瑕佹寜鐓ч敊璇秷鎭殑鎻愮ず鎿嶄綔銆傚鍙湁涓鏉′笅鍒掔嚎鐨_P鍚嶅啀澧炲姞涓鏉′笅鍒掔嚎锛岀劧鍚庨噸鏂板皾璇曘

缂栬瘧鏃跺彲鑳戒細鍑虹幇璀﹀憡銆備笅闈㈢殑璀﹀憡鍙互蹇界暐锛

mysqld.cc -o objs-thread/mysqld.o
mysqld.cc: In function `void init_signals()':
mysqld.cc:315: warning: assignment of negative value `-1' to
`long unsigned int'
mysqld.cc: In function `void * signal_hand(void *)':
mysqld.cc:346: warning: assignment of negative value `-1' to
`long unsigned int'

濡傛灉mysqld鍚姩鏃舵绘槸鍑虹幇杞偍鍐呮牳锛 闂鍙兘鏄綘浣跨敤浜嗘棫鐨/lib/libc.a銆傚皾璇曢噸鏂板鍏跺懡鍚嶏紝鐒跺悗鍒犳帀sql/mysqld骞堕噸鏂版墽琛make install鐒跺悗鍐嶆灏濊瘯銆傚凡缁忔姤瀵煎湪閮ㄥ垎Slackware瀹夎涓嚭鐜颁簡璇ラ棶棰樸

褰撻摼鎺mysqld鏃跺鏋滃嚭鐜颁笅闈㈢殑閿欒锛岃鏄libg++.a瀹夎涓嶆纭細

/usr/lib/libc.a(putc.o): In function `_IO_putc':
putc.o(.text+0x0): multiple definitiof `_IO_putc'

浣犲彲浠ヤ娇鐢libg++.a杩愯configure鏉ラ伩鍏嶈闂锛

shell> CXX=gcc ./configure

2.12.1.6. Linux SPARC娉ㄦ剰浜嬮」

鍦ㄩ儴鍒嗘墽琛岃繃绋嬩腑锛readdir_r()浼氫腑鏂傜幇璞℃槸SHOW DATABASES璇彞鎬绘槸杩斿洖绌哄瓙闆嗐傚彲浠ュ湪瀹屾垚閰嶇疆銆佽繘琛岀紪璇戝墠浠config.h涓垹鎺HAVE_READDIR_R鏉ヤ慨澶嶃

2.12.1.7. Linux Alpha娉ㄦ剰浜嬮」

鎴戜滑宸茬粡鐢ㄦ垜浠殑鍩哄噯鍜屾祴璇曞浠跺湪Alpha涓祴璇曚簡MySQL 5.1锛岀湅璧锋潵宸ヤ綔寰椾笉閿欍

鎴戜滑鐩墠鍦ㄩ厤缃Alpha EV6澶勭悊鍣ㄧ殑Compaq DS20鏈哄櫒涓婏紝鍦SuSE Linux 7.0涓AXP銆佸唴鏍2.4.4-SMPCompaq C缂栬瘧鍣(V6.2-505)Compaq C++缂栬瘧鍣(V6.3-006)鏋勫缓MySQL浜岃繘鍒惰蒋浠跺寘銆

浣犲彲浠ヤ粠 http://www.support.compaq.com/alpha-tools/ 鎵惧埌涓婅堪缂栬瘧鍣ㄣ備娇鐢ㄨ繖浜涚紪璇戝櫒锛屽緱鍒扮殑MySQL鎬ц兘姣gcc瑕佸ソ9-14%

AlphaMySQL涓紝鎴戜滑鍦ㄧ紪璇戦夐」涓娇鐢-arch generic鏍囪锛屽彲浠ョ‘淇濅簩杩涘埗鍦ㄦ墍鏈Alpha澶勭悊鍣ㄤ腑杩愯銆傛垜浠繕閲囩敤闈欐佺紪璇戜互閬垮厤搴撻棶棰樸configure鍛戒护搴斾负锛

CC=ccc CFLAGS="-fast -arch generic" CXX=cxx \
CXXFLAGS="-fast -arch generic -noexceptions -nortti" \
./configure --prefix=/usr/local/mysql --disable-shared \
    --with-extra-charsets=complex --enable-thread-safe-client \
    --with-mysqld-ldflags=-non_shared --with-client-ldflags=-non_shared
 

濡傛灉鎯宠浣跨敤egcs锛屽彲浠ヤ娇鐢ㄤ笅闈㈢殑configure琛岋細

CFLAGS="-O3 -fomit-frame-pointer" CXX=gcc \
CXXFLAGS="-O3 -fomit-frame-pointer -felide-constructors \
    -fno-exceptions -fno-rtti" \
./configure --prefix=/usr/local/mysql --disable-shared

宸茬煡鐨勫湪Linux-Alpha涓繍琛MySQL鐨勯棶棰橈細

         gdb 4.18 涓笉鑳借皟璇曠嚎绋嬪簲鐢ㄧ▼搴忋備綘搴斿綋浣跨敤gdb 5.1

         浣跨敤gcc鏃跺鏋滀綘灏濊瘯闈欐侀摼鎺mysqld锛屽惎鍔ㄦ椂鏄犲儚浼氬鑷磋浆鍌ㄥ唴鏍搞傛崲鍙ヨ瘽璇达紝浣跨敤gcc鏃朵笉瑕佷娇鐢--with-mysqld-ldflags=-all-static

2.12.1.8. Linux PowerPC娉ㄦ剰浜嬮」

MySQL搴斿綋鍙互鍦ㄤ娇鐢ㄦ渶鏂glibc瀹夎杞欢鍖(glibc 2.0.7娴嬭瘯)MkLinux涓婂伐浣溿

2.12.1.9. Linux MIPS娉ㄦ剰浜嬮」

涓轰簡浣MySQLQube2(Linux Mips)涓婂伐浣滐紝闇瑕佹渶鏂扮殑glibc搴撱傚凡鐭glibc-2.0.7-29C2鍙互宸ヤ綔銆傝繕蹇呴』浣跨敤egcs C++缂栬瘧鍣(egcs 1.0.2-9gcc 2.95.2鎴栨洿鏂扮増)

2.12.1.10. Linux IA-64娉ㄦ剰浜嬮」

瑕佹兂璁MySQLLinux IA-64涓紪璇,鎴戜滑鐢 gcc 2.96鏋勫缓鏃朵娇鐢ㄤ笅闈㈢殑configure鍛戒护锛

CC=gcc \
CFLAGS="-O3 -fno-omit-frame-pointer" \
CXX=gcc \
CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors \
    -fno-exceptions -fno-rtti" \
    ./configure --prefix=/usr/local/mysql \
    "--with-comment=Official MySQL binary" \
    --with-extra-charsets=complex

IA-64,MySQL瀹㈡埛绔簩杩涘埗浣跨敤鍏变韩搴撱傝繖鎰忓懗鐫濡傛灉浣犲皢鎴戜滑鐨勪簩杩涘埗鍒嗗彂鐗堝畨瑁呭埌/usr/local/mysql涔嬪鐨勫叾瀹冧綅缃紝闇瑕佸皢libmysqlclient.so瀹夎鐩綍璺緞鍔犲埌/etc/ld.so.conf鏂囦欢鎴LD_LIBRARY_PATH鐜鍙橀噺涓

鍙傝A.3.1鑺傦紝鈥滀笌MySQL瀹㈡埛绔簱鐨勯摼鎺ラ棶棰樷

2.12.2. Mac OS X娉ㄦ剰浜嬮」

Mac OS X涓紝tar涓嶈兘澶勭悊闀挎枃浠跺悕銆傚鏋滀綘闇瑕佽В鍖.tar.gz鍒嗗彂鐗堬紝搴斾娇鐢gnutar

2.12.2.1.聽Mac OS X 10.x (Darwin)

MySQL搴斿綋鍙互鍦Mac OS X 10.x(Darwin)涓伐浣滐紝涓嶄細鏈夐噸澶ч棶棰樸

宸茬煡鐨勯棶棰樻湁锛

         杩炴帴鏃堕棿(wait_timeoutinteractive_timeoutnet_read_timeout)鍊间笉鐞嗘兂銆

杩欏彲鑳芥槸绾跨▼搴撲腑鐨勪俊鍙峰鐞嗛棶棰橈紝淇″彿涓嶈兘涓柇鎸傝捣鐨勮鍛戒护锛屾垜浠笇鏈涘皢鏉ヨ兘瀵圭嚎绋嬪簱杩涜鏇存柊浠ヤ慨澶嶈闂銆

Darwin 6.3涓敤涓嬮潰鐨configure琛屽Mac OS X浜岃繘鍒惰繘琛屼簡缂栬瘧锛

CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc \
CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors \
    -fno-exceptions -fno-rtti" \
    ./configure --prefix=/usr/local/mysql \
    --with-extra-charsets=complex --enable-thread-safe-client \
    --enable-local-infile --disable-shared

鍙傝2.5鑺傦紝鈥滃湪Mac OS X涓婂畨瑁匨ySQL鈥

2.12.2.2.聽Mac OS X Server 1.2 (Rhapsody)

瀵逛簬褰撳墠鐗堟湰鐨Mac OS X鏈嶅姟鍣紝缂栬瘧MySQL涔嬪墠涓嶉渶瑕佸鎿嶄綔绯荤粺杩涜鏇存敼銆傚湪鏈嶅姟鍣ㄥ钩鍙颁笂鐨勭紪璇戜笌瀹㈡埛绔増鏈Mac OS X鐩稿悓銆

瀵逛簬鏃х殑鐗堟湰(Mac OS X Server 1.2, a.k.a. Rhapsody)锛屽湪閰嶇疆MySQL涔嬪墠蹇呴』鍏堝畨瑁pthread杞欢鍖呫

鍙傝2.5鑺傦紝鈥滃湪Mac OS X涓婂畨瑁匨ySQL鈥

2.12.3. Solaris娉ㄦ剰浜嬮」

Solaris涓紝鐢氳嚦鍦ㄨВ鍘嬬缉MySQL鍒嗗彂鐗堟椂锛屼綘涔熶細閬囧埌闂锛屽洜涓Solaris tar涓嶈兘澶勭悊闀挎枃浠跺悕銆傝繖璇存槑瑙e帇缂MySQL鍒嗗彂鐗堟椂浼氶亣瑙侀敊璇

濡傛灉鍑虹幇杩欑闂锛屽繀椤讳娇鐢GNU tar(gtar)鏉ヨВ鍘嬬缉鍒嗗彂鐗堛傚彲浠ヤ粠http://dev.mysql.com/downloads/os-solaris.html鎵惧埌棰勭紪璇戠殑Solaris鐗堟湰銆

Sun鍘熺敓绾跨▼鍙湪Solaris 2.5鍜屾洿楂樼増鏈腑宸ヤ綔銆傚浜庣増鏈2.4鍜屾洿鏃╃増鏈紝MySQL鑷姩浣跨敤MIT-pthreads銆傝鍙傝2.8.5鑺傦紝鈥淢IT-pthreads娉ㄦ剰浜嬮」鈥

濡傛灉浣犺繍琛configure鏃堕亣鍒颁笅闈㈢殑閿欒锛岃鏄庣紪璇戝櫒瀹夎寰楁湁闂锛

checking for restartable system calls... configure: error can not
run test programs while cross compiling

鍦ㄨ繖绉嶆儏鍐典笅锛屽簲褰撳皢缂栬瘧鍣ㄥ崌绾у埌杈冩柊鐨勭増鏈傝繕鍙互鍦config.cache鏂囦欢涓彃鍏ヤ笅闈㈢殑琛屾潵瑙e喅璇ラ棶棰橈細

ac_cv_sys_restartable_syscalls=${ac_cv_sys_restartable_syscalls='no'}

濡傛灉鍦SPARC涓婁娇鐢Solaris锛屽缓璁娇鐢ㄧ紪璇戝櫒gcc 2.95.23.2銆傚彲浠ヤ粠http://gcc.gnu.org/涓嬭浇銆傝娉ㄦ剰egcs 1.1.1gcc 2.8.1涓嶈兘鍦SPARC涓婂彲闈犲湴宸ヤ綔銆

褰撲娇鐢gcc 2.95.2鏃跺缓璁殑configure琛岋細

CC=gcc CFLAGS="-O3" \
CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" \
./configure --prefix=/usr/local/mysql --with-low-memory \
    --enable-assembler

濡傛灉浣犱娇鐢UltraSPARC绯荤粺锛屽湪CFLAGSCXXFLAGS鐜鍙橀噺涓姞涓-mcpu=v8 -Wa,-xarch=v8plusa鎬ц兘鍙互鎻愰珮4%

濡傛灉浣犳湁Sun Forte 5.0(鎴栨洿鏂扮増)缂栬瘧鍣紝鍙互杩愯锛

CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt" \
CXX=CC CXXFLAGS="-noex -mt" \
./configure --prefix=/usr/local/mysql --enable-assembler

瑕佹兂鐢Sun Forte 缂栬瘧鍣ㄥ垱寤64-浣嶄簩杩涘埗锛屼娇鐢ㄤ笅闈㈢殑閰嶇疆閫夐」锛

CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt -xarch=v9" \
CXX=CC CXXFLAGS="-noex -mt -xarch=v9" ASFLAGS="-xarch=v9" \
./configure --prefix=/usr/local/mysql --enable-assembler

瑕佹兂浣跨敤gcc鍒涘缓64-Solaris浜岃繘鍒讹紝鍦CFLAGSCXXFLAGS澧炲姞-m64锛屽苟浠configure琛屽垹鎺--enable-assembler

MySQL鍩哄噯娴嬭瘯涓紝鍦UltraSPARC涓婁娇鐢32浣嶆ā寮忕殑Forte 5.0锛屽悓浣跨敤甯-mcpu鏍囪鐨gcc 3.2姣旇緝锛岄熷害鎻愰珮浜4%

濡傛灉鍒涘缓浜64浣嶇殑mysqld浜岃繘鍒讹紝閫熷害瑕佹瘮32-浣嶄簩杩涘埗鎱4%锛屼絾鏄彲浠ュ鐞嗘洿澶氱殑绾跨▼鍜屽唴瀛樸

褰撲负x86_64浣跨敤Solaris 10,浣犲簲褰撳畨瑁呯敤forcedirectio閫夐」淇濆瓨InnoDB鏂囦欢鐨勬枃浠剁郴缁熴(榛樿鎯呭喌涓嶇敤璇ラ夐」鏉ュ畨瑁)銆傚鏋滀笉杩欐牱鍋氾紝褰撳湪璇ュ钩鍙颁笂浣跨敤InnoDB 鍌ㄥ瓨寮曟搸鏃跺皢浼氶犳垚涓ラ噸鐨勬ц兘涓嬮檷銆

濡傛灉fdatasyncsched_yield鍑虹幇闂锛屼綘鍙互鍦configure琛屽姞LIBS=-lrt淇璇ラ棶棰樸

瀵逛簬鏃╀簬WorkShop 5.3鐨勭紪璇戝櫒,浣犲彲鑳介渶瑕佺紪杈configure鑴氭湰銆傚簲灏嗚琛岋細

#if !defined(__STDC__) || __STDC__ != 1

鏇磋涓猴細

#if !defined(__STDC__)

濡傛灉浣犵敤-Xc 閫夐」鎵撳紑__STDC__Sun 缂栬瘧鍣ㄤ笉鑳界敤Solaris pthreads.h 澶存枃浠剁紪璇戙傝繖鏄竴涓Sun 缂洪櫡(涓柇鐨勭紪璇戝櫒鎴include鏂囦欢)

濡傛灉杩愯mysqld鏃跺嚭鐜颁笅闈㈢殑閿欒娑堟伅锛屽師鍥犳槸浣犱紒鍥句笉鍚敤-mt multi-thread閫夐」鑰岀敤Sun缂栬瘧鍣ㄧ紪璇MySQL

libc internal error: _rmutex_unlock: rmutex not held

-mt鍔犲埌CFLAGSCXXFLAGS涓婂苟閲嶆柊缂栬瘧銆

濡傛灉浣犳浣跨敤gccSFW鐗堟湰(Solaris 8瀹夎鍖呭唴)锛岃繍琛configure涔嬪墠浣犲繀椤诲皢/opt/sfw/lib鍔犲埌鐜鍙橀噺LD_LIBRARY_PATH涓娿

濡傛灉浣犳浣跨敤浠sunfreeware.com涓嬭浇鐨gcc锛屼細閬囧埌璁稿闂銆傝鎯抽伩鍏嶏紝搴斿綋鍦ㄨ繍琛屾満鍣ㄤ笂閲嶆柊缂栬瘧gccGNU binutils

濡傛灉浣犵敤gcc缂栬瘧MySQL鏃堕亣鍒颁笅闈㈢殑閿欒锛岃鏄gcc閰嶇疆涓嶉傚悎Solaris鐨勭増鏈細

shell> gcc -O3 -g -O2 -DDBUG_OFF  -o thr_alarm ...
./thr_alarm.c: In function `signal_hand':
./thr_alarm.c:556: too many arguments to function `sigwait'

鍦ㄨ繖绉嶆儏鍐典笅姝g‘鐨勫仛娉曟槸寰楀埌鏈鏂扮増鏈殑gcc锛屽苟鐢ㄤ綘褰撳墠鐨gcc缂栬瘧鍣ㄧ紪璇戙傝嚦灏戝浜Solaris 2.5,鍑犱箮鎵鏈変簩杩涘埗鐗堟湰鐨gcc鏈夋棫鐨勪笉鍐嶄娇鐢ㄧ殑include鏂囦欢,涓柇浜嗘墍鏈変娇鐢ㄧ嚎绋嬬殑绋嬪簭锛屼篃鍙兘浼氫腑鏂叾瀹冪▼搴忋

Solaris涓嶆彁渚涢潤鎬佺増鏈殑绯荤粺搴(libpthreadslibdl)锛屽洜姝や綘涓嶈兘鐢--static缂栬瘧MySQL銆傚鏋滀綘璇曞浘杩欐牱鍋氾紝浼氶亣鍒颁笅闈㈢殑閿欒锛

ld: fatal: library -ldl: not found
undefined reference to `dlopen'
cannot find -lrt

濡傛灉浣犺繛鎺ヤ綘鑷繁鐨MySQL瀹㈡埛绔▼搴忥紝杩愯鏃朵細鍑虹幇涓嬮潰鐨勯敊璇細

ld.so.1: fatal: libmysqlclient.so.#:
open failed: No such file or directory

鍙互閫氳繃涓嬮潰鐨勬柟娉曢伩鍏嶈闂锛

         -Wl,r/full/path/to/libmysqlclient.so鏍囪鑰屼笉瑕佺敤-Lpath)杩炴帴瀹㈡埛绔

         libmysqclient.so澶嶅埗鍒/usr/lib

         杩愯瀹㈡埛绔▼搴忓墠锛屽皢libmysqlclient.so鐩綍鐨勮矾寰勫悕鍔犲埌LD_RUN_PATH鐜鍙橀噺涓娿

濡傛灉浣犳湭瀹夎zlib-lz杩炴帴鏃configure鍑虹幇闂锛屼綘鏈変袱涓夊垯锛

         濡傛灉浣犳兂瑕佷娇鐢ㄥ帇缂╅氫俊鍗忚锛屼綘闇瑕佷粠ftp.gnu.org鑾峰緱骞跺畨瑁zlib

         鏋勫缓MySQL鏃剁敤--with-named-z-libs=no閫夐」杩愯configure

濡傛灉浣犳浣跨敤gcc锛屽悜MySQL璋冪敤鐢ㄦ埛瀹氫箟鍑芥暟(UDF)鏃跺嚭鐜伴棶棰橈紝灏濊瘯鍚UDF杩炴帴琛屾坊鍔-lgcc鍒般

濡傛灉鎯宠MySQL鑷姩鍚姩锛屽彲浠ュ皢support-files/mysql.server澶嶅埗鍒/etc/init.d骞跺垱寤/etc/rc3.d/S99mysql.server绗﹀彿杩炴帴銆

濡傛灉鏈夊お澶氳繘绋嬭瘯鍥惧揩閫熻繛鎺mysqld锛屼綘搴斿綋鑳藉啀MySQL鏃ュ織鍙湅瑙侀敊璇細

Error in accept: Protocol error

鍙互灏濊瘯鐢--back_log=50閫夐」鍚姩鏈嶅姟鍣ㄦ潵瑙e喅璇ラ棶棰樸(MySQL 4浠ュ墠鐨勭増鏈腑浣跨敤-O back_log=50

Solaris涓嶆敮鎸setuid() 搴旂敤绋嬪簭鎵闇鐨勫唴鏍告枃浠讹紝鍥犳濡傛灉浣犱娇鐢--user閫夐」浣犱笉鑳戒粠mysqld閬囧埌鍐呮牳鏂囦欢銆

2.12.3.1. Solaris 2.7/2.8娉ㄦ剰浜嬮」

涓鑸儏鍐碉紝鍙互鍦Solaris 2.72.8涓娇鐢Solaris 2.6浜岃繘鍒躲傚ぇ澶氭暟Solaris 2.6鍙戝竷涔熼傜敤Solaris 2.72.8

MySQL搴斿綋鑳藉鑷姩妫娴嬪埌鏂扮殑Solaris鐗堟湰骞惰В鍐充笅闈㈢殑闂銆

Solaris 2.7/2.8include鏂囦欢涓湁涓浜涚己闄枫傚綋浣跨敤gcc浣犱細鐪嬭涓嬮潰鐨勯敊璇細

/usr/include/widec.h:42: warning: `getwc' redefined
/usr/include/wchar.h:326: warning: this is the location of the previous
definition

濡傛灉鍑虹幇璇ラ棶棰橈紝淇鐨勫姙娉曟槸灏/usr/include/widec.h澶嶅埗鍒.../lib/gcc-lib/os/gcc-version/include锛屽苟灏41琛屼粠锛

#if     !defined(lint) && !defined(__lint)

鏇存敼涓猴細

#if     !defined(lint) && !defined(__lint) && !defined(getwc)

鍙﹀锛屽彲浠ョ洿鎺ョ紪杈/usr/include/widec.h銆傜敤浠讳綍涓绉嶆柟娉曚慨澶嶅悗锛屽簲褰撳垹鎺config.cache骞跺啀娆¤繍琛configure

濡傛灉杩愯make鏃堕亣鍒颁笅闈㈢殑閿欒锛岃繖鏄洜涓configure涓嶈兘妫娴嬪埌curses.h鏂囦欢(鍙兘鏄洜涓/usr/include/widec.h涓殑閿欒)

In file included from mysql.cc:50:
/usr/include/term.h:1060: syntax error before `,'
/usr/include/term.h:1081: syntax error before `;'

鍙互鐢ㄤ笅闈换浣曚竴绉嶆柟娉曡В鍐宠闂锛

         CFLAGS=-DHAVE_CURSES_H CXXFLAGS=-DHAVE_CURSES_H ./configure閰嶇疆銆

         鏍规嵁鍓嶉潰鐨勮璁虹紪杈/usr/include/widec.h骞堕噸鏂configure

         鍒犳帀config.h鏂囦欢涓殑#define HAVE_TERM琛屽苟閲嶆柊杩愯make

濡傛灉閾炬帴瀹㈡埛绔▼搴忔椂杩炴帴鍣ㄦ壘涓嶅埌-lz锛岄棶棰樺彲鑳芥槸libz.so鏂囦欢瀹夎鍒颁簡/usr/local/lib銆傚彲浠ョ敤涓嬮潰浠讳綍涓绉嶆柟娉曡В鍐宠闂锛

         LD_LIBRARY_PATH澧炲姞/usr/local/lib

         澧炲姞鍒libz.so from /lib鐨勮繛鎺ャ

         濡傛灉浣跨敤Solaris 8,鍙互瀹夎Solaris 8 CD鍒嗗彂鐗堜腑鐨勫彲閫夐」zlib

         鏋勫缓MySQL鏃剁敤--with-named-z-libs=no閫夐」杩愯configure

2.12.3.2. Solaris x86娉ㄦ剰浜嬮」

x86 Solaris 8, 濡傛灉浣跨敤strip鍒犻櫎璋冭瘯绗﹀彿锛mysqld杞偍鍐呮牳銆

濡傛灉姝e湪 Solaris x86涓婁娇鐢gccegcs锛屽苟涓斾綘纰板埌浜嗗湪瑁呰浇鏃剁殑鍐呮牳杞偍闂锛屽簲璇ヤ娇鐢ㄤ笅鍒configure鍛戒护锛

CC=gcc CFLAGS="-O3 -fomit-frame-pointer -DHAVE_CURSES_H" \
CXX=gcc \
CXXFLAGS="-O3 -fomit-frame-pointer -felide-constructors \
    -fno-exceptions -fno-rtti -DHAVE_CURSES_H" \
./configure --prefix=/usr/local/mysql

libstdc++搴撳拰涓C++寮傚父澶勭悊鏉ラ伩鍏嶈繖涓棶棰樸

濡傛灉杩欐病鏈夊府鍔╋紝浣犲簲璇ョ紪璇戜竴涓皟璇曠増鏈苟涓旂敤涓涓釜杩规枃浠惰繍琛屽畠鎴栧湪gdb涓嬭繍琛屽畠銆傝鍙傝E.1.3鑺傦紝鈥滃湪gdb鐜涓嬭皟璇昺ysqld

2.12.4. BSD娉ㄦ剰浜嬮」

鏈妭鎻愪緵鍦ㄥ悇绉BSD Unix涓娇鐢MySQL鐨勭浉鍏充俊鎭

2.12.4.1. FreeBSD娉ㄦ剰浜嬮」

瀵逛簬杩愯MySQL锛屾帹鑽愪娇鐢FreeBSD 4.x鎴栨洿鏂扮増鏈紝鍥犱负鍏剁嚎绋嬪寘鏇村姞瀹屾暣銆傝鎯抽亣鍒颁竴涓畨鍏ㄣ佺ǔ瀹氱殑绯荤粺锛屼綘搴斿綋鍙娇鐢ㄦ爣璁-RELEASEFreeBSD鍐呮牳銆

鏈瀹规槗鍥犳鏄瘮杈冨彈鍠滄鐨勫畨瑁呮柟娉曟槸浣跨敤mysql-servermysql-client绉绘锛屽彲浠http://www.freebsd.org寰楀埌銆

浣跨敤杩欎簺绉绘鐨勭泭澶勫寘鎷細

  • 涓涓叏浼樺寲鐨勫伐浣滃湪FreeBSD鐗堟湰涓婄殑MySQL
  • 鑷姩閰嶇疆鍜屾瀯寤恒
  • 鍚姩鑴氭湰瀹夎鍦/usr/local/etc/rc.d

         pkg_info -L瀵熺湅鍝釜鏂囦欢琚畨瑁呯殑鑳藉姏

         濡傛灉浣犲湪閭e彴鏈哄櫒涓婁笉鍐嶆兂瑕MySQL锛岀敤pkg_delete瀹屽叏鍒犻櫎瀹冧滑銆

寤鸿鍦FreeBSD 2.x鐗堜笂浣跨敤 MIT-pthreads锛屽湪鐗堟湰3鍜屼互涓婄増鏈敤鍘熺敓绾跨▼銆傚湪涓浜2.2.x鐨勪互鍚庣増鏈娇鐢ㄥ師鐢熺嚎绋嬭繍琛屾槸鍙兘鐨勶紝浣嗘槸浣犲彲鑳界鍒mysqld鍏虫帀鐨勯棶棰樸

閬楁喚鐨勬槸锛FreeBSD璋冪敤鐨勬煇浜涘嚱鏁拌繕涓嶈兘瀹屽叏淇濊瘉绾跨▼瀹夊叏銆傜壒鍒护浜烘敞鎰忕殑鏄紝鍖呮嫭gethostbyname()鍑芥暟锛 MySQL浣跨敤璇ュ嚱鏁板皢涓绘満鍚嶈浆鎹负IP鍦板潃銆傚湪鏌愪簺鐜涓紝mysqld杩涚▼浼氱獊鐒堕犳垚100%CPU璐熻嵎锛屼笉鍐嶅搷搴斻傚鏋滀綘閬囧埌璇ラ棶棰橈紝灏濊瘯浣跨敤--skip-name-resolve閫夐」鍚姩MySQL

鍙﹀锛岃繕鍙互灏FreeBSD 4.x涓殑MySQLLinuxThreads搴撹繛鎺ワ紝杩欐牱鍙互閬垮厤涓浜涘師鐢FreeBSD绾跨▼鎵ц鏃剁殑闂銆備负浜嗘洿濂藉湴灏LinuxThreads鍚屽師鐢熺嚎绋嬭繘琛屽姣旓紝鍙傝Jeremy Zawodny鐨勬枃绔FreeBSD or Linux for your MySQL Server? 鍦板潃锛http://jeremy.zawodny.com/blog/archives/000697.html

FreeBSD浣跨敤LinuxThreads鐨勫凡鐭ラ棶棰樻湁锛

         杩炴帴鏃堕棿(wait_timeoutinteractive_timeoutnet_read_timeout)鍊间笉鐞嗘兂銆傜幇璞℃槸姘镐箙杩炴帴鎸傝捣杈冮暱鏃堕棿锛屼笉鑳藉叧闂紝鍙湁绾跨▼鎵ц鏂板懡浠ゆ椂 'kill'绾跨▼鏂规湁鏁堛

杩欏彲鑳芥槸绾跨▼搴撲腑鐨勪俊鍙峰鐞嗛棶棰橈紝淇″彿涓嶈兘涓柇鎸傝捣鐨勮鍛戒护銆傛湡鏈涘湪FreeBSD 5.0涓慨澶嶃

MySQL鏋勫缓杩涚▼闇瑕GNU make(gmake)宸ヤ綔銆傚鏋滄病鏈GNU make锛屽繀椤诲湪缂栬瘧MySQL鍓嶅厛瀹夎瀹冦

寤鸿鐨勫湪FreeBSD涓敤gcc(2.95.2鍜屼互涓婄増鏈)缂栬瘧鍜屽畨瑁MySQL鐨勬柟娉曟槸锛

CC=gcc CFLAGS="-O2 -fno-strength-reduce" \
    CXX=gcc CXXFLAGS="-O2 -fno-rtti -fno-exceptions \
    -felide-constructors -fno-strength-reduce" \
    ./configure --prefix=/usr/local/mysql --enable-assembler
gmake
gmake install
cd /usr/local/mysql
bin/mysql_install_db --user=mysql
bin/mysqld_safe &
 

濡傛灉configure浣跨敤MIT-pthreads锛屽簲褰撻槄璇MIT-pthreads娉ㄦ剰浜嬮」銆傝鍙傝2.8.5鑺傦紝鈥淢IT-pthreads娉ㄦ剰浜嬮」鈥

濡傛灉浣犱粠make install閬囧埌涓涓畠涓嶈兘鎵惧埌/usr/include/pthreads鐨勯敊璇紝configure娌℃湁妫娴嬪嚭浣犻渶瑕MIT-pthreads銆傝淇璇ラ棶棰橈紝绉昏蛋config.cache锛岀劧鍚庣敤--with-mit-threads閫夐」閲嶆柊杩愯configure

纭畾璁╀綘鐨勫悕瀛楄В鏋愮▼搴忓畨瑁呮纭紝鍚﹀垯褰撹繛鎺mysqld鏃讹紝浣犲彲鑳戒細閬囧埌瑙f瀽寤舵椂鎴栧け璐ャ備繚璇佸湪/etc/hosts鏂囦欢涓殑localhost鍏ュ彛鏄纭殑銆/etc/hosts鏂囦欢搴旇浠ヤ笅闈竴琛屽紑濮嬶細

127.0.0.1       localhost localhost.your.domain

宸茬煡FreeBSD鐨勬枃浠跺彞鏌勯檺鍒堕粯璁ゅ煎緢浣庛傝鍙傝A.2.17鑺傦紝鈥滄枃浠舵湭鎵惧埌鈥銆備娇鐢--open-files-limit閫夐」鎵цmysqld_safe鍚姩鏈嶅姟鍣紝鎴栧湪/etc/login.confmysqld鐢ㄦ埛鎻愰珮闄愬埗骞剁敤cap_mkdb /etc/login.conf閲嶅缓瀹冦傚鏋滀綘涓嶄娇鐢ㄩ粯璁ゅ悕(鍗充娇鐢chpass mysqld-user-name)锛岃繕瑕佷繚璇佷负璇ョ敤鎴疯缃湪瀵嗙爜鏂囦欢涓殑鐩稿簲绾у埆銆傝鍙傝5.1.3鑺傦紝鈥渕ysqld_safe锛歁ySQL鏈嶅姟鍣ㄥ惎鍔ㄨ剼鏈

FreeBSD灏嗚繘绋嬬┖闂撮檺鍒跺埌512MB锛屽嵆浣跨郴缁熸湁寰堝鐨勫彲鐢RAM涔熷姝ゃ傚洜姝や綘鍙兘浼氶亣鍒板涓嬫墍绀洪敊璇細

Out of memory (Needed 16391 bytes)

鍦ㄥ綋鍓嶇増鏈殑FreeBSD(鑷冲皯4.x鍜屾洿楂樼増鏈)涓紝浣犲彲浠ュ湪/boot/loader.conf鏂囦欢涓鍔犱笅闈㈢殑鏉$洰骞堕噸鍚満鍣ㄥ鍔犺闄愬埗(涓嶈兘鍦ㄨ繍琛屾椂闂寸敤sysctl鍛戒护鏇存敼杩欎簺璁惧畾鍊)

kern.maxdsiz="1073741824" # 1GB
kern.dfldsiz="1073741824" # 1GB
kern.maxssiz="134217728" # 128MB

鍦ㄦ棫鐗堟湰鐨FreeBSD涓紝蹇呴』閲嶆柊缂栬瘧鍐呮牳锛屼互渚挎洿鏀硅繘绋嬬殑鏈澶ф暟鎹绌洪棿銆傚湪杩欑鎯呭喌涓嬶紝搴斿綋鏌ョ湅LINT閰嶇疆鏂囦欢涓殑MAXDSIZ閫夐」鏌ョ湅鏇磋缁嗙殑淇℃伅銆

濡傛灉MySQL鐨勫綋鍓嶆棩鏈熸湁闂锛岃缃TZ鍙橀噺灏嗕細鏈夊府鍔┿傝鍙傝闄勫綍F锛鐜鍙橀噺

2.12.4.2. NetBSD娉ㄦ剰浜嬮」

涓轰簡鍦NetBSD涓婄紪璇戯紝浣犻渶瑕GNU make锛屽惁鍒欏綋make璇曞浘鍦C++鏂囦欢涓婅繍琛lint鏃讹紝缂栬瘧灏嗗け璐ャ

2.12.4.3. OpenBSD 2.5鐗堟敞鎰忎簨椤

OpenBSD 2.5涓婏紝鍙互鐢ㄤ笅鍒楅夐」缂栬瘧甯﹀師鐢熺嚎绋嬬殑MySQL
CFLAGS=-pthread CXXFLAGS=-pthread ./configure --with-mit-threads=no

2.12.4.4. BSD/OS 2.x鐗堟敞鎰忎簨椤

濡傛灉鍦ㄧ紪璇MySQL鏃讹紝閬囧埌涓嬪垪閿欒, 璇存槑铏氭嫙鍐呭瓨鐨ulimit鍊煎お浣庝簡锛

item_func.h: In method
`Item_func_ge::Item_func_ge(const Item_func_ge &)':
item_func.h:28: virtual memory exhausted
make[2]: *** [item_func.o] Error 1

璇曡瘯浣跨敤ulimit -v 80000骞跺啀娆¤繍琛make銆傚鏋滆繖杩樹笉琛屽苟涓斾綘姝e湪浣跨敤bash锛岃瘯璇曟崲鍒cshsh锛涗竴浜BSDI鐢ㄦ埛鎶ュ憡浜嗕娇鐢bashulimit鏈夐棶棰樸

濡傛灉浣犳鍦ㄤ娇鐢gcc锛屽彲鑳藉繀椤讳负configure浣跨敤--with-low-memory鏍囧織鎵嶈兘缂璇戔sql_yacc.cc

濡傛灉MySQL鐨勫綋鍓嶆棩鏈熸湁闂锛岃缃TZ鍙橀噺灏嗕細鏈夊府鍔┿傝鍙傝闄勫綍F锛鐜鍙橀噺

2.12.4.5. BSD/OS 3.x鐗堟敞鎰忎簨椤

鍗囩骇鍒BSD/OS 3.1銆傚鏋滀笉鑳藉崌绾э紝鍒欏畨瑁BSDI patch M300-038

鍦ㄩ厤缃MySQL鏃讹紝浣跨敤涓嬪垪鍛戒护:

env CXX=shlicc++ CC=shlicc2 \
./configure \
    --prefix=/usr/local/mysql \
    --localstatedir=/var/mysql \
    --without-perl \
    --with-unix-socket-path=/var/mysql/mysql.sock

宸茬煡涓嬮潰鐨勯」鍙互宸ヤ綔锛

env CC=gcc CXX=gcc CXXFLAGS=-O3 \
./configure \
    --prefix=/usr/local/mysql \
    --with-unix-socket-path=/var/mysql/mysql.sock

濡傛灉浣犳効鎰忥紝鍙互鏀瑰彉鐩綍浣嶇疆锛屾垨涓嶆寚瀹氫换浣曚綅缃屼娇鐢ㄩ粯璁ょ洰褰曘

濡傛灉鍦ㄩ噸璐熻浇涓嬬殑鎬ц兘鏈夐棶棰橈紝璇曡瘯浣跨敤--skip-thread-priority閫夐」鎵цmysqld锛佽繖灏嗕互鐩稿悓浼樺厛绾ц繍琛屾墍鏈夌嚎绋嬶紱鍦BSDI 3.1涓婏紝鍙互寰楀埌杈冨ソ鐨勬ц兘(鑷冲皯鐩村埌BSDI鍙互淇鍏剁嚎绋嬭皟搴︾▼搴)

濡傛灉鍦ㄧ紪璇戞椂閬囧埌virtual memory exhausted閿欒锛岃瘯璇曚娇鐢ulimit -v 80000骞跺啀娆¤繍琛make銆傚鏋滆繖杩樹笉琛屽苟涓斾綘姝e湪浣跨敤bash锛岃瘯璇曟崲鍒cshsh锛涗竴浜BSDI鐢ㄦ埛鎶ュ憡浜嗕娇鐢bashulimit浼氭湁闂銆

2.12.4.6. BSD/OS 4.x鐗堟敞鎰忎簨椤

BSDI 4.x鏈変竴浜涚嚎绋嬫湁鍏崇殑缂洪櫡銆傚鏋滀綘鎯宠鍦ㄨ繖涓婇潰浣跨敤MySQL锛屽簲璇ュ畨瑁呮墍鏈変笌绾跨▼鐩稿叧鐨勮ˉ涓侊紝鑷冲皯搴旇瀹夎M400-023

鍦ㄤ竴浜 BSDI 4.x绯荤粺涓紝浣犲彲鑳戒細閬囧埌鍏变韩搴撻棶棰樸傜幇璞℃槸涓嶈兘鎵ц浠讳綍瀹㈡埛绔▼搴忥紝渚嬪锛mysqladmin銆傚湪杩欑鎯呭喌涓嬶紝闇瑕侀噸鏂伴厤缃紝鐢disable-shared閫夐」绂佺敤搴撶殑鍏变韩浠ヤ究杩涜閰嶇疆銆

涓浜涘鎴峰湪BSDI 4.0.1涓亣鍒颁簡涓ラ噸闂锛屽嵆mysqld浜岃繘鍒惰繃涓浼氬効涓嶈兘鎵撳紑琛ㄣ傝繖鏄洜涓轰竴浜涘簱/绯荤粺鐩稿叧閿欒浣mysqld鏈緱鍒版寚浠や究鏇存敼浜嗗綋鍓嶇洰褰曘

淇鏂规硶鏄崌绾MySQL鍒版渶浣3.23.34鐗堟垨鏇撮珮鐗堬紝杩愯configure鍚庯紝杩愯make鍓嶅垹鎺config.h涓殑琛#define HAVE_REALPATH

璇锋敞鎰忚繖璇存槑浣犱笉鑳介氳繃绗﹀彿杩炴帴灏嗘暟鎹簱鐩綍杩炴帴鍒板彟涓涓暟鎹簱鐩綍锛屾垨閫氳繃绗﹀彿杩炴帴灏嗚〃杩炴帴鍒BSDI涓婄殑鍙︿竴涓暟鎹簱銆(鍙互閫氳繃绗﹀彿杩炴帴杩炴帴鍒板彟涓涓‖鐩)

2.12.5. 鍏跺畠Unix娉ㄦ剰浜嬮」

2.12.5.1. HP-UX 10.20鐗堟敞鎰忎簨椤

HP-UX涓婄紪璇MySQL鏃讹紝鏈変竴浜涒滃皬鈥濋棶棰樸傛垜浠帹鑽愭偍浣跨敤gcc鑰屼笉鏄HP-UX鑷繁鐨勭紪璇戝櫒锛屽洜涓gcc鍙互鐢熸垚鏇村ソ鐨勪唬鐮侊紒

鎴戜滑鎺ㄨ崘鍦HP-UX涓婁娇鐢gcc 2.95锛屼笉浣跨敤楂樺害浼樺寲鏍囧織(绫讳技-O6)锛屽洜涓鸿繖鍦HP-UX 涓婂彲鑳戒笉瀹夊叏銆

涓嬮潰鐨configure琛屽湪gcc 2.95涓簲褰撳伐浣滐細

CFLAGS="-I/opt/dce/include -fpic" \
CXXFLAGS="-I/opt/dce/include -felide-constructors -fno-exceptions \
-fno-rtti" \
CXX=gcc \
./configure --with-pthread \
    --with-named-thread-libs='-ldce' \
    --prefix=/usr/local/mysql --disable-shared

涓嬮潰鐨configure琛屽湪gcc 3.1涓簲褰撳伐浣滐細

CFLAGS="-DHPUX -I/opt/dce/include -O3 -fPIC" CXX=gcc \
CXXFLAGS="-DHPUX -I/opt/dce/include -felide-constructors \
    -fno-exceptions -fno-rtti -O3 -fPIC" \
./configure --prefix=/usr/local/mysql \
    --with-extra-charsets=complex --enable-thread-safe-client \
    --enable-local-infile  --with-pthread \
    --with-named-thread-libs=-ldce --with-lib-ccflags=-fPIC
    --disable-shared

2.12.5.2. HP-UX 11.x鐗堟敞鎰忎簨椤

鐢变簬鍦ㄦ爣鍑 HP-UX搴撲腑鏈変竴浜涗弗閲嶉敊璇紝璇曞浘鍦HP-UX 11.0涓婅繍琛MySQL鍓嶅簲褰撳畨瑁呬笅闈㈢殑琛ヤ竵锛
PHKL_22840 Streams cumulative
PHNE_22397 ARPA cumulative

杩欐牱鍙互瑙e喅鍦ㄧ嚎绋嬪簲鐢ㄧ▼搴忎腑杩愯recv()鏃跺緱鍒EWOULDBLOCK鍜屾墽琛accept()鏃跺緱鍒EBADF鐨勯棶棰樸

濡傛灉浣犲湪鏈墦琛ヤ竵鐨HP-UX 11.x绯荤粺涓娇鐢gcc 2.95.1锛屽彲鑳戒細閬囧埌涓嬮潰鐨勯敊璇細

In file included from /usr/include/unistd.h:11,
                 from ../include/global.h:125,
                 from mysql_priv.h:15,
                 from item.cc:19:
/usr/include/sys/unistd.h:184: declaration of C function ...
/usr/include/sys/pthread.h:440: previous declaration ...
In file included from item.h:306,
                 from mysql_priv.h:158,
                 from item.cc:19:

闂鏄HP-UX娌℃湁涓鑷村湴瀹氫箟pthreads_atfork()銆傚畠鍚/usr/include/sys/unistd.h184/usr/include/sys/pthreads.h440涓殑鍘熷瀷鍐茬獊銆

涓涓В鍐冲姙娉曟槸灏/usr/include/sys/unistd.h澶嶅埗鍒MySQL/include骞剁紪杈unistd.h锛屽瀹冭繘琛屾洿鏀逛互鍖归厤pthreads.h涓殑瀹氫箟銆傛煡鎵句笅鍒楄锛

extern int pthreads_atfork(void (*prepare)()void (*parent)(),
                                          void (*child)())

灏嗗畠鏇存敼涓猴細

extern int pthreads_atfork(void (*prepare)(void)void (*parent)(void),
                                          void (*child)(void))

鏇存敼瀹屽悗锛屼笅闈㈢殑configure琛屽簲褰撳伐浣滐細

CFLAGS="-fomit-frame-pointer -O3 -fpic" CXX=gcc \
CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti -O3" \
./configure --prefix=/usr/local/mysql --disable-shared

濡傛灉浣犱娇鐢HP-UX 缂栬瘧鍣紝鍙互浣跨敤涓嬮潰鐨勫懡浠(宸茬粡鐢cc B.11.11.04杩涜浜嗘祴璇)

CC=cc CXX=aCC CFLAGS=+DD64 CXXFLAGS=+DD64 ./configure \
    --with-extra-character-set=complex

浣犲彲浠ュ拷鐣ヤ笅闈㈢被鍨嬬殑浠讳綍閿欒锛

aCC: warning 901: unknown option: `-3': use +help for online
documentation

濡傛灉杩愯configure鏃堕亣鍒颁笅闈㈢殑閿欒锛岃楠岃瘉鍦ㄥ埌HP-UX CC++缂栬瘧鍣ㄧ殑璺緞鍓嶆槸鍚︽湁鍒K&R缂栬瘧鍣ㄧ殑璺緞锛

checking for cc option to accept ANSI C... no
configure: error: MySQL requires an ANSI C compiler (and a C++ compiler).
Try gcc. See the Installation chapter in the Reference Manual.

涓嶈兘缂栬瘧鐨勫彟涓涓師鍥犲彲鑳芥槸浣犳病鏈夋寜鐓у墠闈㈡墍杩板畾涔+DD64鏍囪銆

瀵逛簬HP-UX 11锛屽彟涓涓姙娉曟槸浣跨敤http://dev.mysql.com/downloads/鎻愪緵鐨MySQL浜岃繘鍒讹紝杩欐槸鎴戜滑宸茬粡鏋勫缓骞舵祴璇曡繃鐨勩傛垜浠篃鏀跺埌浜MySQLHP-UX 10.20浜岃繘鍒跺彲浠ュ湪HP-UX 11涓婃垚鍔熻繍琛岀殑鎶ュ憡銆傚鏋滀綘閬囧埌闂锛屼竴瀹氳妫鏌HP-UX琛ヤ竵鐨勭増鏈

2.12.5.3. IBM-AIX娉ㄦ剰浜嬮」

Autoconf涓病鏈変簡xlC鑷姩妫娴嬶紝鍥犳杩愯configure锛岄渶瑕佽缃澶氬彉閲忋備互涓嬩緥瀛愪娇鐢IBM缂栬瘧鍣細

export CC="xlc_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192 "
export CXX="xlC_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192"
export CFLAGS="-I /usr/local/include"
export LDFLAGS="-L /usr/local/lib"
export CPPFLAGS=$CFLAGS
export CXXFLAGS=$CFLAGS
 
./configure --prefix=/usr/local \
                --localstatedir=/var/mysql \
                --sbindir='/usr/local/bin' \
                --libexecdir='/usr/local/bin' \
                --enable-thread-safe-client \
                --enable-large-files
 

鍙互浠http://www-frec.bull.com/鎵惧埌涓婅堪缂栬瘧MySQL鍒嗗彂鐗堢殑閫夐」銆

濡傛灉浣犲皢鍓嶉潰鐨configure琛屼腑鐨-O3鏀逛负-O2锛屽繀椤诲垹鎺-qstrict閫夐」銆傝繖鏄IBM C缂栬瘧鍣ㄧ殑闄愬埗銆

濡傛灉浣犳鍦ㄤ娇鐢gccegcs缂栬瘧MySQL蹇呴』浣跨敤-fno-exceptions鏍囧織锛屽洜涓gcc/egcs鐨勫紓甯稿鐞嗕笉鏄绾跨▼瀹夊叏鐨勶紒锛堝凡缁忕敤egcs1.1娴嬭瘯杩囷級銆IBM姹囩紪绋嬪簭涔熸湁涓浜涘凡鐭ラ棶棰橈紝褰撲娇鐢gcc鏃跺彲浠ョ敓鎴愬潖鐨勪唬鐮併

AIX 涓婁娇鐢egcsgcc 2.95锛屾垜浠帹鑽愪笅鍒configure琛岋細

CC="gcc -pipe -mcpu=power -Wa,-many" \
CXX="gcc -pipe -mcpu=power -Wa,-many" \
CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" \
./configure --prefix=/usr/local/mysql --with-low-memory

涓轰簡鎴愬姛缂栬瘧锛岄渶瑕佷娇鐢-Wa,-many閫夐」銆IBM鐭ラ亾璇ラ棶棰橈紝浣嗘槸鐢变簬宸ヤ綔鍖虹殑鍘熷洜锛屼笉鎬ヤ簬淇瀹冦傛垜浠笉鐭ラ亾gcc 2.95鏄惁闇瑕-fno-exceptions閫夐」,浣嗘槸鍥犱负MySQL涓嶄娇鐢ㄤ緥澶栵紝骞朵笖璇ラ夐」鍙互浜х敓蹇熺殑浠g爜锛屾垜浠缓璁娇鐢egcs/gcc鏃朵娇鐢ㄨ閫夐」銆

濡傛灉姹囩紪鐮佹湁闂锛岃瘯璇曟洿鏀-mcpu=xxx閫夐」浠ュ尮閰嶄綘鐨CPU銆備竴鑸儏鍐靛彲鑳介渶瑕佷娇鐢power2powerpowerpc銆傚彟澶栵紝浣犲彲鑳介渶瑕佷娇鐢604604e銆傛垜浠笉鑳界粷瀵硅偗瀹氫絾鎬鐤power涓鑸簲瀹夊叏锛屽嵆浣垮湪power2鏈哄櫒涓婁篃瀹夊叏銆

濡傛灉浣犱笉鐭ラ亾浣犵殑CPU鏄粈涔堟牱鐨勶紝鍙互鎵цuname -m鍛戒护銆傚彲浠ヤ骇鐢熺被浼000514676700鐨勫瓧绗︿覆锛屾牸寮忎负xxyyyyyymmss锛屽叾涓xxss鎬绘槸00,yyyyyy鏄敮涓鐨勭郴缁IDmmCPU PlanarID銆備粠http://www16.boulder.ibm.com/pseries/en_US/cmds/aixcmds5/uname.htm鍙互鎵惧埌杩欎簺鍊肩殑鍥捐〃銆

璇ュ浘琛ㄥ彲浠ョ粰鍑轰綘鍙互浣跨敤鐨勬満鍣ㄧ被鍨嬪拰鏈哄櫒鍨嬪彿锛岀‘瀹CPU鐨勭被鍨嬨

濡傛灉閬囧埌淇″彿闂(MySQL鍦ㄩ珮璐熻浇涓嬪嚭浜烘剰鏂欏湴姝绘帀)锛屼綘鍙兘宸茬粡鍙戠幇浜嗕笌绾跨▼鍜屼俊鍙锋湁鍏崇殑涓涓OS 缂洪櫡銆傚湪杩欑鎯呭喌涓嬶紝浣犲彲浠ョ敤濡備笅閰嶇疆鍛婅瘔MySQL涓嶄娇鐢ㄤ俊鍙凤細

CFLAGS=-DDONT_USE_THR_ALARM CXX=gcc \
CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti \
-DDONT_USE_THR_ALARM" \
./configure --prefix=/usr/local/mysql --with-debug \
    --with-low-memory

杩欎笉褰卞搷MySQL鐨勬ц兘锛屼絾鏄湁鍓綔鐢紝灏辨槸涓嶈兘鐢mysqladmin killmysqladmin shutdown鏉姝诲湪涓涓繛鎺ヤ笂鈥滅潯鐪犫濈殑瀹㈡埛绔傜浉鍙嶏紝褰撳鎴风鍙戝嚭涓嬩竴涓懡浠ゆ椂锛屽畠灏嗘鎺夈

AIX鐨勪竴浜涚増鏈笂鐢libbind.a閾炬帴浣垮緱getservbyname锛堬級鍐呮牳杞偍锛岃繖鏄AIX鐨勪竴涓己闄峰苟涓斿簲璇ユ姤鍛IBM

瀵逛簬AIX 4.2.1gcc锛岃繘琛屼笅闈㈢殑鏇存敼銆

閰嶇疆瀹屽悗锛岀紪杈config.hinclude/my_config.h锛屽皢涓嬮潰鐨勮锛

#define HAVE_SNPRINTF 1

鏇存敼涓猴細

#undef HAVE_SNPRINTF

鏈鍚庨渶瑕佸湪mysqld.cc涓负initgroups ()娣诲姞锛

#ifdef _AIX41
extern "C" int initgroups(const char *,int);
#endif

濡傛灉浣犻渶瑕佷负mysqld杩涚▼鍒嗛厤澶ч噺鍐呭瓨锛屽彧浣跨敤ulimit -d unlimited鏄笉澶熺殑銆傝繕鍙互闇瑕佷慨鏀mysqld_safe锛屽鍔犱笅闈㈢殑琛岋細

export LDR_CNTRL='MAXDATA=0x80000000'

鍏充簬浣跨敤澶ч噺鍐呭瓨鐨勪俊鎭鏌ラ槄http://publib16.boulder.ibm.com/pseries/en_US/aixprggd/genprogc/lrg_prg_support.htm

2.12.5.4. SunOS 4娉ㄦ剰浜嬮」

SunOS 4涓婏紝闇瑕佺敤MIT-pthreads缂栬瘧MySQL锛屽弽杩囨潵杩欐剰鍛崇潃闇瑕佷娇鐢GNU make

涓浜SunOS 4绯荤粺鐨勫姩鎬佸簱鍜libtool鏈夐棶棰樸傚彲浠ヤ娇鐢ㄤ笅鍒configure琛屾潵閬垮厤杩欎釜闂锛

./configure --disable-shared --with-mysqld-ldflags=-all-static

褰撶紪璇readline鏃讹紝鍙兘浼氶亣鍒板叧浜庨噸澶嶅畾涔夌殑璀﹀憡锛屽彲浠ュ拷鐣ャ

褰撶紪璇mysqld鐨勬椂鍊欙紝灏嗕細閬囧埌implicit declaration of function璀﹀憡锛屽彲浠ュ拷鐣ャ

2.12.5.5. Alpha-DEC-UNIX(Tru64)鐗堟敞鎰忎簨椤

濡傛灉浣犲湪Digital Unix涓婁娇鐢egcs 1.1.2锛屽簲褰撳崌绾у埌gcc 2.95.2,鍥犱负egcsDEC涓婃湁涓浜涗弗閲嶇己闄凤紒

褰撳湪Digital UNIX涓嬬紪璇戠嚎绋嬬▼搴忔椂锛屾枃妗f帹鑽愬浜cccxx浣跨敤-pthread閫夐」鍜-lmach -lexc搴擄紙闄や簡-lpthread)銆備綘搴旇璞′笅闈㈣繖鏍疯繍琛configure

CC="cc -pthread" CXX="cxx -pthread -O" \
./configure --with-named-thread-libs="-lpthread -lmach -lexc -lc"

褰撶紪璇mysqld鏃讹紝浼氱湅瑙佷笅闈㈢殑璀﹀憡锛

mysqld.cc: In function void handle_connections()':
mysqld.cc:626: passing long unsigned int *' as argument 3 of
accept(int,sockadddr *, int *)'

浣犲彲浠ユ斁蹇冨湴蹇界暐杩欎簺璀﹀憡锛屽畠浠殑鍙戠敓鏄洜涓configure鍙兘妫娴嬪嚭閿欒锛岃屼笉鏄鍛娿

濡傛灉鐩存帴浠庡懡浠よ鍚姩鏈嶅姟鍣紝褰撻鍑烘椂锛屽彲鑳芥湁姝绘帀鐨勯棶棰樸傦紙褰撲綘閫鍑烘椂锛岄噸瑕佽繘绋嬫敹鍒颁竴涓SIGHUP淇″彿)锛屽鏋滃姝わ紝璇曠潃璞¤繖鏍峰惎鍔ㄦ湇鍔″櫒锛

nohup mysqld [options] &

nohup浣垮緱鍚庨潰鐨勫懡浠ゅ拷瑙嗕粠缁堢鍙戞潵鐨勪换浣SIGHUP淇″彿浜嗐傚彟澶栵紝閫氳繃杩愯safe_mysqld鍚姩鏈嶅姟鍣紝鍙互璁nohup璋冪敤mysqld銆傝鍙傝5.1.3鑺傦紝鈥渕ysqld_safe锛歁ySQL鏈嶅姟鍣ㄥ惎鍔ㄨ剼鏈

濡傛灉缂栬瘧mysys/get_opt.c鏃堕亣鍒伴棶棰橈紝鍙渶瑕佷粠鍚姩鏂囦欢鍒犳帀#define _NO_PROTO琛屻

濡傛灉浣跨敤CompaqCC缂栬瘧鍣紝涓嬮潰鐨configure搴斿綋宸ヤ綔锛

CC="cc -pthread"
CFLAGS="-O4 -ansi_alias -ansi_args -fast -inline speed all -arch host"
CXX="cxx -pthread"
CXXFLAGS="-O4 -ansi_alias -ansi_args -fast -inline speed all \
    -arch host -noexceptions -nortti"
export CC CFLAGS CXX CXXFLAGS
./configure \
    --prefix=/usr/local/mysql \
    --with-low-memory \
    --enable-large-files \
    --enable-shared=yes \
    --with-named-thread-libs="-lpthread -lmach -lexc -lc"
gnumake

濡傛灉鐢ㄥ叡浜簱缂栬瘧鏃libtool鍑虹幇闂锛屽簲褰撹兘澶熷湪閾炬帴mysql鏃堕氳繃涓嬭堪鍛戒护瑙e喅璇ラ棶棰橈細

cd mysql
/bin/sh ../libtool --mode=link cxx -pthread  -O3 -DDBUG_OFF \
    -O4 -ansi_alias -ansi_args -fast -inline speed \
    -speculate all \ -arch host  -DUNDEF_HAVE_GETHOSTBYNAME_R \
    -o mysql  mysql.o readline.o sql_string.o completion_hash.o \
    ../readline/libreadline.a -lcurses \
    ../libmysql/.libs/libmysqlclient.so  -lm
cd ..
gnumake
gnumake install
scripts/mysql_install_db

2.12.5.6. Alpha-DEC-OSF/1娉ㄦ剰浜嬮」

濡傛灉閬囧埌缂栬瘧闂骞跺畨瑁呬簡DEC CCgcc锛屽皾璇曡繖鏍疯繍琛configure

CC=cc CFLAGS=-O CXX=gcc CXXFLAGS=-O3 \
./configure --prefix=/usr/local/mysql

濡傛灉閬囧埌c_asm.h鏂囦欢鐨勯棶棰橈紝鍙互鍒涘缓骞朵娇鐢ㄤ竴涓滃搼(dummy)c_asm.h鏂囦欢锛

touch include/c_asm.h
CC=gcc CFLAGS=-I./include \
CXX=gcc CXXFLAGS=-O3 \
./configure --prefix=/usr/local/mysql

璇锋敞鎰忎粠http://ftp.support.compaq.com/public/unix/涓嬭浇鏈鏂扮殑DEC(Compaq)琛ヤ竵鍙互淇ld绋嬪簭鐨勪笅闈㈤棶棰樸

OSF1 V4.0D鍜岀紪璇戝櫒"DEC C V5.6-071 on Digital UNIX V4.0 (Rev. 878)" 涓婏紝缂栬瘧鍣ㄦ湁浜嗕竴浜涘鎬殑琛屼负(鏈畾涔asm鏍囧織)/bin/ld濂借薄涔熻鐮村潖(褰撻摼鎺mysqld鏃讹紝鍙戠敓_exit undefined闂)銆傚湪杩欎釜绯荤粺涓婏紝浠OSF 4.0C鐨勭増鏈浛鎹簡/bin/ld鍚庯紝鎴戜滑璁炬硶鐢ㄤ笅鍒configure鍛戒护琛岀紪璇MySQL

CC=gcc CXX=gcc CXXFLAGS=-O3 ./configure --prefix=/usr/local/mysql

Digital缂栬瘧鍣ㄢC++ V6.1-029鈥濓紝涓嬪垪鍛戒护搴旇宸ヤ綔锛

CC=cc -pthread
CFLAGS=-O4 -ansi_alias -ansi_args -fast -inline speed \
       -speculate all -arch host
CXX=cxx -pthread
CXXFLAGS=-O4 -ansi_alias -ansi_args -fast -inline speed \
         -speculate all -arch host -noexceptions -nortti
export CC CFLAGS CXX CXXFLAGS
./configure --prefix=/usr/mysql/mysql \
            --with-mysqld-ldflags=-all-static --disable-shared \
            --with-named-thread-libs="-lmach -lexc -lc"

OSF1鐨勬煇浜涚増鏈腑锛alloca()鍑芥暟琚牬鍧忥紝閫氳繃鍒犻櫎瀹氫箟'HAVE_ALLOCA'鐨勨config.h鐨勮鏇存瀹冦

alloca()鍑芥暟涔熷彲鑳藉湪/usr/include/alloca.h閲岄潰鏈変竴涓笉姝g‘鐨勫師鍨嬶紝婧愪簬姝ょ殑璀﹀憡鍙互蹇界暐銆

configure灏嗚嚜鍔ㄥ湴浣跨敤涓嬪垪绾跨▼搴擄細 --with-named-thread-libs="-lpthread -lmach -lexc -lc"

褰撲娇鐢gcc鏃讹紝涔熷彲浠ヨ瘯璇曡繖鏍疯繍琛configure

CFLAGS=-D_PTHREAD_USE_D4 CXX=gcc CXXFLAGS=-O3 ./configure ....

濡傛灉浣犵殑淇″彿鏈夐棶棰(MySQL鍑轰汉鎰忔枡鍦板湪楂樿礋杞戒笅姝绘帀)锛屽彲鑳介亣鍒颁簡涓涓嚎绋嬪拰淇″彿鏈夊叧鐨OS 缂洪櫡銆傚湪杩欑鎯呭喌涓嬶紝浣犲彲浠ュ憡璇MySQL濡備笅閰嶇疆涓嶄娇鐢ㄤ俊鍙凤細

CFLAGS=-DDONT_USE_THR_ALARM \
CXXFLAGS=-DDONT_USE_THR_ALARM \
./configure 

杩欎笉褰卞搷MySQL鎬ц兘锛屼絾鏄湁鍓綔鐢紝灏辨槸涓嶈兘鐢mysqladmin killmysqladmin shutdown鏉姝诲湪涓涓繛鎺ヤ笂鈥滅潯鐪犫濈殑瀹㈡埛绔傜浉鍙嶏紝褰撳鎴风鍙戝嚭涓嬩竴涓懡浠ゆ椂锛屽畠灏嗘鎺夈

浣跨敤gcc 2.95.2,浼氶亣鍒颁笅闈㈢殑缂栬瘧閿欒锛

sql_acl.cc:1456: Internal compiler error in `scan_region',
at except.c:2566
Please submit a full bug report.

瑕佷慨澶嶈闂锛屽簲褰撹繘鍏sql鐩綍骞跺壀鍒囥佸鍒舵渶鍚gcc锛屼絾搴斿皢-O3 鏀逛负-O0 (鎴栧鏋滅紪璇戣娌℃湁浠讳綍-O閫夐」锛屽簲鍦gcc鍚庨潰澧炲姞-O0)銆備箣鍚庯紝鍙互鍥炲埌椤剁骇鐩綍骞堕噸鏂拌繍琛make

2.12.5.7. SGI Irix娉ㄦ剰浜嬮」

濡傛灉浣跨敤Irix 6.5.3鎴栨洿鏂扮増锛屽鏋滅敤鎷ユ湁CAP_SCHED_MGT鏉冮檺鐨勭敤鎴(渚嬪root)杩愯mysqld鎴栫敤涓嬮潰鐨shell鍛戒护缁mysqld鏈嶅姟鍣ㄨ鏉冮檺锛mysqld鑳藉鍒涘缓绾跨▼锛

chcap "CAP_SCHED_MGT+epi" /opt/mysql/libexec/mysqld

鍙兘闇瑕佸湪杩愯configure鍚庝笖鍦ㄧ紪璇戝墠瀹氫箟config.h閲岄潰鐨勪竴浜涚鍙枫

鍦ㄤ竴浜Irix瀹炵幇涓紝alloca()鍑芥暟琚牬鍧忋傚鏋mysqld鏈嶅姟鍣ㄦ浜庝竴浜SELECT璇彞锛屾妸config.h瀹氫箟HAVE_ALLOCHAVE_ALLOCA_H鐨勮鍒犻櫎鍗冲彲銆傚鏋mysqladmin create涓嶅伐浣滐紝鎶config.h瀹氫箟HAVE_READDIR_R鐨勮鍒犻櫎锛屼綘涔熷彲鑳藉繀椤诲垹闄HAVE_TERM_H琛屻

SGI鎺ㄨ崘灏嗘湰椤典笂鐨勬墍鏈夎ˉ涓佷綔涓轰竴涓暣浣撴潵瀹夎锛

http://support.sgi.com/surfzone/patches/patchset/6.2_indigo.rps.html

鑷冲皯锛屽簲璇ュ畨瑁呮渶鏂扮殑鏍稿績鍗(rollup)銆佹渶鏂扮殑rld鍗峰拰鏈鏂扮殑libc鍗枫

寰堟槑纭紝瀵逛簬pthreads鏀寔锛岄渶瑕佹湰椤典笂鎵鏈夌殑POSIX琛ヤ竵锛

http://support.sgi.com/surfzone/patches/patchset/6.2_posix.rps.html

濡傛灉鍦ㄧ紪璇mysql.cc鏃讹紝閬囧埌绫讳技浜庝笅闈㈢殑閿欒:

"/usr/include/curses.h", line 82: error(1084):
invalid combinatiof type

閭d箞搴斿湪MySQL婧愮爜鏍戠殑椤剁骇鐩綍杈撳叆涓嬪垪鍛戒护锛

extra/replace bool curses_bool < /usr/include/curses.h > include/curses.h
make

搴旇涔熸湁瀹夋帓涓婄殑闂鎶ュ憡銆傚鏋滃彧鏈変竴涓嚎绋嬫鍦ㄨ繍琛岋紝浜嬫儏浼氬彉鎱㈢殑銆傞氳繃鍚姩鍙﹀涓涓鎴风鏉ラ伩鍏嶅畠锛岃繖鍙互瀵艰嚧姝ゅ悗鍏跺畠绾跨▼鐨勬墽琛岄熷害澧炲姞210鍊嶃傝繖鏄Irix绾跨▼闅句互鐞嗚В鐨勯棶棰橈紱鍙兘蹇呴』涓存椂鍑嗗鎵惧嚭瑙e喅鏂规鐩村埌瀹冭兘琚慨姝c

 

濡傛灉浣犳鍦ㄧ敤gcc缂栬瘧锛屽彲浠ヤ娇鐢ㄤ笅鍒configure鍛戒护锛

 

CC=gcc CXX=gcc CXXFLAGS=-O3 \
./configure --prefix=/usr/local/mysql --enable-thread-safe-client \
    --with-named-thread-libs=-lpthread

鍦ㄧ敤鍘熺敓Irix CC++缂栬瘧鍣7.3.1.2Irix 6.5.11,涓嬮潰鐨勯」宸ヤ綔锛

CC=cc CXX=CC CFLAGS='-O3 -n32 -TARG:platform=IP22 -I/usr/local/include \
-L/usr/local/lib' CXXFLAGS='-O3 -n32 -TARG:platform=IP22 \
-I/usr/local/include -L/usr/local/lib' \
./configure --prefix=/usr/local/mysql --with-innodb --with-berkeley-db \
    --with-libwrap=/usr/local \
    --with-named-curses-libs=/usr/local/lib/libncurses.a

2.12.5.8. SCO UNIX鍜孫penServer 5.0.x鐗堟敞鎰忎簨椤

褰撳墠鐨勭Щ妞嶄粎鍦ㄢsco3.2v5.0.5,sco3.2v5.0.6鈥濆拰鈥sco3.2v5.0.7鈥濈郴缁熶笂杩涜浜嗘祴璇锛屽湪鈥sco 3.2v4.2鈥濅笂鐨勭Щ妞嶄篃鏈夊緢澶ц繘灞曘OpenServer 5.0.8(Legend)鍏锋湁鍘熺敓绾跨▼锛屽厑璁告枃浠跺ぇ浜2GB銆傜洰鍓嶆渶澶х殑鏂囦欢鍙互杈惧埌2GB

鎴戜滑鍙互鍦OpenServer涓婄敤gcc 2.95.3鐢ㄤ笅闈㈢殑configure鍛戒护缂栬瘧MySQL

CC=gcc CXX=gcc ./configure --prefix=/usr/local/mysql \
    --enable-thread-safe-client --with-innodb \
    --with-openssl --with-vio --with-extra-charsets=complex

ftp://ftp.sco.com/pub/openserver5/opensrc/gnutools-5.0.7Kj鍙互寰楀埌gcc

璇ュ紑鍙戠郴缁熼渶瑕佸湪OpenServer 5.0.6OpenServer Execution Environment Supplement oss646Boss656BOpenSource搴撲綅浜 gwxlibs銆傛墍鏈OpenSource宸ュ叿浣嶄簬opensrc鐩綍銆傚彲浠ヤ粠ftp://ftp.sco.com/pub/openserver5/opensrc/鑾峰緱銆

鎴戜滑寤鸿浣跨敤鏈鏂扮殑MySQL浜у搧鍙戝竷銆

SCO鎻愪緵鐨勬搷浣滅郴缁熻ˉ涓侊細OpenServer 5.0.[0-6]ftp://ftp.sco.com/pub/openserver5OpenServer 5.0.7ftp://ftp.sco.com/pub/openserverv5/507

SCO鎻愪緵鐨勫叧浜庡畨鍏ㄤ慨澶嶇殑淇℃伅锛Server 5.0.xftp://ftp.sco.com/pub/security/OpenServer

OpenSever 5.0.x绯荤粺涓婃渶澶х殑鏂囦欢鐨勫ぇ灏忎负2GB

OpenServer 5.0.x涓婏紝鍙緵涓茬紦鍐插尯銆clist鍜岄攣瀹氳褰曞垎閰嶇殑鎬诲唴瀛樹笉鑳借秴鍑60MB

涓茬紦鍐插尯鐨勫垎閰嶅崟浣嶄负4096 瀛楄妭鐨勯〉锛clists70瀛楄妭锛岄攣瀹氳褰曚负64瀛楄妭锛屽洜姝や负锛

(NSTRPAGES * 4096) + (NCLIST * 70) + (MAX_FLCKREC * 64) <= 62914560

鎸夌収浠ヤ笅姝ラ鏉ラ厤缃Database Services閫夐」銆傚鏋滀綘涓嶇‘瀹氬簲鐢ㄧ▼搴忔槸鍚﹂渶瑕侊紝鍙傝闅忓簲鐢ㄧ▼搴忔彁渚涚殑鏂囨。銆

1.    root鐧诲綍銆

2.    缂栬緫/etc/conf/sdevice.d/suds鏂囦欢鍚敤SUDS椹卞姩绋嬪簭銆傚皢绗2涓煙鍐呯殑N鏇存敼涓Y

3.    浣跨敤mkdev aioHardware/Kernel Manager鏉ュ惎鐢ㄥasynchronous I/O鐨勬敮鎸侊紝骞堕噸鏂拌繛鎺ュ唴鏍搞傝鎯宠鐢ㄦ埛閿佸畾鍐呭瓨鐢ㄤ簬璇ョ被I/O锛屾洿鏂aiomemlock(F)鏂囦欢銆傚簲褰撳璇ユ枃浠惰繘琛屾洿鏂帮紝鍖呮嫭杩涘彲浠ヤ娇鐢AIO鐨勭敤鎴峰拰鍙互閿佸畾鐨勬渶澶ф暟閲忕殑鍐呭瓨銆

4.    璁稿搴旂敤绋嬪簭浣跨敤setuid浜岃繘鍒讹紝鍥犳浣犲彧鑳芥寚瀹氬崟涓敤鎴 銆傝鍙傝闅忓簲鐢ㄧ▼搴忔彁渚涚殑鏂囨。鏉ョ湅鏄惁搴旂敤绋嬪簭鏄繖绉嶆儏鍐点

瀹屾垚璇ヨ繘绋嬪悗锛岄噸鏂板惎鍔ㄧ郴缁燂紝鍒涘缓鍖呮嫭杩欎簺鏇存敼鐨勬柊鍐呮牳銆

榛樿鎯呭喌锛/etc/conf/cf.d/mtune涓殑鏉$洰璁剧疆涓猴細

Value           Default         Min             Max
-----           -------         ---             ---
NBUF            0               24              450000
NHBUF           0               32              524288
NMPBUF          0               12              512
MAX_INODE       0               100             64000
MAX_FILE        0               100             64000
CTBUFSIZE       128             0               256
MAX_PROC        0               50              16000
MAX_REGION      0               500             160000
NCLIST          170             120             16640
MAXUP           100             15              16000
NOFILES         110             60              11000
NHINODE         128             64              8192
NAUTOUP         10              0               60
NGROUPS         8               0               128
BDFLUSHR        30              1               300
MAX_FLCKREC     0               50              16000
PUTBUFSZ        8000            2000            20000
MAXSLICE        100             25              100
ULIMIT          4194303         2048            4194303
* Streams Parameters
NSTREAM         64              1               32768
NSTRPUSH        9               9               9
NMUXLINK        192             1               4096
STRMSGSZ        16384           4096            524288
STRCTLSZ        1024            1024            1024
STRMAXBLK       524288          4096            524288
NSTRPAGES       500             0               8000
STRSPLITFRAC    80              50              100
NLOG            3               3               3
NUMSP           64              1               256
NUMTIM          16              1               8192
NUMTRW          16              1               8192
* Semaphore Parameters
SEMMAP          10              10              8192
SEMMNI          10              10              8192
SEMMNS          60              60              8192
SEMMNU          30              10              8192
SEMMSL          25              25              150
SEMOPM          10              10              1024
SEMUME          10              10              25
SEMVMX          32767           32767           32767
SEMAEM          16384           16384           16384
* Shared Memory Parameters
SHMMAX          524288          131072          2147483647
SHMMIN          1               1               1
SHMMNI          100             100             2000
FILE            0               100             64000
NMOUNT          0               4               256
NPROC           0               50              16000
NREGION         0               500             160000

鎴戜滑寤鸿灏嗚繖浜涘艰缃负锛

NOFILES搴斿綋涓40962048

MAXUP搴斿綋涓2048

瑕佹兂鏇存敼鍐呮牳锛岃繘鍏/etc/conf/bin骞朵娇鐢./idtune name parameter鏉ユ洿鏀广備緥濡傦紝瑕佸皢SEMMS鏀逛负200锛岀敤root璐︽埛鎵ц鍛戒护锛

# cd /etc/conf/bin
# ./idtune SEMMNS 200

鎴戜滑寤鸿瀵硅绯荤粺杩涜璋冭妭锛屼絾鏄娇鐢ㄧ殑姝g‘鍙傛暟鍊煎彇鍐充簬璁块棶搴旂敤绋嬪簭鎴栨暟鎹簱鐨勭敤鎴锋暟鐩拰鏁版嵁搴撶┖闂(涔熷氨鏄娇鐢ㄧ殑缂撳啿姹)銆備笅闈㈢殑椤瑰奖鍝/etc/conf/cf.d/stune涓畾涔夌殑鍐呮牳鍙傛暟锛

SHMMAX(鎺ㄨ崘璁惧畾鍊硷細128MB)SHMSEG(鎺ㄨ崘璁惧畾鍊硷細15)銆傝繖浜涘弬鏁板奖鍝嶅垱寤虹敤鎴风紦鍐叉睜鐨MySQL鏁版嵁搴撳紩鎿庛

NOFILESMAXUP鑷冲皯搴旇揪鍒2048

MAXPROC鑷冲皯搴斿綋璁剧疆鍒3000/4000(鍙栧喅浜庣敤鎴锋暟)鎴栨洿澶у笺

寤鸿浣跨敤涓嬮潰鐨勫叕寮忔潵璁$畻SEMMSLSEMMNSSEMMNU鐨勫硷細

SEMMSL = 13

鍙戠幇13鏈閫傚悎杩涚▼鍜MySQL

SEMMNS = SEMMSL * 绯荤粺涓婅繍琛岀殑db鏈嶅姟鍣ㄦ暟鐩

SEMMNS璁剧疆涓SEMMSL鍊间箻浠ヤ綘鍦ㄨ绯荤粺涓婁竴娆¤繍琛岀殑db鏈嶅姟鍣ㄧ殑(鏈澶)鏁扮洰銆

SEMMNU = SEMMNS

SEMMNU鍊艰缃负绛変簬SEMMNS鍊笺傚彲浠ュ皢璇ュ艰缃负75%SEMMNS锛屼絾鏄繖鏄竴涓繚瀹堢殑浼拌銆

鑷冲皯闇瑕佸畨瑁"SCO OpenServer Linker and Application Development Libraries"OpenServer寮鍙戠郴缁熸潵浣跨敤gcc銆備綘涓嶈兘鍙娇鐢GCC Dev绯荤粺锛岃屼笉瀹夎瀹冧滑銆

浣犲簲褰撹幏寰FSU PTHREADS瀹夎杞欢鍖呭苟鍏堝畨瑁呭畠銆傚彲浠ヤ粠http://moss.csc.ncsu.edu/~mueller/ftp/pub/PART/pthreads.tar.gz鑾峰緱銆備綘杩樺彲浠ヤ粠 ftp://ftp.zenez.com/pub/zenez/prgms/FSU-threads-3.14.tar.gz鑾峰緱棰勭紪璇戠殑瀹夎杞欢鍖呫

FSU Pthreads鑳界敤甯tcpipSCO UNIX 4.2缂栬瘧锛屾垨浣跨敤OpenServer 3.0Open Desktop 3.0(OS 3.0 ODT 3.0)锛屽畨瑁呭甫鏈変娇鐢ㄤ竴涓GCC 2.5.XSCO寮鍙戠郴缁熴傚ODTOS 3.0锛屽皢闇瑕佷竴涓GCC 2.5.x鐨勮壇濂界Щ妞嶃傛病鏈変竴涓壇濂界殑绉绘浼氭湁寰堝闂銆傚杩欎釜浜у搧鐨勭Щ妞嶉渶瑕SCO UNIX寮鍙戠郴缁燂紝娌℃湁瀹冿紝缂哄皯鎵闇鐨勫簱鍜岄摼鎺ュ櫒銆傝繕闇瑕SCO-3.2v4.2-includes.tar.gz銆傝鏂囦欢鍖呭惈SCO 寮鍙include 鏂囦欢鐨勬洿鏀硅繖鏄瀯寤MySQL鎵闇瑕佺殑銆傞渶瑕佺敤杩欎簺淇敼鐨勫ご鏂囦欢鏇挎崲宸叉湁绯荤粺鐨include鏂囦欢銆傚彲浠ヤ粠 ftp://ftp.zenez.com/pub/zenez/prgms/SCO-3.2v4.2-includes.tar.gz鑾峰緱銆

涓轰簡鍦ㄧ郴缁熶笂鏋勯FSU Pthreads锛岄渶瑕佸仛鐨勫伐浣滄槸杩愯GNU make銆傚惎鍔FSU-threads-3.14.tar.gz涓殑Makefile鐢熸垚FSU-绾跨▼銆

thread/src鐩綍涓嬭繍琛./configure骞朵笖閫夋嫨SCO OpenServer閫夐」銆傝繖涓懡浠ゆ嫹璐Makefile.SCO5鈥Makefile銆傜劧鍚庤繍琛make

涓轰簡鍦ㄩ粯璁鐨勨/usr/include鐩綍瀹夎锛屼綔涓root鐧诲綍锛岀劧鍚cd 鍒扳thread/src鐩綍锛屽苟杩愯make install

璁板緱鍦ㄥ埗浣MySQL鏃惰浣跨敤GNU make

娉ㄩ噴锛濡傛灉浣犱笉鏄綔涓root鍚姩safe_mysqld锛屽皢鍙兘姣忚繘绋嬪彧鏈 榛樿鐨110涓墦寮鐨勬枃浠躲mysqld灏嗗湪鏃ュ織鏂囦欢鍐欎笅鍏充簬姝ょ殑娉ㄨВ銆

SCO 3.2V4.2,搴斿綋浣跨敤FSU PTHREADS 3.14鎴栨洿鏂扮増銆備互涓configure鍛戒护搴斿綋宸ヤ綔锛

CFLAGS="-D_XOPEN_XPG4" CXX=gcc CXXFLAGS="-D_XOPEN_XPG4" \
./configure \
    --prefix=/usr/local/mysql \
    --with-named-thread-libs="-lgthreads -lsocket -lgen -lgthreads" \
    --with-named-curses-libs="-lcurses"

浣犲彲鑳介亣鍒include鏂囦欢鐨勬煇浜涢棶棰樸傚湪杩欑鎯呭喌涓嬶紝浣犺兘鍦ftp://www.mysql.com/pub/mysql/Downloads/SCO/SCO-3.2v4.2-includes.tar.gz鎵惧埌鏂扮殑SCO鐗瑰畾鐨include鏂囦欢銆備綘搴旇鍦MySQL婧愮爜鏍鐨勨include鐩綍涓嬫墦寮杩欎釜鏂囦欢銆

SCO寮鍙戞敞鎰忎簨椤癸細

  • MySQL搴旇鑷姩鍦版娴FSU Pthreads骞朵笖鐢-lgthreads -lsocket -lgthreads閫夐」閾炬帴mysqld
  • SCO寮鍙戝簱鍦FSU Pthreads鏄噸鍏(reentrant)鐨勩SCO瀹gО瀹冪殑搴撳嚱鏁版槸閲嶅叆鐨勶紝鍥犳浠栦滑涓瀹氬湪FSU Pthreads涓槸閲嶅叆鐨勩傚湪 OpenServer涓婄殑 FSU Pthreads 璇曞浘浣跨敤SCO鏂规鍒朵綔閲嶅叆鐨勫簱銆
  • FSU Pthreads(鑷冲皯鍦ftp::/ftp.zenez.com鐨勭増鏈)閾炬帴浜GNU malloc锛屽鏋滀綘閬囧埌鍐呭瓨浣跨敤鐨勯棶棰橈紝纭畾gmalloc.o鍖呭惈鍦libgthreads.alibgthreads.so涓

         FSU Pthreads涓紝涓嬪垪绯荤粺璋冪敤鏄pthreads鎰熺煡鐨勶細read()write()getmsg()connect()accept()select()wait()

         CSSA-2001-SCO.35.2(琛ヤ竵鍒椾负瀹氬埗erg711905-dscr_remap瀹夊叏琛ヤ竵(鐗堟湰 2.0.0))涓柇FSU绾跨▼骞朵娇mysqld涓嶇ǔ瀹氥傚鏋滀綘鎯冲湪 OpenServer 5.0.6鏈哄櫒涓婅繍琛mysqld蹇呴』鍒犻櫎瀹冦

         濡傛灉浣犱娇鐢SCO OpenServer 5,鍙兘闇瑕佺敤-DDRAFT7 in CFLAGS閲嶆柊缂栬瘧FSU pthreads銆傚惁鍒欙紝mysqld鍚姩鏃InnoDB浼氭寕璧枫

         SCOftp://ftp.sco.com/pub/openserver5鎻愪緵浜OpenServer 5.0.x鐨勬搷浣滅郴缁熻ˉ涓併

         SCOftp://ftp.sco.com/pub/security/sseftp://ftp.sco.com/pub/security/sse鎻愪緵浜OpenServer 5.0.x鐨勫畨鍏ㄤ慨澶嶅拰libsocket.so.2

         Pre-OSR506瀹夊叏淇銆傚湪ftp://stage.caldera.com/pub/security/openserver/ftp://stage.caldera.com/pub/security/openserver/CSSA-2001-SCO.10/鎻愪緵浜libsocket.so.2libresolv.so.1telnetd淇锛屼互鍙婂湪pre-OSR506绯荤粺涓婄殑瀹夎璇存槑銆

鏈濂藉湪缂栬瘧/浣跨敤MySQL涔嬪墠瀹夎杩欎簺琛ヤ竵銆

Legend/ OpenServer 6.0.0鏈夊師鐢熺嚎绋嬶紝娌℃湁2GB鏂囦欢澶у皬闄愬埗銆

2.12.5.9. SCO UnixWare 7.1.x鍜孫penUNIX 8.0.0鐗堟敞鎰忎簨椤

鎴戜滑寤鸿浣跨敤鏈鏂扮殑MySQL浜у搧鍙戝竷銆

鎴戜滑鍙互鐢ㄤ笅闈㈢殑configure鍛戒护UnixWare 7.1.x涓紪璇MySQL

CC="cc" CFLAGS="-I/usr/local/include" \
CXX="CC" CXXFLAGS="-I/usr/local/include" \
./configure --prefix=/usr/local/mysql \
    --enable-thread-safe-client --with-berkeley-db=./bdb \
    --with-innodb --with-openssl --with-extra-charsets=complex

濡傛灉浣犳兂瑕佷娇鐢gcc锛屽繀椤讳娇鐢gcc 2.95.3鎴栨洿鏂扮増銆

CC=gcc CXX=g++ ./configure --prefix=/usr/local/mysql

褰撴瀯寤MySQL鏃朵笉浣跨敤UnixWare 7.1.4OpenServer 6.0.0涓殑Berkeley DB鐗堟湰銆MySQL浣跨敤鑷繁鐨Berkeley DB銆傜敤鏉ユ瀯寤洪潤鎬佸拰鍔ㄦ佸簱鐨configure鍛戒护src_directory/bdb/build_unix/涓紝浣嗘槸瀹冧笉鍦MySQL鑷繁鐨BDB鐗堟湰涓傚伐浣滃尯濡備笅鎵绀恒

1.    鎸夊父瑙勯厤缃MySQL

2.    杩涘叆cdbdb/build_unix/

3.    -p Makefile澶嶅埗(cp)Makefile.sav

4.    浣跨敤鍚屾牱鐨勯夐」骞惰繍琛../dist/configure

5.    杩愯gmake

6.    cp -p Makefile.sav Makefile

7.    杩涘叆椤剁骇婧愮洰褰曞苟杩愯gmake

鍏佽鐢熸垚鍏变韩鍜屽姩鎬佸簱骞跺伐浣溿

SCOftp://ftp.sco.com/pub/unixware7鎻愪緵浜UnixWare 7.1.1鐨勬搷浣滅郴缁熻ˉ涓,ftp://ftp.sco.com/pub/unixware7/713/ 鎻愪緵浜UnixWare 7.1.3鐨勬搷浣滅郴缁熻ˉ涓, UnixWare 7.1.4鐨勮ftp://ftp.sco.com/pub/unixware7/714/, OpenUNIX 8.0.0鐨勮 ftp://ftp.sco.com/pub/openunix8

SCO鎻愪緵鐨勫畨鍏ㄤ慨澶嶇浉鍏充俊鎭細OpenUNIXftp://ftp.sco.com/pub/security/OpenUNIXUnixWare ftp://ftp.sco.com/pub/security/UnixWare

榛樿鎯呭喌锛屽湪UnixWare 7.1.1绯荤粺涓渶澶ф枃浠剁殑澶у皬涓1GB锛屼絾鏄UnixWare 7.1.4涓枃浠跺ぇ灏忛檺鍒舵槸1 TB锛堢敤VXFS锛夈備竴浜OS瀹炵敤绋嬪簭 鐨勯檺鍒舵槸2GB銆傚湪UnixWare 7涓彲鑳界殑鏈澶ф枃浠跺ぇ灏忔槸1TB锛堢敤VXFS锛夈

UnixWare 7.1.4涓紝浣犱笉闇瑕侀噰鍙栨帾鏂芥潵鑾峰緱澶ф枃浠舵敮鎸侊紝浣嗗湪UnixWare 7.1.x鐨勪互鍓嶇増鏈腑闇瑕佸惎鐢ㄥぇ鏂囦欢鏀寔锛屽彲浠ヨ繍琛fsadm

# fsadm -Fvxfs -o largefiles /
# fsadm /         * Note
# ulimit unlimited
# cd /etc/conf/bin
# ./idtune SFSZLIM 0x7FFFFFFF     ** Note
# ./idtune HFSZLIM 0x7FFFFFFF     ** Note
# ./idbuild -B
 
* This should report "largefiles".
** 0x7FFFFFFF represents infinity for these values.

shutdown閲嶅惎绯荤粺銆

榛樿鎯呭喌锛/etc/conf/cf.d/mtune涓殑鏉$洰璁剧疆涓猴細

Value           Default         Min             Max
-----           -------         ---             ---
SVMMLIM         0x9000000       0x1000000       0x7FFFFFFF
HVMMLIM         0x9000000       0x1000000       0x7FFFFFFF
SSTKLIM         0x1000000       0x2000          0x7FFFFFFF
HSTKLIM         0x1000000       0x2000          0x7FFFFFFF

鎴戜滑寤鸿灏嗚繖浜涘艰缃负锛

SDATLIM 0x7FFFFFFF
HDATLIM 0x7FFFFFFF
SSTKLIM 0x7FFFFFFF
HSTKLIM 0x7FFFFFFF
SVMMLIM 0x7FFFFFFF
HVMMLIM 0x7FFFFFFF
SFNOLIM 2048
HFNOLIM 2048

鎴戜滑寤鸿瀵硅绯荤粺杩涜璋冭妭锛屼絾鏄娇鐢ㄧ殑姝g‘鍙傛暟鍊煎彇鍐充簬璁块棶搴旂敤绋嬪簭鎴栨暟鎹簱鐨勭敤鎴锋暟鐩拰鏁版嵁搴撶┖闂(涔熷氨鏄娇鐢ㄧ殑缂撳啿姹)銆備笅闈㈢殑椤瑰奖鍝/etc/conf/cf.d/stune涓畾涔夌殑鍐呮牳鍙傛暟锛

SHMMAX(鎺ㄨ崘璁惧畾鍊硷細128MB)SHMSEG(鎺ㄨ崘璁惧畾鍊硷細15)銆傝繖浜涘弬鏁板奖鍝嶅垱寤虹敤鎴风紦鍐叉睜鐨MySQL鏁版嵁搴撳紩鎿庛

SFNOLIMHFNOLIM鑷冲皯搴旇揪鍒2048

NPROC鑷冲皯搴斿綋璁剧疆鍒3000/4000(鍙栧喅浜庣敤鎴锋暟)

寤鸿浣跨敤涓嬮潰鐨勫叕寮忔潵璁$畻SEMMSLSEMMNSSEMMNU鐨勫硷細

SEMMSL = 13

鎹彂鐜13鏈閫傚悎杩涚▼鍜MySQL

SEMMNS = SEMMSL * 绯荤粺涓婅繍琛岀殑db鏈嶅姟鍣ㄦ暟鐩

SEMMNS璁剧疆涓SEMMSL鍊间箻浠ヤ綘鍦ㄨ绯荤粺涓婁竴娆¤繍琛岀殑db鏈嶅姟鍣ㄧ殑(鏈澶)鏁扮洰銆

SEMMNU = SEMMNS

SEMMNU鍊艰缃负绛変簬SEMMNS鍊笺傚彲浠ュ皢璇ュ艰缃负75%SEMMNS锛屼絾鏄繖鏄竴涓繚瀹堢殑浼拌銆

2.12.5.10. SCO OpenServer 6.0.x鐗堟敞鎰忎簨椤

OpenServer6鐨勪富瑕佹敼杩涘寘鎷細

         澶ф枃浠舵敮鎸侊紝鍙揪鍒1 TB

         澶氬鐞嗗櫒鏀寔锛屼粠4涓鐞嗗櫒澧炲姞鍒32涓鐞嗗櫒銆

         澧炲姞鐨勫唴瀛樻敮鎸侊紝鍙揪鍒64GB

         UnixWare鐨勫姛鑳芥墿灞曞埌OpenServer6

         鎬ц兘鐨勬敼杩

OpenServer6.0.0鍏锋湁锛

         /bin锛岀敤浜庝笌OpenServer5.0.x鐩稿悓琛屼负鐨勫懡浠ゃ

         /u95/bin鐢ㄤ簬鏍囧噯鐨勫懡浠わ紝渚嬪澶ф枃浠剁郴缁(LFS)鏀寔銆

         /udk/bin鐢ㄤ簬UnixWare 7.1.4涓浉鍚岀殑鍛戒护锛岄粯璁ゆ槸LFS鏀寔銆

涓嬮潰鏄湪OpenServer6涓婅缃PATH鐨勬寚瀵笺傚鏋滅敤鎴锋兂浣跨敤浼犵粺鐨OpenServer5.0.x锛屽垯璺緞搴斿綋棣栧厛涓/bin銆傚鏋滅敤鎴烽渶瑕LFS鏀寔锛屽垯 璺緞搴斿綋涓/u95/bin/bin銆傚鏋滅敤鎴烽閫UnixWare 7鏀寔锛屽垯璺緞搴斾负/udk/bin/u95/bin/bin

鎴戜滑寤鸿浣跨敤鏈鏂扮殑MySQL浜у搧鍙戝竷銆

鎴戜滑鍙互鍦OpenServer 6.0.x鐢ㄤ笅闈㈢殑configure鍛戒护缂栬瘧MySQL

CC="cc" CFLAGS="-I/usr/local/include" \
CXX="CC" CXXFLAGS="-I/usr/local/include" \
./configure --prefix=/usr/local/mysql \
    --enable-thread-safe-client --with-berkeley-db=./bdb \
    --with-innodb --with-openssl --with-extra-charsets=complex \
    --enable-readline

濡傛灉浣犳兂瑕佷娇鐢gcc锛屽繀椤讳娇鐢gcc2.95.3鎴栨洿鏂扮増銆

CC=gcc CXX=g++ ./configure --prefix=/usr/local/mysql

褰撴瀯寤MySQL鏃朵笉浣跨敤UnixWare 7.1.4OpenServer 6.0.0涓殑Berkeley DB鐗堟湰銆MySQL浣跨敤鑷繁鐨Berkeley DB銆傜敤鏉ユ瀯寤洪潤鎬佸拰鍔ㄦ佸簱鐨configure鍛戒护src_directory/bdb/build_unix/涓紝浣嗘槸瀹冧笉鍦MySQL鑷繁鐨BDB鐗堟湰涓傚伐浣滃尯濡備笅鎵绀恒

1.    鎸夊父瑙勯厤缃MySQL

2.    杩涘叆cdbdb/build_unix/

3.    -p Makefile澶嶅埗(cp)Makefile.sav

4.    浣跨敤鍚屾牱鐨勯夐」骞惰繍琛../dist/configure

5.    杩愯gmake

6.    cp -p Makefile.sav Makefile

7.    杩涘叆椤剁骇婧愮洰褰曞苟杩愯gmake

鍏佽鐢熸垚鍏变韩鍜屽姩鎬佸簱骞跺伐浣溿OpenServer6.0.0 杩橀渶瑕MySQL婧愮爜鏍戠殑琛ヤ竵鍜岄傜敤浜bdb/dist/config.guessconfig.guess鐨勮ˉ涓併備綘鍙互浠ftp://ftp.zenez.com/pub/zenez/prgms/mysql-4.1.12-osr6-patches.tar.gzftp://ftp.zenez.com/pub/zenez/prgms/mysql-4.x.x-osr6-patches涓嬭浇琛ヤ竵銆傛湁涓涓README鏂囦欢鍙互鎻愪緵甯姪銆

SCOftp://ftp.sco.com/pub/openserver6鎻愪緵浜OpenServer6鐨勬搷浣滅郴缁熻ˉ涓併

SCOftp://ftp.sco.com/pub/security/OpenServer鎻愪緵鍏充簬瀹夊叏淇鐨勪俊鎭

榛樿鎯呭喌锛屽湪OpenServer6.0.0绯荤粺鐨勬渶澶ф枃浠跺ぇ灏忎负1TB銆備竴浜涙搷浣滅郴缁熷伐鍏风殑闄愬埗鏄2GB銆傚湪UnixWare 7涓渶澶ф枃浠跺ぇ灏忓彲浠ユ槸1TB锛堢敤 VXFSHTFS锛夈

榛樿鎯呭喌锛/etc/conf/cf.d/mtune涓殑鏉$洰璁剧疆涓猴細

Value           Default         Min             Max
-----           -------         ---             ---
SVMMLIM         0x9000000       0x1000000       0x7FFFFFFF
HVMMLIM         0x9000000       0x1000000       0x7FFFFFFF
SSTKLIM         0x1000000       0x2000          0x7FFFFFFF
HSTKLIM         0x1000000       0x2000          0x7FFFFFFF

鎴戜滑寤鸿灏嗚繖浜涘艰缃负锛

SDATLIM 0x7FFFFFFF
HDATLIM 0x7FFFFFFF
SSTKLIM 0x7FFFFFFF
HSTKLIM 0x7FFFFFFF
SVMMLIM 0x7FFFFFFF
HVMMLIM 0x7FFFFFFF
SFNOLIM 2048
HFNOLIM 2048

鎴戜滑寤鸿瀵硅绯荤粺杩涜璋冭妭锛屼絾鏄娇鐢ㄧ殑姝g‘鍙傛暟鍊煎彇鍐充簬璁块棶搴旂敤绋嬪簭鎴栨暟鎹簱鐨勭敤鎴锋暟鐩拰鏁版嵁搴撶┖闂(涔熷氨鏄娇鐢ㄧ殑缂撳啿姹)銆備笅闈㈢殑椤瑰奖鍝/etc/conf/cf.d/stune涓畾涔夌殑鍐呮牳鍙傛暟锛

SHMMAX(鎺ㄨ崘璁惧畾鍊硷細128MB)SHMSEG(鎺ㄨ崘璁惧畾鍊硷細15)銆傝繖浜涘弬鏁板奖鍝嶅垱寤虹敤鎴风紦鍐叉睜鐨MySQL鏁版嵁搴撳紩鎿庛

SFNOLIMHFNOLIM鑷冲皯搴旇揪鍒2048

NPROC鑷冲皯搴斿綋璁剧疆鍒3000/4000(鍙栧喅浜庣敤鎴锋暟)

寤鸿浣跨敤涓嬮潰鐨勫叕寮忔潵璁$畻SEMMSLSEMMNSSEMMNU鐨勫硷細

SEMMSL = 13

鍙戠幇13鏈閫傚悎杩涚▼鍜MySQL

SEMMNS = SEMMSL * 绯荤粺涓婅繍琛岀殑db鏈嶅姟鍣ㄦ暟鐩

SEMMNS璁剧疆涓SEMMSL鍊间箻浠ヤ綘鍦ㄨ绯荤粺涓婁竴娆¤繍琛岀殑db鏈嶅姟鍣ㄧ殑(鏈澶)鏁扮洰銆

SEMMNU = SEMMNS

SEMMNU鍊艰缃负绛変簬SEMMNS鍊笺傚彲浠ュ皢璇ュ艰缃负75%SEMMNS锛屼絾鏄繖鏄竴涓繚瀹堢殑浼拌銆

2.12.6. OS/2娉ㄦ剰浜嬮」

MySQL浣跨敤澶鐨勬墦寮鏂囦欢銆傚洜姝わ紝搴旇澧炲姞绫讳技涓嬮潰鐨勪笢瑗垮埌CONFIG.SYS鏂囦欢锛
SET EMXOPT=-c -n -h1024

濡傛灉涓嶈繖鏍峰仛锛屽皢鍙兘纰板埌涓嬪垪閿欒锛

File 'xxxx' not found (Errcode: 24)

OS/2 Warp 3涓婁娇鐢MySQL鏃讹紝瑕佹眰FixPack 29鎴栦互涓婄増鏈傜敤OS/2 Wrap 4锛岃姹FixPack 4鎴栦互涓婄増鏈傝繖鏄Pthreads搴撶殑涓涓姹傘MySQL蹇呴』瀹夎鍦ㄦ敮鎸侀暱鏂囦欢鍚嶇殑涓涓垎鍖轰笂锛屽HPFSFAT32绛夌瓑銆

INSTALL.CMD鑴氭湰蹇呴』浠OS/2鑷繁鐨CMD.EXE杩愯骞朵笖涓嶈兘宸ヤ綔鍦ㄦ浛浠e澹冲4OS2.EXE鈥濄

scripts/mysql-install-db鑴氭湰宸茬粡琚噸鏂板懡鍚嶄簡锛氬畠绉颁负install.cmd骞朵笖鏄竴涓REXX鑴氭湰锛屽皢瀹夎 榛樿鐨MySQL瀹夊叏閰嶇疆骞朵负MySQL鍒涘缓WorkPlace Shell鍥炬爣銆

鍔ㄦ佹ā鍧楁敮鎸侀氳繃缂栬瘧浣嗘病鏈夊厖鍒嗘祴璇曪紝鍔ㄦ佹ā鍧楀簲璇ヤ娇鐢Pthreads杩愯鏃跺埢搴撶紪璇戙

 

gcc -Zdll -Zmt -Zcrtdll=pthrdrtl -I../include -I../regex -I.. \
    -o example udf_example.cc -L../lib -lmysqlclient udf_example.def
mv example.dll example.udf

娉ㄩ噴锛鐢变簬OS/2鐨勯檺鍒讹紝UDF妯″潡鍚嶅瓧鐨勮瘝骞蹭笉鑳借秴杩8涓瓧绗︺傛ā鍧楀瓨鍌ㄥ湪/mysql2/udf鐩綍锛safe-mysqld.cmd鑴氭湰灏嗘妸杩欎釜鐩綍鏀惧湪BEGINLIBPATH鐜鍙橀噺涓傚綋浣跨敤UDF妯″潡鏃讹紝鎸囧畾鐨勬墿灞曞悕琚拷鐣--瀹冭鍋囧畾涓.udf銆備緥濡傦紝鍦 Unix涓婏紝鍏变韩妯″潡鍙兘琚懡鍚涓衡example.so骞朵笖鍙互璞¤繖鏍蜂粠瀹冭杞藉嚱鏁帮細

mysql> CREATE FUNCTION metaphon RETURNS STRING SONAME 'example.so'

OS/2, 妯″潡琚懡鍚嶄负example.udf锛屼絾鏄笉鑳芥寚瀹氭ā鍧楁墿灞曞悕锛

mysql> CREATE FUNCTION metaphon RETURNS STRING SONAME 'example'

2.13. Perl瀹夎娉ㄦ剰浜嬮」

PerlMySQL鐨勬敮鎸佸熷姪DBI/DBD瀹㈡埛绔帴鍙c傛帴鍙h姹Perl 5.6.0鎴栦互鍚庣増鏈傚鏋滀綘鐨Perl鐗堟湰鏇存棫锛屾帴鍙灏嗕笉鑳藉伐浣

濡傛灉鎯宠鍦Perl DBI涓娇鐢ㄤ簨鍔★紝闇瑕佹湁1.2216鐗堟垨鏇存柊鐗DBD锛氾細mysql銆傚缓璁娇鐢2.9003鐗堟垨鏇存柊鐗堛

濡傛灉浣犱娇鐢MySQL 4.1瀹㈡埛绔簱锛屽繀椤讳娇鐢DBD锛氾細mysql 2.9003鎴栨洿鏂扮増銆

MySQL鍒嗗彂鐗堜笉鍖呭惈Perl鏀寔銆傚彲浠ヤ粠http://search.cpan.org鑾峰緱Unix闇瑕佺殑妯″潡锛屾垨鍦Windows涓娇鐢ActiveState ppm绋嬪簭銆備互涓嬬珷鑺傛弿杩颁簡濡備綍鍋氥

濡傛灉浣犳兂瑕佽繍琛MySQL鍩哄噯鑴氭湰锛屽繀椤诲畨瑁Perl鏀寔銆傝鍙傝7.1.4鑺傦紝鈥淢ySQL鍩哄噯濂椾欢鈥

2.13.1. 鍦║nix涓畨瑁匬erl

MySQL Perl鏀寔涔熻姹備綘瀹夎浜MySQL瀹㈡埛绔紪绋嬫敮鎸(搴撳拰澶存枃浠)銆傚ぇ澶氭暟瀹夎涓畨瑁呬簡蹇呰鐨勬枃浠躲備絾鏄紝濡傛灉浣犲湪Linux涓粠RPM鏂囦欢瀹夎MySQL锛岀‘淇濆畨瑁呬簡寮鍙戣RPM銆傚鎴风绋嬪簭鍦ㄥ鎴风RPM涓紝浣嗘槸瀹㈡埛绔紪绋嬫敮鎸佸湪寮鍙戣RPM

濡傛灉浣犳兂瑕佸畨瑁Perl鏀寔锛岄渶瑕佺殑鏂囦欢鑳戒粠http://search.cpan.orgCPAN (Comprehensive Perl Archive Network)鑾峰緱銆

Unix涓畨瑁Perl妯″潡鏈绠鍗曠殑鏂规硶鏄娇鐢CPAN妯″潡銆備緥濡傦細

shell> perl -MCPAN -e shell
cpan> install DBI
cpan> install DBD::mysql

DBD锛氾細mysql瀹夎杩愯璁稿娴嬭瘯銆傛祴璇曚腑浣跨敤榛樿鐢ㄦ埛鍚嶅拰瀵嗙爜灏濊瘯杩炴帴鏈湴MySQL鏈嶅姟鍣ㄣ(榛樿鐢ㄦ埛鍚嶆槸Unix涓殑鐧诲綍鍚嶅拰Windows涓殑ODBC銆傞粯璁ゅ瘑鐮佲滄病鏈瀵嗙爜銆) 濡傛灉浣犱笉鑳介氳繃杩欎簺鍊艰繛鎺ユ湇鍔″櫒 (渚嬪锛屽鏋滀綘鐨勮处鎴锋湁瀵嗙爜)锛屾祴璇曞け璐ャ傚彲浠ヤ娇鐢force install DBD::mysql蹇界暐澶辫触鐨勬祴璇曘

DBI闇瑕Data::Dumper妯″潡銆傚簲璇ュ彲浠ュ畨瑁咃紱濡傛灉涓嶈兘锛屽簲褰撳湪瀹夎DBI鍓嶅畨瑁Data::Dumper妯″潡銆

杩樺彲浠ヤ笅杞tar鏂囦欢鍘嬬缉鏍煎紡鐨勬ā鍧楀垎鍙戠増锛屽苟鎵嬪姩鏋勫缓妯″潡銆備緥濡傦紝瑙e帇缂╁拰鏋勫缓DBI鍒嗗彂鐗堢殑杩囩▼涓猴細

1.     灏嗗垎鍙戠増瑙e帇缂╁埌褰撳墠鐩綍锛

2.            shell> gunzip < DBI-VERSION.tar.gz | tar xvf -

璇ュ懡浠ゅ垱寤虹洰褰 DBI-VERSION

3.    杩涘叆瑙e帇缂╁垎鍙戠増鐨勯《绾х洰褰曪細

4.            shell> cd DBI-VERSION

5.    鏋勫缓鍒嗗彂鐗堝苟缂栬瘧锛

6.            shell> perl Makefile.PL
7.            shell> make
8.            shell> make test
9.            shell> make install

make test鍛戒护寰堥噸瑕侊紝鍥犱负瀹冮獙璇佹ā鍧楁鍦ㄥ伐浣溿傛敞鎰忥細鍦ㄤ綘DBD::mysql瀹夎鏈熼棿杩愯璇ュ懡浠よ瘯楠屾帴鍙d唬鐮佹椂锛MySQL鏈嶅姟鍣ㄥ繀椤绘鍦ㄨ繍琛岋紝鍚﹀垯娴嬭瘯灏嗗け璐ャ

鏃犺浣曟椂浣犲畨瑁呬竴涓柊鐗堟湰鐨MySQL锛岄噸寤哄苟涓旈噸鏂板畨瑁DBD::mysql鍒嗗彂鐗堟槸涓涓ソ涓绘剰, 鐗瑰埆鏄湪鍗囩骇MySQL鍚庯紝瑙傚療鎵鏈夊紓甯革紝濡DBI鑴氭湰澶辫触銆

濡傛灉浣犳病鏈夋潈闄愬湪绯荤粺鐩綍涓嬪畨瑁Perl妯″潡锛屾垨濡傛灉浣犲畨瑁呮湰鍦Perl妯″潡锛屼笅鍒楀弬鑰冧功鍙互甯姪浣狅細http://servers.digitaldaze.com/extensions/perl/modules.html#modules

鍦ㄦ爣棰樷Installing New Modules that Require Locally Installed Modules涓嬮潰鏌ユ壘銆

2.13.2. 鍦╓indows涓嬪畨瑁匒ctiveState Perl

Windows涓紝搴斿綋鎸夌収浠ヤ笅姝ラ瀹夎甯ActiveState PerlMySQL DBD妯″潡锛

         http://www.activestate.com/Products/ActivePerl/鑾峰緱ActiveState Perl骞跺畨瑁呫

         鎵撳紑鎺у埗鍙扮獥鍙(DOS绐楀彛)

         濡傛灉闇瑕侊紝璁剧疆HTTP_proxy鍙橀噺銆備緥濡傦紝浣犲彲浠ヨ瘯璇曪細

                set HTTP_proxy=my.proxy.com:3128

         鍚姩PPM绋嬪簭锛

                C\> C\perl\bin\ppm.pl

         濡傛灉浣犺繕娌℃湁瀹夎DBI锛屽垯瀹夎锛

                ppm> install DBI

         濡傛灉鎴愬姛锛岃繍琛屼笅闈㈢殑鍛戒护锛

                install\
                ftp://ftp.de.uu.net/pub/CPAN/authors/id/JWIED/DBD-mysql-1.2212.x86.ppd

璇ヨ繘绋嬪簲褰撳湪ActiveState Perl 5.6鎴栨洿鏂扮増鏈腑宸ヤ綔銆

濡傛灉浣犱笉鑳戒娇涓婅堪姝ラ宸ヤ綔锛屽簲璇ュ畨瑁MyODBC椹卞姩绋嬪簭骞朵笖閫氳繃ODBC杩炴帴MySQL鏈嶅姟鍣細

use DBI;
$dbh= DBI->connect("DBI:ODBC:$dsn",$user,$password) ||
die "Got error $DBI::errstr when connecting to $dsn\n";

2.13.3. 浣跨敤Perl DBI/DBD鎺ュ彛鐨勯棶棰

濡傛灉Perl鎶ュ憡瀹冧笉鑳藉彂鐜../mysql/mysql.so妯″潡锛屽彲鑳借瘯鍥犱负Perl涓嶈兘瀹氫綅鍏变韩搴libmysqlclient.so

鍙互浣跨敤涓嬮潰鐨勬柟娉曚慨澶嶈闂锛

         perl Makefile.PL -static -config鑰屼笉瑕佺敤perl Makefile.PL缂栬瘧DBD锛氾細mysql鍒嗗彂鐗堛

         libmysqlclient.so澶嶅埗鍒板叾瀹冨叡浜簱鎵鍦ㄧ殑鐩綍 (鍙兘涓/usr/lib /lib)

         淇敼鐢ㄦ潵缂栬瘧DBD锛氾細mysql-L閫夐」锛屽弽搴libmysqlclient.so鐨勫疄闄呬綅缃

         Linux涓紝浣犲彲浠ュ皢libmysqlclient.so鐨勭洰褰曡矾寰勫悕澧炲姞鍒/etc/ld.so.conf鏂囦欢銆

         libmysqlclient.so鐨勭洰褰曡矾寰勫悕澧炲姞鍒LD_RUN_PATH鐜鍙橀噺銆備竴浜涚郴缁熶娇鐢LD_LIBRARY_PATH

娉ㄦ剰濡傛灉杩炴帴鍣ㄦ病鏈夋壘鍒板彟涓涓簱锛屼綘杩樺彲鑳介渶瑕佷慨鏀-L閫夐」銆備緥濡傦紝濡傛灉鍥犱负libc/lib涓嬪苟涓旇繛鎺ュ懡浠ゆ寚瀹氫簡-L/usr/lib锛岃繛鎺ュ櫒涓嶈兘鎵惧埌瀹冿紝灏-L閫夐」鏇存敼涓-L/lib鎴栧湪杩炴帴鍛戒护涓鍔-L/lib

濡傛灉浣犻亣鍒颁笅闈㈢殑DBD锛氾細mysql閿欒锛屼綘鍙兘浣跨敤浜gcc(鎴栦娇鐢ㄤ簡鐢gcc缂栬瘧鐨勬棫鐨勪簩杩涘埗)

/usr/bin/perl: can't resolve symbol '__moddi3'
/usr/bin/perl: can't resolve symbol '__divdi3'

褰撴瀯寤mysql.so搴撴槸鍦ㄨ繛鎺ュ懡浠や腑澧炲姞-L/usr/lib/gcc-lib/... -lgcc(褰撶紪璇Perl瀹㈡埛绔椂妫鏌ョ敓鎴mysql.somake鐨勮緭鍑)-L閫夐」搴旀寚瀹libgcc.a鍦ㄧ郴缁熶腑鐨勫畨瑁呯洰褰曠殑璺緞鍚嶃

璇ラ棶棰樼殑鍙︿竴涓師鍥犳槸PerlMySQL娌℃湁鐢gcc缂栬瘧銆傚湪杩欑鎯呭喌涓嬶紝浣犲彲浠ョ敤gcc缂栬瘧浜岃呮潵瑙e喅銆

褰撲綘杩愯娴嬭瘯鏃朵綘浼氫粠DBD锛氾細mysql鐪嬭涓嬮潰鐨勯敊璇細

t/00base............install_driver(mysql) failed:
Can't load '../blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mysql:
../blib/arch/auto/DBD/mysql/mysql.so: undefined symbol:
uncompress at /usr/lib/perl5/5.00503/i586-linux/DynaLoader.pm line 169.

杩欐剰鍛崇潃浣犻渶瑕佸湪杩炴帴琛屽寘鎷-lz 鍘嬬缉搴撱傚彲浠ラ氳繃鏇存敼鏂囦欢lib/DBD/mysql/Install.pm鐨勪笅鍒楄鏉ュ疄鐜帮細

$sysliblist .= " -lm";

鏇存敼涓猴細

$sysliblist .= " -lm -lz";

鐒跺悗锛屼綘蹇呴』杩愯make realclean 鐒跺悗閲嶆柊瀹夎銆

濡傛灉浣犳兂瑕佸湪SCO涓婂畨瑁DBI锛岄渶瑕佸湪DBI-xxx 鍜屾瘡涓瓙鐩綍涓紪杈Makefile銆傝娉ㄦ剰涓嬮潰鐨勬洿鏂板亣瀹氫娇鐢gcc 2.95.2鎴栨洿鏂扮増锛

鏃э細                                 鏂帮細
CC = cc                               CC = gcc
CCCDLFLAGS = -KPIC -W1,-Bexport       CCCDLFLAGS = -fpic
CCDLFLAGS = -wl,-Bexport              CCDLFLAGS =
 
LD = ld                               LD = gcc -G -fpic
LDDLFLAGS = -G -L/usr/local/lib       LDDLFLAGS = -L/usr/local/lib
LDFLAGS = -belf -L/usr/local/lib      LDFLAGS = -L/usr/local/lib
 
LD = ld                               LD = gcc -G -fpic
OPTIMISE = -Od                        OPTIMISE = -O1
 
鏃э細
CCCFLAGS = -belf -dy -w0 -U M_XENIX -DPERL_SCO5 -I/usr/local/include
 
鏂帮細
CCFLAGS = -U M_XENIX -DPERL_SCO5 -I/usr/local/include

杩欎簺鏇存敼鏄繀闇鐨勶紝鍥犱负鐢icccc缂栬瘧鐨Perl鍔ㄦ佽杞藉櫒涓嶈杞DBI妯″潡銆

濡傛灉浣犳兂瑕佸湪涓嶆敮鎸佸姩鎬侀摼鎺(渚嬪 SCO)鐨勭郴缁熶腑浣跨敤Perl妯″潡锛屽彲浠ョ敓鎴愪竴涓寘鎷DBIDBD锛氾細mysql鐨勯潤鎬佺増鏈殑Perl銆傛柟娉曟槸鐢熸垚涓涓敤DBI浠g爜杩炴帴鐨Perl鐗堟湰锛屽苟灏嗗畠瀹夎鍒板綋鍓Perl鐨勯《绾х洰褰曘傜劧鍚庢瀯寤轰竴涓惈DBD浠g爜杩炴帴鐨Perl鐗堟湰骞跺畨瑁呫

SCO涓紝蹇呴』灏嗕笅闈㈢殑鐜鍙橀噺璁剧疆涓猴細

LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:/usr/progressive/lib

Or

LD_LIBRARY_PATH=/usr/lib:/lib:/usr/local/lib:/usr/ccs/lib:\
    /usr/progressive/lib:/usr/skunk/lib
LIBPATH=/usr/lib:/lib:/usr/local/lib:/usr/ccs/lib:\
    /usr/progressive/lib:/usr/skunk/lib
MANPATH=scohelp:/usr/man:/usr/local1/man:/usr/local/man:\
    /usr/skunk/man:

棣栧厛锛屽湪DBD鍒嗗彂鐗堢殑瀹夎鐩綍杩愯涓嬭堪鍛戒护鏉ュ垱寤轰竴涓寘鎷潤鎬佽繛鎺ョ殑DBD妯″潡鐨Perl

shell> perl Makefile.PL -static -config
shell> make
shell> make install
shell> make perl

鐒跺悗蹇呴』瀹夎鏂扮殑Perlmake perl鐨勮緭鍑鸿〃绀哄畨瑁呮椂闇瑕佹墽琛岀殑make鍛戒护銆傚湪SCO涓紝涓make -f Makefile.aperl inst_perl MAP_TARGET=perl

鐒跺悗锛屼娇鐢ㄥ垰鍒氬垱寤虹殑Perl锛屽湪DBD锛氾細mysql鍒嗗彂鐗堢殑瀹夎鐩綍杩愯涓嬭堪鍛戒护鏉ュ垱寤哄彟涓涓Perl锛屽簲鍖呮嫭闈欐佽繛鎺ョ殑DBD锛氾細mysql

shell> perl Makefile.PL -static -config
shell> make
shell> make install
shell> make perl

鏈鍚庯紝搴斿綋瀹夎鏂扮殑Perlmake perl杈撳嚭鎸囩ず浜嗕娇鐢ㄧ殑鍛戒护銆


杩欐槸MySQL鍙傝冩墜鍐岀殑缈昏瘧鐗堟湰锛屽叧浜嶮ySQL鍙傝冩墜鍐岋紝璇疯闂dev.mysql.com.銆傚師濮嬪弬鑰冩墜鍐屼负鑻辨枃鐗堬紝涓庤嫳鏂囩増鍙傝冩墜鍐岀浉姣旓紝鏈炕璇戠増鍙兘涓嶆槸鏈鏂扮殑銆