{"id":654,"date":"2012-11-06T13:36:15","date_gmt":"2012-11-06T05:36:15","guid":{"rendered":"http:\/\/hesiway.tk\/?p=654"},"modified":"2012-11-06T13:36:15","modified_gmt":"2012-11-06T05:36:15","slug":"linux%e4%b8%8bmysql%e5%ae%89%e8%a3%85%e3%80%81%e7%9b%ae%e5%bd%95%e7%bb%93%e6%9e%84%e3%80%81%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"http:\/\/hesiwei.cn\/?p=654","title":{"rendered":"linux\u4e0bmysql\u5b89\u88c5\u3001\u76ee\u5f55\u7ed3\u6784\u3001\u914d\u7f6e"},"content":{"rendered":"<p>1\u3001\u51c6\u5907\u5b89\u88c5\u7a0b\u5e8f(\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d)<\/p>\n<p>\u670d\u52a1\u7aef\uff1aMySQL-server-community-5.1.44-1.rhel4.i386.rpm<\/p>\n<p>\u5ba2\u6237\u7aef\uff1aMySQL-client-community-5.1.44-1.rhel4.i386.rpm<\/p>\n<p>2\u3001\u5b89\u88c5(\u6253\u5370\u4fe1\u606f\u7565)<\/p>\n<p><!--more--><\/p>\n<div>\n<div>[root@localhost\u00a0\/]#rpm\u00a0-ivh\u00a0MySQL-server-community-5.1.44-1.rhel4.i386.rpm;<\/div>\n<div>[root@localhost\u00a0\/]#rpm\u00a0-ivh\u00a0MySQL-client-community-5.1.44-1.rhel4.i386.rpm;<\/div>\n<\/div>\n<p>3\u3001\u67e5\u770b\u5b89\u88c5\u662f\u5426\u6210\u529f<\/p>\n<div>\n<div>[root@localhost\u00a0\/]#netstat\u00a0-ntpl;<\/div>\n<\/div>\n<p>\u663e\u793a3306\u7aef\u53e3\u5f00\u653e\u8868\u793a\u670d\u52a1\u5b89\u88c5\u6210\u529f<\/p>\n<p>4\u3001\u6d4b\u8bd5\u8fde\u63a5<\/p>\n<p>\uff08*\u4fee\u6539root\u5bc6\u7801\uff09<\/p>\n<p>&nbsp;<\/p>\n<div>\n<div>\n<p>[root@localhost\u00a0\/]#\/usr\/bin\/mysqladmin\u00a0-u\u00a0root\u00a0password\u00a0&#8216;xxxxxx&#8217;;<\/p>\n<p>[root@localhost\u00a0\/]#mysql\u00a0-u\u00a0root\u00a0-pEnter\u00a0password:xxxxxx<\/p>\n<\/div>\n<\/div>\n<p>\u51fa\u73b0mysql&gt;\u8868\u793a\u767b\u9646\u6210\u529f!<\/p>\n<p>5\u3001\u5bf9mysql\u7528\u6237\u8bbe\u7f6e\u8fdc\u7a0b\u8bbf\u95ee\u6743\u9650<\/p>\n<p>\u65b9\u6cd51\u3001\u6539\u8868\u6cd5\uff1a\u767b\u9646mysql\u540e\uff0c\u66f4\u6539\u201cmysql\u201d\u6570\u636e\u5e93\u91cc\u7684\u201cuser\u201d\u8868\u91cc\u7684\u201chost\u201d\u9879\uff0c\u5c06\u201clocalhost\u201d\u6539\u201c%\u201d<\/p>\n<p>&nbsp;<\/p>\n<div>\n<div><\/div>\n<div>\n<p>mysql&gt;use\u00a0mysql;mysql&gt;update\u00a0user\u00a0set\u00a0host\u00a0=&#8217;%&#8217;\u00a0where\u00a0user\u00a0=&#8217;root&#8217;;<\/p>\n<p>mysql&gt;select\u00a0host,user\u00a0from\u00a0user;<\/p>\n<p>mysql&gt;FLUSH\u00a0PRIVILEGES<\/p>\n<\/div>\n<div><\/div>\n<\/div>\n<p>\u65b9\u6cd52\u3001\u6388\u6743\u6cd5\uff1a\u5047\u8bbe\u5141\u8bb8\u7528\u6237username\u901a\u8fc7\u5bc6\u7801password\u4ece\u8fdc\u7a0b\u8fde\u63a5\u5230mysql\u670d\u52a1\u5668<\/p>\n<p>&nbsp;<\/p>\n<div>\n<div>mysql&gt;GRANT\u00a0ALL\u00a0RRIVILEGES\u00a0ON\u00a0*.*\u00a0TO\u00a0username@&#8217;%&#8217;\u00a0IDENTIFIED\u00a0BY\u00a0&#8216;password&#8217;\u00a0WITH\u00a0GRANT\u00a0OPTION;<\/div>\n<div>mysql&gt;FLUSH\u00a0PRIVILEGES;<\/div>\n<\/div>\n<p>6\u3001\u5b89\u88c5\u76ee\u5f55\u7ed3\u6784<\/p>\n<p>\u6570\u636e\u5e93\u76ee\u5f55\uff1a\/var\/lib\/mysql\/<\/p>\n<p>\u914d\u7f6e\u6587\u4ef6\uff1a\/usr\/share\/mysql(mysql.server\u547d\u4ee4\u53ca\u914d\u7f6e\u6587\u4ef6)<\/p>\n<p>\u76f8\u5173\u547d\u4ee4\uff1a\/usr\/bin(mysqladmin\u3001mysqldump\u7b49\u547d\u4ee4)(*mysql\u7684\u4e00\u79cd\u5b89\u5168\u542f\u52a8\u65b9\u5f0f\uff1a\/usr\/bin\/mysqld_safe\u00a0 &#8211;user=root &amp;)<\/p>\n<p>\u542f\u52a8\u811a\u672c\uff1a\/etc\/rc.d\/init.d\/<\/p>\n<p>7\u3001\u505c\u6b62\/\u542f\u52a8mysql\u670d\u52a1<\/p>\n<p>&nbsp;<\/p>\n<div>\n<div>[root@localhost\u00a0\/]#service\u00a0mysql\u00a0stop;<\/div>\n<div>[root@localhost\u00a0\/]#service\u00a0mysql\u00a0start;<\/div>\n<\/div>\n<p>8\u3001\u4fee\u6539\u5b57\u7b26\u7f16\u7801<\/p>\n<p>\u67e5\u770b\u5b57\u7b26\u7f16\u7801:<\/p>\n<p>&nbsp;<\/p>\n<div>\n<div>[root@localhost\u00a0\/]#show\u00a0variables\u00a0like\u00a0&#8216;character\\_set\\_%&#8217;;<\/div>\n<div>[root@localhost\u00a0\/]#show\u00a0variables\u00a0like\u00a0&#8216;collation_%&#8217;;<\/div>\n<\/div>\n<p>\u505c\u6b62mysql\u670d\u52a1<\/p>\n<p>\u5c06\u76ee\u5f55\/usr\/share\/mysql\u4e0b\u7684\u6587\u4ef6my-medium.cnf\u62f7\u8d1d\u5230\/etc\/\u4e0b\u5e76\u6539\u540d\u4e3amy.cnf<\/p>\n<p>\u6253\u5f00my.cnf\u5728[client]\u548c[mysqld]\u4e0b\u9762\u5747\u52a0\u4e0adefault-character-set=utf8,\u5e76\u4fdd\u5b58<\/p>\n<p>*mysql5.5 \u6539\u4e86\u5b57\u7b26\u96c6\u8bbe\u7f6e\u53c2\u6570\u00a0character-set-server=utf8<\/p>\n<p>\u91cd\u542fmysql\u670d\u52a1<\/p>\n<p>9\u3001\u5378\u8f7dmysql<\/p>\n<div>\n<div>[root@localhost\u00a0\/]#rpm\u00a0-qa|grep\u00a0-i\u00a0mysql<\/div>\n<\/div>\n<p>\u663e\u793a\uff1a<\/p>\n<p>&nbsp;<\/p>\n<div>\n<div><\/div>\n<div>\n<p>MySQL-server-community-5.1.44-1.rhel4.i386.rpmMySQL-client-community-5.1.44-1.rhel4.i386.rpm<\/p>\n<p>[root@localhost\u00a0\/]#rpm\u00a0-e\u00a0\u00a0MySQL-server-community-5.1.44-1.rhel4.i386.rpm<\/p>\n<p>[root@localhost\u00a0\/]#rpm\u00a0-e\u00a0MySQL-client-community-5.1.44-1.rhel4.i386.rpm<\/p>\n<\/div>\n<div><\/div>\n<\/div>\n<p>\u5220\u9664\u6b8b\u4f59\u6587\u4ef6<\/p>\n<p>&nbsp;<\/p>\n<div>\n<div>[root@localhost\u00a0\/]#rm\u00a0-f\u00a0\/etc\/my.cnf<\/div>\n<div>[root@localhost\u00a0\/]#rm\u00a0-f\u00a0\/var\/lib\/mysql<\/div>\n<\/div>\n<p>10\u3001\u590d\u5236mysql\u6570\u636e\u5e93<\/p>\n<p>\u6e90\u6570\u636e\u5e93\u540d\uff1asource_db\u00a0\u00a0 \u7528\u6237\u540d\uff1aroot\u00a0\u5bc6\u7801\uff1axxxxxx<\/p>\n<p>\u76ee\u6807\u6570\u636e\u5e93\u540d\uff1atarget_db\u00a0\u00a0 \u7528\u6237\u540d\uff1aroot\u00a0\u5bc6\u7801\uff1axxxxxx\u00a0\u6240\u5728\u4e3b\u673a\uff1a221.218.9.41<\/p>\n<div>\n<div>shell&gt;mysqldump\u00a0source_db\u00a0-uroot\u00a0-pxxxxxx\u00a0&#8211;opt\u00a0|\u00a0mysql\u00a0target_db\u00a0-uroot\u00a0-pxxxxxx\u00a0-h\u00a0221.218.9.41<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u51c6\u5907\u5b89\u88c5\u7a0b\u5e8f(\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d) \u670d\u52a1\u7aef\uff1aMySQL-server-community-5.1.44-1.rh [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,19],"tags":[],"class_list":["post-654","post","type-post","status-publish","format-standard","hentry","category-linux","category-sql"],"_links":{"self":[{"href":"http:\/\/hesiwei.cn\/index.php?rest_route=\/wp\/v2\/posts\/654","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/hesiwei.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/hesiwei.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/hesiwei.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/hesiwei.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=654"}],"version-history":[{"count":0,"href":"http:\/\/hesiwei.cn\/index.php?rest_route=\/wp\/v2\/posts\/654\/revisions"}],"wp:attachment":[{"href":"http:\/\/hesiwei.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=654"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/hesiwei.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=654"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/hesiwei.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=654"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}