{"id":44,"date":"2010-08-14T15:40:53","date_gmt":"2010-08-14T07:40:53","guid":{"rendered":"http:\/\/blog.vscz.net\/?p=44"},"modified":"2014-07-28T00:13:02","modified_gmt":"2014-07-27T16:13:02","slug":"ubuntu-mysql-%e4%b8%8d%e8%83%bd%e8%bf%9c%e7%a8%8b%e8%bf%9e%e6%8e%a5%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/bylang.cn\/?p=44","title":{"rendered":"Ubuntu mysql \u4e0d\u80fd\u8fdc\u7a0b\u8fde\u63a5\u7684\u95ee\u9898"},"content":{"rendered":"<p>Ubuntu10.04\u4e0a\u81ea\u5e26\u7684MySQL\uff0c\u6267\u884c\u4e86<br \/>\napt-get install mysql<br \/>\n\u5b89\u88c5\u5b8cmysql-server<br \/>\n\u542f\u52a8mysql<br \/>\nstart<br \/>\n\u672c\u5730\u53ef\u4ee5\u8fde\u63a5\u8fdb\u5165\u6570\u636e\u5e93\u3002<br \/>\n-uroot -p<br \/>\n\u8bbe\u7f6e\u4e86\u8fdc\u7a0b\u8bbf\u95ee\u6743\u9650\uff1a<br \/>\nmysql> grant all PRIVILEGES on *.* to admin@&#8217;%&#8217; identified by &#8216;123456&#8217;;<br \/>\nQuery OK, 0 rows affected (0.04 sec)<br \/>\nmysql> use information_schema<br \/>\nmysql> select * from user_privileges;<br \/>\n\u67e5\u8be2\u5230\u6709\u4e0b\u9762\u7684\u7ed3\u679c\uff1a&#8217;admin&#8217;@&#8217;%&#8217;\uff0c\u8bf4\u660emysql\u5df2\u7ecf\u6388\u6743\u8fdc\u7a0b\u8fde\u63a5\u3002<br \/>\n\u5728windows\u4e0b\u8bbf\u95eeUbuntu\u7684\u6570\u636e\u5e93\uff0c\u8fde\u63a5\u4e0d\u4e0a\uff0c\u4f46\u662fUbuntu\u4e0a\u5b89\u88c5\u7684apache\u53ef\u4ee5\u8bbf\u95ee\u3002<br \/>\n\u7528iptalbes\u6dfb\u52a0\u7aef\u53e33306\u540e\u4e5f\u65e0\u6cd5\u8bbf\u95ee\u3002<br \/>\n:~# iptables -A INPUT -p tcp &#8211;dport 3306 -j ACCEPT<br \/>\nUbuntu\u4e0a\u67e5\u770bMysql\u7f51\u7edc\u8fde\u63a5\uff1a<br \/>\n:~# netstat -an |grep 3306<br \/>\ntcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN<br \/>\n\u672c\u5730\u7aef\u53e3\u4e5f\u5728\u76d1\u542c<br \/>\n:~# ufw status<br \/>\nFirewall not loaded<br \/>\n\u672c\u5730\u9632\u706b\u5899\u672a\u6253\u5f00<br \/>\n\u540e\u6765\u5728\u7f51\u4e0a\u627e\u5230\u4e00\u4e2a\u89e3\u51b3\u529e\u6cd5\uff1a<br \/>\n\u6253\u5f00 \/etc\/mysql\/my.cnf \u6587\u4ef6\uff0c\u627e\u5230 bind-address = 127.0.0.1 \u4fee\u6539\u4e3a bind-address = 0.0.0.0<br \/>\n\u91cd\u542fmysql : sudo \/etc\/init.d\/mysql restart<br \/>\n\u5c31\u597d\u4e86\uff0c\u6211\u5728windows\u4e0b\u5c31\u53ef\u4ee5\u8fde\u4e0a\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu10.04\u4e0a\u81ea\u5e26\u7684MySQL\uff0c\u6267\u884c\u4e86 apt-get install mysql \u5b89\u88c5\u5b8cmysql-server \u542f\u52a8mysql start \u672c\u5730\u53ef\u4ee5\u8fde\u63a5\u8fdb\u5165\u6570\u636e\u5e93\u3002 -uroot -p \u8bbe\u7f6e\u4e86\u8fdc\u7a0b\u8bbf\u95ee\u6743\u9650\uff1a mysql> grant all PRIVILEGES on *.* to admin@&#8217;%&#8217; identified by &#8216;123456&#8217;; Query OK, 0 rows affected (0.04 sec) mysql> use information_schema mysql> select * from user_privileges; \u67e5\u8be2\u5230\u6709\u4e0b\u9762\u7684\u7ed3\u679c\uff1a&#8217;admin&#8217;@&#8217;%&#8217;\uff0c\u8bf4\u660emysql\u5df2\u7ecf\u6388\u6743\u8fdc\u7a0b\u8fde\u63a5\u3002 \u5728windows\u4e0b\u8bbf\u95eeUbuntu\u7684\u6570\u636e\u5e93\uff0c\u8fde\u63a5\u4e0d\u4e0a\uff0c\u4f46\u662fUbuntu\u4e0a\u5b89\u88c5\u7684apache\u53ef\u4ee5\u8bbf\u95ee\u3002 \u7528iptalbes\u6dfb\u52a0\u7aef\u53e33306\u540e\u4e5f\u65e0\u6cd5\u8bbf\u95ee\u3002 :~# iptables -A INPUT -p tcp &#8211;dport 3306 -j ACCEPT Ubuntu\u4e0a\u67e5\u770bMysql\u7f51\u7edc\u8fde\u63a5\uff1a :~# netstat -an |grep [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,10],"tags":[],"class_list":["post-44","post","type-post","status-publish","format-standard","hentry","category-linux","category-mysql"],"_links":{"self":[{"href":"https:\/\/bylang.cn\/index.php?rest_route=\/wp\/v2\/posts\/44","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bylang.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bylang.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bylang.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bylang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=44"}],"version-history":[{"count":1,"href":"https:\/\/bylang.cn\/index.php?rest_route=\/wp\/v2\/posts\/44\/revisions"}],"predecessor-version":[{"id":45,"href":"https:\/\/bylang.cn\/index.php?rest_route=\/wp\/v2\/posts\/44\/revisions\/45"}],"wp:attachment":[{"href":"https:\/\/bylang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=44"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bylang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=44"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bylang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}