{"id":372,"date":"2013-06-01T17:14:54","date_gmt":"2013-06-01T09:14:54","guid":{"rendered":"http:\/\/www.royalwzy.com\/?p=372"},"modified":"2015-09-02T07:32:35","modified_gmt":"2015-09-01T23:32:35","slug":"mysql%e5%ad%a6%e4%b9%a02-linux%e4%b8%8b%e5%ae%89%e8%a3%85mysql5-5%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"http:\/\/www.royalwzy.com\/?p=372","title":{"rendered":"MySQL\u5b66\u4e602&#8211;Linux\u4e0b\u5b89\u88c5Mysql5.5\u6570\u636e\u5e93"},"content":{"rendered":"<div>Linux\u4e0b\u5b89\u88c5Mysql5.5\u6570\u636e\u5e93<\/div>\n<ol>\n<li>\u51c6\u5907\u5b89\u88c5\u5de5\u5177\n<ol>\n<li>cmake:\u4eceMysql5.5\u4ee5\u540e\u4f7f\u7528cmake\u7f16\u8bd1,\u53ef\u4ee5\u4ecewww.cmake.org\u4e0b\u8f7d\u6700\u65b0\u7248\u672c;<\/li>\n<li>GUN make:\u64cd\u4f5c\u7cfb\u7edf\u81ea\u5e26;<\/li>\n<li>gcc:\u64cd\u4f5c\u7cfb\u7edf\u81ea\u5e26;<\/li>\n<li>perl:\u64cd\u4f5c\u7cfb\u7edf\u81ea\u5e26;<\/li>\n<li>libncurses5-dev(ncurses-devel):\u8fd0\u884ccmake\u5fc5\u987b\u7684\u5305,\u5982\u679c\u6ca1\u6709\u5b89\u88c5\u4f1a\u62a5\u9519.<img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"file:\/\/\/C:\/TEMP\/enhtmlclip\/Image(234).png\" width=\"835\" height=\"107\" \/><\/li>\n<\/ol>\n<\/li>\n<li>\u5b89\u88c5cmake:\n<ol>\n<li>\u89e3\u538b\u538b\u7f29\u5305:&gt;tar -zxvf cmake-VERSION.tar.gz;<\/li>\n<li>\u8fdb\u5165\u5230cmake\u7684\u89e3\u538b\u7f29\u76ee\u5f55,\u6267\u884c.\/configure\u547d\u4ee4\u751f\u6210makefile;<\/li>\n<li>\u6267\u884c&gt;make;make install;\u547d\u4ee4\u751f\u6210\u5b89\u88c5\u8f6f\u4ef6\u5e76\u5b89\u88c5cmake;<\/li>\n<li>\u8f6f\u4ef6\u5b89\u88c5\u5230\u4e86\/usr\/local\/share\/cmake-2.8\/\u76ee\u5f55\u4e0b,\u6267\u884c\u6587\u4ef6\u5728\/usr\/local\/bin\u76ee\u5f55\u4e0b;<img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"file:\/\/\/C:\/TEMP\/enhtmlclip\/Image(235).png\" width=\"832\" height=\"199\" \/><\/li>\n<\/ol>\n<\/li>\n<li>\u5b89\u88c5ncurses-devel\u63d2\u4ef6\n<ol>\n<li>\u5728Debian\u548cUbuntu\u4e0a\u7684\u5305\u540d\u662flibncurses5-dev;<\/li>\n<li>\u5728RHEL\u548c\u5176\u5b83\u7248\u672c\u4e0a\u662fncurses-devel,\u6267\u884c&gt;rpm -ivh\u00a0ncurses-devel-VERSION.rpm\u5b89\u88c5;<img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"file:\/\/\/C:\/TEMP\/enhtmlclip\/Image(236).png\" width=\"830\" height=\"98\" \/><\/li>\n<li>\u5982\u679c\u4e0d\u5b89\u88c5\u4f1a\u51fa\u73b0\u4ee5\u4e0b\u9519\u8bef; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<img decoding=\"async\" alt=\"\" src=\"file:\/\/\/C:\/TEMP\/enhtmlclip\/Image(237).png\" \/><\/li>\n<\/ol>\n<\/li>\n<li><span style=\"color: #010101;\">\u521b\u5efa<\/span><span style=\"color: #010101; font-family: 'Courier New';\">mysql<\/span><span style=\"color: #010101;\">\u7528\u6237<\/span><span style=\"color: #010101; font-family: 'Courier New';\">:&gt;useradd mysql; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"file:\/\/\/C:\/TEMP\/enhtmlclip\/Image(238).png\" width=\"830\" height=\"43\" \/><\/li>\n<li>\u89e3\u538b\u7f29mysql5.5\u7684\u6e90\u7801\u5305:&gt;tar -zxvf mysql-VERSION.tar.gz;<\/li>\n<li>\u8fdb\u5165\u76ee\u5f55mysql-VERSION\u76ee\u5f55;<\/li>\n<li>\u6267\u884ccmake\u547d\u4ee4\u751f\u6210makefile(MyISAM,MERGE,MEMBER\u548cCSV\u56db\u79cd\u5f15\u64ce\u9ed8\u8ba4\u9759\u6001\u7f16\u8bd1);<img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"file:\/\/\/C:\/TEMP\/enhtmlclip\/Image(239).png\" width=\"831\" height=\"351\" \/><\/li>\n<li><span style=\"color: #010101;\">\u7f16\u8bd1\u6587\u4ef6<\/span><span style=\"color: #010101; font-family: 'Courier New';\">:&gt;make;make install;<\/span><span style=\"color: #010101;\">\u5728<\/span><span style=\"color: #010101; font-family: 'Courier New';\">mysql<\/span><span style=\"color: #010101;\">\u7684\u5b89\u88c5\u76ee\u5f55\u4e0b\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6,<\/span><span style=\"color: #010101;\">\u5e76\u81ea\u52a8\u521b\u5efa\u4e86data\u6587\u4ef6<\/span><span style=\"color: #e30000;\">(\u53ef\u4ee5\u624b\u52a8\u518d\u521b\u5efa\u4e00\u4e2alogs\u76ee\u5f55,\u7528\u6765\u5b58\u653e\u751f\u6210\u7684\u65e5\u5fd7\u6587\u4ef6,\u4e0e\u6570\u636e\u76ee\u5f55\u4e0d\u5728\u540c\u4e00\u5757\u78c1\u76d8\u4e0a,\u51cf\u5c0fI\/O\u5e76\u53d1)<\/span><span style=\"color: #010101;\">,\u4fee\u6539\u76ee\u5f55\u6743\u9650\u4e3a<\/span><span style=\"color: #010101; font-family: 'Courier New';\">mysql:&gt;chown mysql:mysql data; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<\/span><img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"file:\/\/\/C:\/TEMP\/enhtmlclip\/Image(240).png\" width=\"829\" height=\"368\" \/><\/li>\n<li><span style=\"color: #010101;\">\u62f7\u8d1d\u914d\u7f6e\u6587\u4ef6<\/span><span style=\"color: #010101; font-family: 'Courier New';\">:&gt;cp ..\/mysql-VERSION\/support-files\/my-medium.cnf .\/my.cnf \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"file:\/\/\/C:\/TEMP\/enhtmlclip\/Image(241).png\" width=\"828\" height=\"343\" \/><\/li>\n<li><span style=\"color: #010101;\">\u5728\u914d\u7f6e\u6587\u4ef6\u4e0b\u6dfb\u52a0\u76ee\u5f55\u914d\u7f6e<\/span><span style=\"color: #010101; font-family: 'Courier New';\">,<\/span><span style=\"color: #010101;\">\u6307\u5b9a\u6570\u636e\u6587\u4ef6\u7684\u4f4d\u7f6e: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"file:\/\/\/C:\/TEMP\/enhtmlclip\/Image(242).png\" width=\"830\" height=\"339\" \/><\/li>\n<li><span style=\"color: #010101;\">\u6570\u636e\u5e93\u7684\u521d\u59cb\u5316<\/span><span style=\"color: #010101; font-family: 'Courier New';\">,<\/span><span style=\"color: #010101;\">\u4e3b\u8981\u662f\u6570\u636e\u5e93\u7684\u521b\u5efa<\/span><span style=\"color: #010101; font-family: 'Courier New';\">,<\/span><span style=\"color: #010101;\">\u5e2e\u52a9\u6587\u4ef6\u7684\u586b\u5145<\/span><span style=\"color: #010101; font-family: 'Courier New';\">,<\/span><span style=\"color: #010101;\">\u7528\u6237\u6587\u4ef6\u7684\u586b\u5145<\/span><span style=\"color: #010101; font-family: 'Courier New';\">,<\/span><span style=\"color: #010101;\">\u6267\u884c<\/span><span style=\"color: #010101; font-family: 'Courier New';\">:&gt;.\/scripts\/mysql_install_db &#8211;defaults-file=.\/my.cnf &#8211;user=mysql<\/span><span style=\"color: #e30000; font-family: 'Courier New';\">(\u5728my.cnf\u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a0user\u53c2\u6570,\u5e76\u4e14\u62f7\u8d1d\u5230\/etc\u76ee\u5f55\u4e0b\u5c31\u4e0d\u7528\u518d\u52a0\u53c2\u6570,\u6267\u884c&gt;.\/scripts\/mysql_install_db\u5373\u53ef) \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"file:\/\/\/C:\/TEMP\/enhtmlclip\/Image(243).png\" width=\"828\" height=\"67\" \/><\/li>\n<li><span style=\"color: #010101;\">\u542f\u52a8\u670d\u52a1\u5668<\/span><span style=\"color: #010101; font-family: 'Courier New';\">:&gt;.bin\/mysqld_safe \u2013-user=mysql &amp;; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"file:\/\/\/C:\/TEMP\/enhtmlclip\/Image(244).png\" width=\"828\" height=\"310\" \/><\/li>\n<li><span style=\"color: #010101;\">\u4fee\u6539<\/span><span style=\"color: #010101; font-family: 'Courier New';\">MYSQL<\/span><span style=\"color: #010101;\">\u670d\u52a1\u5668<\/span><span style=\"color: #010101; font-family: 'Courier New';\">root<\/span><span style=\"color: #010101;\">\u7528\u6237\u7684\u5bc6\u7801<\/span><span style=\"color: #010101; font-family: 'Courier New';\">:&gt;.\/bin\/mysqladmin \u2013u root password &#8216;pwd&#8217;; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<\/span><img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"file:\/\/\/C:\/TEMP\/enhtmlclip\/Image(245).png\" width=\"829\" height=\"61\" \/><\/li>\n<li><span style=\"color: #010101;\">\u767b\u5f55<\/span><span style=\"color: #010101; font-family: 'Courier New';\">:<\/span>\n<ol>\n<li><span style=\"color: #010101;\">\u5982\u679c\u6ca1\u6709\u8bbe\u7f6e<\/span><span style=\"color: #010101; font-family: 'Courier New';\">root<\/span><span style=\"color: #010101;\">\u7684\u5bc6\u7801<\/span><span style=\"color: #010101; font-family: 'Courier New';\">,<\/span><span style=\"color: #010101;\">\u9ed8\u8ba4\u662f\u7a7a\u5bc6\u7801<\/span><span style=\"color: #010101; font-family: 'Courier New';\">,<\/span><span style=\"color: #010101;\">\u4f7f\u7528<\/span><span style=\"color: #010101; font-family: 'Courier New';\">&gt;.\/bin\/mysql<\/span><span style=\"color: #010101;\">\u5c31\u53ef\u4ee5\u767b\u5f55;<\/span><\/li>\n<li><span style=\"color: #010101;\">\u5982\u679c\u8bbe\u7f6e\u4e86<\/span><span style=\"color: #010101; font-family: 'Courier New';\">root<\/span><span style=\"color: #010101;\">\u5bc6\u7801<\/span><span style=\"color: #010101; font-family: 'Courier New';\">,<\/span><span style=\"color: #010101;\">\u5219\u767b\u5f55\u65f6\u8981\u6570\u636e\u5bc6\u7801\u9a8c\u8bc1<\/span><span style=\"color: #010101; font-family: 'Courier New';\">&gt;.\/bin\/mysql \u2013uroot -p;<\/span><\/li>\n<li><span style=\"color: #010101;\">\u8fdb\u5165\u6570\u636e\u5e93\u540e\u4fee\u6539\u7528\u6237\u5bc6\u7801:<\/span>update\u00a0user\u00a0set\u00a0password=PASSWORD(&#8216;123456&#8242;)\u00a0where\u00a0user=&#8217;root&#8217;;<img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"file:\/\/\/C:\/TEMP\/enhtmlclip\/Image(246).png\" width=\"831\" height=\"272\" \/><\/li>\n<\/ol>\n<\/li>\n<li>\u628amysql\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf:\n<ol>\n<li>\u6253\u5f00~root\/.bash_profile\u6587\u4ef6; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"file:\/\/\/C:\/TEMP\/enhtmlclip\/Image(247).png\" width=\"830\" height=\"34\" \/><\/li>\n<li>\u4fee\u6539\u73af\u5883\u53d8\u91cf:&gt;<span style=\"color: #e30000;\">PATH=\/usr\/local\/mysql\/bin:$PATH,<\/span>\u5c3d\u91cf\u628amysql\u7684bin\u76ee\u5f55\u653e\u5728PATH\u7684\u524d\u9762,\u4f7f\u7528mysql\u7684\u5de5\u5177\u7684\u65f6\u5019\u63d0\u9ad8\u4f18\u5148\u7ea7,\u5426\u5219\u53ef\u80fd\u4f1a\u4f7f\u7528\u7cfb\u7edf\u9884\u88c5\u7684mysql\u7684\u5de5\u5177,\u9020\u6210\u7248\u672c\u4e0d\u4e00\u81f4\u7684\u9519\u8bef,\u4e0b\u56fe\u4e0d\u51c6,\u4fee\u6539\u65f6\u6ce8\u610f\u5373\u53ef; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"file:\/\/\/C:\/TEMP\/enhtmlclip\/Image(248).png\" width=\"828\" height=\"215\" \/><\/li>\n<li>\u4f7f\u73af\u5883\u53d8\u91cf\u7acb\u5373\u751f\u6548:&gt;. .\/.bash_profile; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"file:\/\/\/C:\/TEMP\/enhtmlclip\/Image(249).png\" width=\"831\" height=\"28\" \/><\/li>\n<\/ol>\n<\/li>\n<li>\u628a\u914d\u7f6e\u6587\u4ef6\u653e\u5230\u9ed8\u8ba4\u8bfb\u53d6\u7684\u8def\u5f84,\u5e76\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u6307\u5b9a\u542f\u52a8\u7528\u6237\u4e3amysql,\u6dfb\u52a0\u5f00\u673a\u542f\u52a8:\n<ol>\n<li>\u62f7\u8d1d\u6587\u4ef6\u5230\u5f00\u673a\u542f\u52a8\u76ee\u5f55:cp \/usr\/local\/mysql\/support-files\/mysql.server \/etc\/rc.d\/init.d\/mysqld;<\/li>\n<li>\u6dfb\u52a0\u5f00\u673a\u542f\u52a8\u9879\uff1achkconfig &#8211;add mysqld;chkconfig mysqld on;<\/li>\n<li>\u542f\u52a8\/\u5173\u95edmysql\u670d\u52a1:service mysqld start\/stop;<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<div><\/div>\n<div>&#8212; \u7f16\u8bd1\u53c2\u6570;<\/div>\n<div>\/usr\/local\/bin\/cmake -DCMAKE_INSTALL_PREFIX=\/usr\/local\/mysql \\<br \/>\n-DDEFAULT_CHARSET=utf8 \\<br \/>\n-DDEFAULT_COLLATION=utf8_general_ci \\<br \/>\n-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \\<br \/>\n-DWITH_MYISAM_STORAGE_ENGINE=1 \\<br \/>\n-DWITH_INNOBASE_STORAGE_ENGINE=1 \\<\/div>\n<div><span style=\"color: #e30000;\">-DWITH_FEDERATED_STORAGE_ENGINE=1 \\<\/span><\/div>\n<div><span style=\"color: #e30000;\">-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \\<\/span><\/div>\n<div>-DWITH_ARCHIVE_STORAGE_ENGINE=1 \\<\/div>\n<div>-DWITH_READLINE=1 \\<br \/>\n-DENABLED_LOCAL_INFILE=1 \\<br \/>\n-DMYSQL_TCP_PORT=3306<\/div>\n<div><\/div>\n<div><span style=\"color: #8600a4;\">\u5982\u679c\u8981\u4f7f\u7528\u5176\u5b83\u5b57\u7b26\u96c6,\u8981\u5728\u5b89\u88c5\u5b8c\u6210\u540e\u6539\u53d8\u5b57\u7b26\u96c6:mysql&gt;set names &#8216;gb2312&#8217;;<\/span><\/div>\n<div align=\"left\"><span style=\"color: #8600a4;\">charset:gb2312 &#8212; collation:gb2312_chinese_cs<\/span><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Linux\u4e0b\u5b89\u88c5Mysql5.5\u6570\u636e\u5e93 \u51c6\u5907\u5b89\u88c5\u5de5\u5177 cmake:\u4eceMysql5.5\u4ee5\u540e\u4f7f\u7528cmake\u7f16\u8bd1,\u53ef [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[27],"class_list":["post-372","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-mysql"],"_links":{"self":[{"href":"http:\/\/www.royalwzy.com\/index.php?rest_route=\/wp\/v2\/posts\/372","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.royalwzy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.royalwzy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.royalwzy.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.royalwzy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=372"}],"version-history":[{"count":0,"href":"http:\/\/www.royalwzy.com\/index.php?rest_route=\/wp\/v2\/posts\/372\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.royalwzy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.royalwzy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=372"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.royalwzy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}