{"id":3125,"date":"2018-02-04T09:50:44","date_gmt":"2018-02-04T01:50:44","guid":{"rendered":"http:\/\/cn.hostease.com\/xueyuan\/?p=3125"},"modified":"2018-02-04T09:50:44","modified_gmt":"2018-02-04T01:50:44","slug":"linux%e4%b8%8b%e5%bf%ab%e9%80%9f%e9%83%a8%e7%bd%b2mysql%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/xueyuan\/jishu\/fuwuqi\/linux%e4%b8%8b%e5%bf%ab%e9%80%9f%e9%83%a8%e7%bd%b2mysql%e6%95%b0%e6%8d%ae%e5%ba%93\/","title":{"rendered":"Linux\u4e0b\u5feb\u901f\u90e8\u7f72MySQL\u6570\u636e\u5e93"},"content":{"rendered":"<p><strong><\/strong><\/p>\n<h4>\u4e00.\u4e0b\u8f7d\u5bf9\u5e94\u7684\u8f6f\u4ef6\u7248\u672c<\/h4>\n<p><strong>\u4e0b\u8f7d\u5730\u5740\uff1a<a href=\"https:\/\/mirrors.sohu.com\/mysql\/MySQL-5.6\/\" target=\"_blank\">https:\/\/mirrors.sohu.com\/mysql\/MySQL-5.6\/<\/a><\/strong><\/p>\n<div class=\"linuxidc_code\">\n<pre>[root@localhost ~]# wget -q https:\/\/mirrors.sohu.com\/mysql\/MySQL-5.6\/sql-5.6.36-linux-glibc2.5-x86_64.tar.gz<\/pre>\n<\/div>\n<h4>\u4e8c\u3001\u89e3\u538b\u3001\u914d\u7f6e\u7528\u6237\u548c\u6743\u9650<\/h4>\n<div class=\"linuxidc_code\">\n<pre>[root@localhost ~]# mkdir -pv  \/Data\/apps\r\n[root@localhost ~]# tar xf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz -C \/Data\/apps\/\r\n[root@localhost ~]# cd \/Data\/apps\/\r\n[root@localhost apps]# mv mysql-5.6.36-linux-glibc2.5-x86_64\/ mysql-5.6.36\r\n[root@localhost ~]# useradd -s \/sbin\/nologin -M mysql\r\n[root@localhost ~]# chown -R mysql.mysql  \/Data\/apps\/mysql-5.6.36\r\n[root@localhost ~]# cd \/Data\/apps\/mysql-5.6.36<\/pre>\n<\/div>\n<h4>\u4e09\u3001\u521d\u59cb\u5316\u6570\u636e\u5e93<\/h4>\n<div class=\"linuxidc_code\">\n<pre>[root@localhost mysql-5.6.36]#  cp support-files\/my-default.cnf \/etc\/my.cnf \r\n[root@localhost mysql-5.6.36]# .\/scripts\/mysql_install_db --basedir=\/Data\/apps\/mysql-5.6.36\/ --datadir=\/Data\/apps\/mysql-5.6.36\/data\/ --user=mysql\r\n[root@localhost mysql-5.6.36]# cp support-files\/mysql.server \/etc\/init.d\/mysqld\r\n[root@localhost mysql-5.6.36]# chmod +x \/etc\/init.d\/mysqld\r\n[root@localhost mysql-5.6.36]# sed -i 's#\/usr\/local\/mysql#\/Data\/apps\/mysql-5.6.36#g' \/etc\/init.d\/mysqld #\u4e3b\u8981\u6700\u540e\u90fd\u6ca1\u6709'\/'\r\n[root@localhost mysql-5.6.36]# service mysqld start\r\nStarting MySQL.Logging to '\/Data\/apps\/mysql-5.6.36\/data\/localhost.localdomain.err'.\r\n..                                                         [\u786e\u5b9a]\r\n[root@localhost mysql-5.6.36]# netstat -tnlp\r\nActive Internet connections (only servers)\r\nProto Recv-Q Send-Q Local Address               Foreign Address             State       PID\/Program name   \r\ntcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      947\/sshd            \r\ntcp        0      0 :::22                       :::*                        LISTEN      947\/sshd            \r\ntcp        0      0 :::3306<\/pre>\n<\/div>\n<h4>\u56db\u3001\u914d\u7f6eMySQL\u73af\u5883\u53d8\u91cf<\/h4>\n<div class=\"linuxidc_code\">\n<p>[root@localhost mysql-5.6.36]# echo &#8220;export PATH=\/Data\/apps\/mysql-5.6.36\/bin:$PATH&#8221; &gt; \/etc\/profile.d\/mysql.sh<br \/>\n[root@localhost mysql-5.6.36]# . \/etc\/profile.d\/mysql.sh<\/p>\n<\/div>\n<h4>\u4e94\u3001\u6d4b\u8bd5\u767b\u5f55<\/h4>\n<div class=\"linuxidc_code\">\n<pre>root@localhost mysql-5.6.36]# mysql\r\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\r\nYour MySQL connection id is 2\r\nServer version: 5.6.36 MySQL Community Server (GPL)\r\n\r\nCopyright (c) 2000, 2017, <a title=\"Oracle\" href=\"https:\/\/www.linuxidc.com\/topicnews.aspx?tid=12\" target=\"_blank\">Oracle<\/a> and\/or its affiliates. All rights reserved.\r\n\r\nOracle is a registered trademark of Oracle Corporation and\/or its\r\naffiliates. Other names may be trademarks of their respective\r\nowners.\r\n\r\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\r\n\r\nmysql&gt; select version();\r\n+-----------+\r\n| version() |\r\n+-----------+\r\n| 5.6.36    |\r\n+-----------+\r\n1 row in set (0.05 sec)\r\n\r\nmysql&gt; show databases;\r\n+--------------------+\r\n| Database           |\r\n+--------------------+\r\n| information_schema |\r\n| mysql              |\r\n| performance_schema |\r\n| test               |\r\n+--------------------+\r\n4 rows in set (0.15 sec)<\/pre>\n<\/div>\n<h4>\u516d\u3001\u914d\u7f6e\u5b89\u5168\u7b56\u7565(\u5efa\u8bae)<\/h4>\n<div class=\"linuxidc_code\">\n<pre>[root@localhost mysql-5.6.36]# mysql_secure_installation \r\n\r\nNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL\r\n      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!\r\n\r\nIn order to log into MySQL to secure it, we'll need the current\r\npassword for the root user.  If you've just installed MySQL, and\r\nyou haven't set the root password yet, the password will be blank,\r\nso you should just press enter here.<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00.\u4e0b\u8f7d\u5bf9\u5e94\u7684\u8f6f\u4ef6\u7248\u672c \u4e0b\u8f7d\u5730\u5740\uff1ahttps:\/\/mirrors.sohu.com\/mysql\/MySQL-5 &#8230; <a title=\"Linux\u4e0b\u5feb\u901f\u90e8\u7f72MySQL\u6570\u636e\u5e93\" class=\"read-more\" href=\"https:\/\/cn.hostease.com\/xueyuan\/jishu\/fuwuqi\/linux%e4%b8%8b%e5%bf%ab%e9%80%9f%e9%83%a8%e7%bd%b2mysql%e6%95%b0%e6%8d%ae%e5%ba%93\/\" aria-label=\"\u9605\u8bfb Linux\u4e0b\u5feb\u901f\u90e8\u7f72MySQL\u6570\u636e\u5e93\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10,9],"tags":[],"class_list":["post-3125","post","type-post","status-publish","format-standard","hentry","category-shujuku","category-fuwuqi"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/3125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/comments?post=3125"}],"version-history":[{"count":1,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/3125\/revisions"}],"predecessor-version":[{"id":3126,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/3125\/revisions\/3126"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/media?parent=3125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/categories?post=3125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/tags?post=3125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}