{"id":108,"date":"2011-03-17T15:46:19","date_gmt":"2011-03-17T15:46:19","guid":{"rendered":"http:\/\/hgtas.com\/?p=108"},"modified":"2011-03-17T16:00:09","modified_gmt":"2011-03-17T16:00:09","slug":"related-commands-linux-mysql","status":"publish","type":"post","link":"https:\/\/508.me\/?p=108","title":{"rendered":"Linux\u4e0bMysql\u76f8\u5173\u547d\u4ee4"},"content":{"rendered":"<p>1\u3001\u5b89\u88c5<br \/>\n\u67e5\u770b\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u4e86MYSQL<br \/>\nrpm -qa mysql<br \/>\nmysql-4.1.7-4.RHEL4.1<br \/>\n\u70b9\u5f00add\/remove programe\u91cc\u9762\u7684mysql\u7684detail<br \/>\n\u52fe\u4e0amysql-server<br \/>\n2\u3001\u542f\u52a8<br \/>\n\u6765\u68c0\u6d4bmysql\u662f\u5426\u5df2\u7ecf\u542f\u52a8<br \/>\nservice mysqld status<br \/>\n\u6211\u4eec\u53ef\u4ee5\u7528\u4e09\u79cd\u65b9\u6cd5\u6765\u542f\u52a8Mysql\uff1a<br \/>\n\u65b9\u6cd5\u4e00\uff1a\u4f7f\u7528service\u547d\u4ee4\u6765<br \/>\n\u542f\u52a8Mysql<br \/>\nservice mysqld start<br \/>\n\u505c\u6b62mysql<br \/>\nservice mysqld stop<br \/>\n\u65b9\u6cd5\u4e8c\uff1a\u4f7f\u7528mysqld\u811a\u672c\u6765\u542f\u52a8Mysql\uff1a<br \/>\n\/etc\/init.d\/mysql start<br \/>\n\u65b9\u6cd5\u4e09\uff1a\u4f7f\u7528safe_mysqld\u5b9e\u7528\u7a0b\u5e8f\u542f\u52a8Mysql\u670d\u52a1\uff0c\u6b64\u65b9\u6cd5\u53ef\u4ee5\u4f7f\u7528\u76f8\u5173\u53c2\u6570<br \/>\nsafe_mysqld&amp; \/\/\u4f7f\u7528&amp;\u8868\u793a\u5c06safe_mysqld\u653e\u5728\u540e\u53f0\u6267\u884c\u3002<br \/>\n3\u3001\u767b\u9646<br \/>\n\u4fee\u6539\u5bc6\u7801<br \/>\nmysqladmin -u root password<br \/>\nmysqladmin -u root password &#8216;kaishi&#8217;<br \/>\n\u8fd9\u91cc\u7684\u201c\u5bc6\u7801\u201d\u4e3a\u6211\u4eec\u6b32\u65b0\u8bbe\u7684\u5bc6\u7801\u3002\u7cfb\u7edf\u4f1a\u63d0\u793a\u6211\u4eec\u8f93\u5165\u65e7\u5bc6\u7801\uff08\u82e5\u662fmysql\u521a\u5b89\u88c5\uff0c\u5219\u9ed8\u8ba4\u5bc6\u7801\u4e3a\u7a7a\uff09<br \/>\n\u672c\u673a\u53ef\u4ee5\u767b\u9646\u4e86\u3002\u4f46\u662f\u5176\u4ed6\u673a\u5668\u7684\u5ba2\u6237\u7aef\u767b\u9646\u62a5\u9519\u3002<br \/>\nERROR 1130 (00000): Host &#8216;xxx.xxx.xxx.xxx&#8217; is not allowed to connect to this MySQ<br \/>\nL server<br \/>\n\u9996\u5148\u67e5\u770b\u4e86iptables\u7684\u8bbe\u7f6e\uff0c\u6dfb\u52a0\u5f00\u653e\u4e863306\u7aef\u53e3<br \/>\niptables -A INPUT -p tcp -m tcp &#8211;sport 3306 -j ACCEPT<br \/>\niptables -A OUTPUT -p tcp -m tcp &#8211;dport 3306 -j ACCEPT<br \/>\nservice iptables save<br \/>\nservice iptables restart<br \/>\n\u8fd8\u662f\u5176\u4ed6\u673a\u5668\u4e0d\u80fd\u8bbf\u95ee\uff0c\u4f30\u8ba1\u662fMYSQL\u6743\u9650\u95ee\u9898\u3002<br \/>\n\u5728\u672c\u673a\u767b\u9646<br \/>\nmysql -h localhost -u root -pkaishi<br \/>\nshow databases;<br \/>\nuse mysql;<br \/>\nselect Host, User, Password from user;<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br \/>\n| Host | User | Password |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br \/>\n| localhost | root | *18F54215F48E644FC4E0F05EC2D39F88D7244B1A |<br \/>\n| localhost.localdomain | root | |<br \/>\n| localhost.localdomain | | |<br \/>\n| localhost | | |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br \/>\n\u53ef\u4ee5\u770b\u5230\u5982\u4e0a\u7ed3\u679c\uff0c\u53ea\u6709localhost\u624d\u8bbe\u7f6e\u4e86\u8bbf\u95ee\u7684\u6743\u9650<br \/>\n\u8fdb\u5165mysql\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7528\u6237user\uff1a<br \/>\n\u683c\u5f0f\uff1agrant \u6743\u9650 on \u6570\u636e\u5e93\u540d.\u8868\u540d \u7528\u6237@\u767b\u5f55\u4e3b\u673a identified by &#8220;\u7528\u6237\u5bc6\u7801&#8221;;<br \/>\ngrant select,update,insert,delete on easyview.* to sillycat@192.168.10.103 identified by &#8220;kaishi&#8221;;<br \/>\n\u67e5\u770b\u7ed3\u679c\uff0c\u6267\u884c\uff1a<br \/>\nuse mysql;<br \/>\nselect host,user,password from user;<br \/>\n\u53ef\u4ee5\u770b\u5230\u5728user\u8868\u4e2d\u5df2\u6709\u521a\u624d\u521b\u5efa\u7684user\u7528\u6237\u3002host\u5b57\u6bb5\u8868\u793a\u767b\u5f55\u7684\u4e3b\u673a\uff0c\u5176\u503c\u53ef\u4ee5\u7528IP\uff0c\u4e5f\u53ef\u7528\u4e3b\u673a\u540d\uff0c\u5c06host\u5b57\u6bb5\u7684\u503c\u6539\u4e3a%\u5c31\u8868\u793a\u5728\u4efb\u4f55\u5ba2\u6237\u7aef\u673a\u5668\u4e0a\u80fd\u4ee5user\u7528\u6237\u767b\u5f55\u5230mysql\u670d\u52a1\u5668\uff0c\u5efa\u8bae\u5728\u5f00\u53d1\u65f6\u8bbe\u4e3a%\u3002<br \/>\nupdate user set host = &#8216;%&#8217; where user = &#8216;sillycat&#8217;;<br \/>\nflush privileges;<br \/>\n\u4fee\u6539\u4e86\u6743\u9650\u540e\u9700\u8981\u6267\u884c\u4ee5\u4e0a\u8bed\u53e5\u751f\u6548<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u5b89\u88c5 \u67e5\u770b\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u4e86MYSQL rpm -qa mysql mysql-4.1.7-4.RHEL4.1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17],"tags":[22,57],"_links":{"self":[{"href":"https:\/\/508.me\/index.php?rest_route=\/wp\/v2\/posts\/108"}],"collection":[{"href":"https:\/\/508.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/508.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/508.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/508.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=108"}],"version-history":[{"count":4,"href":"https:\/\/508.me\/index.php?rest_route=\/wp\/v2\/posts\/108\/revisions"}],"predecessor-version":[{"id":112,"href":"https:\/\/508.me\/index.php?rest_route=\/wp\/v2\/posts\/108\/revisions\/112"}],"wp:attachment":[{"href":"https:\/\/508.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/508.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/508.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}