{"id":94,"date":"2014-06-24T07:35:06","date_gmt":"2014-06-24T07:35:06","guid":{"rendered":"http:\/\/ixyzero.com\/blog\/?p=94"},"modified":"2014-06-24T07:35:06","modified_gmt":"2014-06-24T07:35:06","slug":"linux%e4%b8%8b%e7%9a%84mysql%e5%af%86%e7%a0%81%e9%87%8d%e7%bd%ae%e8%84%9a%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/94.html","title":{"rendered":"Linux\u4e0b\u7684MySQL\u5bc6\u7801\u91cd\u7f6e\u811a\u672c"},"content":{"rendered":"<p>\u4e4b\u524d\u5728\u4f7f\u7528LNMP\u4e00\u952e\u5b89\u88c5\u5305\uff08\u5176\u4e2d\u7684\u6709\u4e9b\u9ed8\u8ba4\u914d\u7f6e\u8fd8\u662f\u4e0d\u591f\u5b89\u5168\u7684\uff0c\u6bd4\u5982php.ini\u4e2d\u7684\u4e00\u4e9b\u8bbe\u7f6e\uff09\u7684\u65f6\u5019\u770b\u5230\u4e86\u5176\u4e2d\u7684MySQL\u8bbe\u7f6e\u5bc6\u7801\u529f\u80fd\u7684\u811a\u672c\u7247\u65ad\uff0c\u89c9\u5f97\u5f88\u6709\u7528\uff0c\u5c31\u6458\u5f55\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:sh decode:true \">#!\/bin\/bash\nPATH=\/bin:\/sbin:\/usr\/bin:\/usr\/sbin:\/usr\/local\/bin:\/usr\/local\/sbin:~\/bin\nexport PATH\n\n# Check if user is root\nif [ $(id -u) != \"0\" ]; then\n    echo \"Error: You must be root to run this script, please use root to install lnmp\"\n    exit 1\nfi\n\n#set mysql root password\n\n\tmysqlrootpwd=\"root\"\n\techo \"Please input the root password of mysql:\"\n\tread -p \"(Default password: root):\" mysqlrootpwd\n\tif [ \"$mysqlrootpwd\" = \"\" ]; then\n\t\tmysqlrootpwd=\"root\"\n\tfi\n\techo \"===========================\"\n\techo \"mysqlrootpwd=$mysqlrootpwd\"\n\techo \"===========================\"\n\n\/etc\/init.d\/mysql start\n\/usr\/local\/mysql\/bin\/mysqladmin -u root password $mysqlrootpwd\n\ncat &gt; \/tmp\/mysql_sec_script&lt;&lt;EOF\nuse mysql;\nupdate user set password=password('$mysqlrootpwd') where user='root';\ndelete from user where not (user='root') ;\ndelete from user where user='root' and password='';\ndrop database test;\nDROP USER ''@'%';\nflush privileges;\nEOF\n\n\/usr\/local\/mysql\/bin\/mysql -u root -p$mysqlrootpwd -h localhost &lt; \/tmp\/mysql_sec_script<\/pre>\n<p>\u5176\u4e2d\u7684\u4e00\u4e9b\u4ee3\u7801\u7247\u6bb5\u5176\u5b9e\u90fd\u53ef\u4ee5\u72ec\u81ea\u6458\u5f55\u4e0b\u6765\u5355\u72ec\u4f7f\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e4b\u524d\u5728\u4f7f\u7528LNMP\u4e00\u952e\u5b89\u88c5\u5305\uff08\u5176\u4e2d\u7684\u6709\u4e9b\u9ed8\u8ba4\u914d\u7f6e\u8fd8\u662f\u4e0d\u591f\u5b89\u5168\u7684\uff0c\u6bd4\u5982php.ini\u4e2d\u7684\u4e00\u4e9b\u8bbe\u7f6e\uff09\u7684\u65f6\u5019\u770b\u5230\u4e86\u5176 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,7,12],"tags":[16,65],"class_list":["post-94","post","type-post","status-publish","format-standard","hentry","category-linux","category-programing","category-tools","tag-mysql","tag-shell"],"views":3073,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/94","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=94"}],"version-history":[{"count":0,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/94\/revisions"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=94"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=94"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=94"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}