{"id":28,"date":"2018-06-01T16:37:08","date_gmt":"2018-06-01T08:37:08","guid":{"rendered":"http:\/\/www.luyouli.com\/?p=28"},"modified":"2018-06-09T19:05:44","modified_gmt":"2018-06-09T11:05:44","slug":"centos7-%e7%bc%96%e8%af%91%e5%ae%89%e8%a3%85mysql-8-0-11-%e5%88%9b%e5%bb%ba%e7%94%a8%e6%88%b7","status":"publish","type":"post","link":"https:\/\/www.luyouli.com\/?p=28","title":{"rendered":"Centos7 \u7f16\u8bd1\u5b89\u88c5mysql 8.0.11 \u53ca\u5904\u7406\u521b\u5efa\u7528\u6237\u7684\u95ee\u9898"},"content":{"rendered":"<div>\u521b\u5efamysql\u7528\u6237<\/div>\n<p><!--more--><\/p>\n<div># useradd mysql -s \/sbin\/nologin<\/div>\n<div><\/div>\n<div>\u521b\u5efa\u7a0b\u5e8f\u76ee\u5f55\u3001\u6570\u636e\u76ee\u5f55\u3001\u65e5\u5fd7\u76ee\u5f55\u548cboost\u76ee\u5f55<\/div>\n<div># mkdir -p \/server\/mysql<\/div>\n<div># mkdir -p \/server\/data<\/div>\n<div># mkdir -p \/server\/logs\/mysql<\/div>\n<div># mkdir -p \/server\/boost<\/div>\n<div><\/div>\n<div>\u66f4\u6539\u76ee\u5f55\u6743\u9650<\/div>\n<div># chown -R mysql:mysql \/server\/data\/<\/div>\n<div># chown -R mysql:mysql \/server\/logs\/mysql<\/div>\n<div><\/div>\n<div>\u4e0b\u8f7d mysql 8.0.11 \u7684\u6e90\u7801<\/div>\n<div># wget <a href=\"https:\/\/cdn.mysql.com\/\/Downloads\/MySQL-8.0\/mysql-boost-8.0.11.tar.gz\">https:\/\/cdn.mysql.com\/\/Downloads\/MySQL-8.0\/mysql-boost-8.0.11.tar.gz<\/a><\/div>\n<div><\/div>\n<div>\u5b89\u88c5\u57fa\u7840\u73af\u5883<\/div>\n<div># yum -y install make gcc-c++ cmake bison-devel ncurses-devel bison perl perl-devel perl perl-devel openssl-devel<\/div>\n<div><\/div>\n<div>\u7f16\u8bd1\u5b89\u88c5<\/div>\n<div># tar zxvf mysql-boost-8.0.11.tar.gz<\/div>\n<div># cmake -DCMAKE_INSTALL_PREFIX=\/server\/mysql -DMYSQL_UNIX_ADDR=\/server\/mysql\/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=\/server\/data -DMYSQL_TCP_PORT=3306 -DWITH_BOOST=\/server\/boost -DDOWNLOAD_BOOST=1<\/div>\n<div># make &amp;&amp; make install<\/div>\n<div><\/div>\n<div>\u66f4\u6539my.cnf\u914d\u7f6e<\/div>\n<div># vim \/etc\/my.cnf<\/div>\n<div>[client]<\/div>\n<div>port = 3306<\/div>\n<div>socket = \/server\/data\/mysql.sock<\/div>\n<div>[mysqld]<\/div>\n<div>mysqlx-port=33060\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0# \u7279\u522b\u6ce8\u610f\uff1a8.0\u9ed8\u8ba4\u589e\u52a0\u4e86X plugin<\/div>\n<div>mysqlx-socket=\/server\/data\/mysqlx.sock<\/div>\n<div>port=3306<\/div>\n<div>socket=\/server\/data\/mysql.sock<\/div>\n<div>basedir=\/server\/mysql<\/div>\n<div>datadir=\/server\/data<\/div>\n<div>pid-file=\/server\/data\/mysql.pid<\/div>\n<div>lower_case_table_names=1<\/div>\n<div>max_connections=400<\/div>\n<div>max_connect_errors=100<\/div>\n<div>max_allowed_packet = 128M<\/div>\n<div>wait-timeout = 10<\/div>\n<div>interactive-timeout = 20<\/div>\n<div>character_set_server=utf8<\/div>\n<div>server-id=1<\/div>\n<div>log_error=\/server\/logs\/mysql\/mysql.log.error<\/div>\n<div>slow_query_log=1<\/div>\n<div>slow_query_log_file=\/server\/logs\/mysql\/mysql.log.slow<\/div>\n<div>long_query_time=1<\/div>\n<div>log-bin=master-bin<\/div>\n<div>binlog_format=mixed<\/div>\n<div>general_log=ON<\/div>\n<div>general_log_file=\/server\/logs\/mysql\/mysql.log<\/div>\n<div>log_timestamps = system<\/div>\n<div>[mysqldump]<\/div>\n<div>quick<\/div>\n<div>max_allowed_packet = 16M<\/div>\n<div>[mysql]<\/div>\n<div>no-auto-rehash<\/div>\n<div>local-infile = 1<\/div>\n<div><\/div>\n<div>\u521d\u59cb\u5316\u6570\u636e\u5e93<\/div>\n<div># \/server\/mysql\/bin\/mysqld &#8211;initialize-insecure &#8211;user=mysql &#8211;basedir=\/server\/mysql &#8211;datadir=\/server\/data<\/div>\n<div><\/div>\n<div>\u8bbe\u7f6eroot\u5bc6\u7801<\/div>\n<div># \/server\/mysql\/bin\/mysql -uroot -p<\/div>\n<div>mysql&gt; show databases;<\/div>\n<div>\n<div><img decoding=\"async\" src=\"C:\/software\/YoudaoNote\/YDdata\/kerneler527@163.com\/1738c10c7471422c9c0c1c3f7add4dc7\/clipboard.png\" alt=\"\" data-media-type=\"image\" data-attr-org-src-id=\"84D278324F7745E794DBDCDF87BDDF16\" \/><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-31\" src=\"http:\/\/www.luyouli.com\/wp-content\/uploads\/2018\/05\/1.png\" alt=\"\" width=\"234\" height=\"186\" \/><\/div>\n<\/div>\n<div>\u53d1\u73b0\u53ea\u6709\u4e09\u4e2a\u5e93\uff0c\u611f\u89c9\u6709\u95ee\u9898<\/div>\n<div>mysql&gt; use mysql;<\/div>\n<div>Database changed<\/div>\n<div>mysql&gt; show tables;<\/div>\n<div>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<\/div>\n<div>| Tables_in_mysql |<\/div>\n<div>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<\/div>\n<div>| innodb_index_stats |<\/div>\n<div>| innodb_table_stats |<\/div>\n<div>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<\/div>\n<div>\u53ea\u6709\u4e24\u4e2a\u8868\uff0c\u95ee\u9898\u5927\u5927\u7684\u6709<\/div>\n<div>mysql&gt; SELECT DISTINCT CONCAT(&#8216;User: &#8221;&#8217;,user,&#8221;&#8217;@&#8221;&#8217;,host,&#8221;&#8217;;&#8217;) AS query FROM mysql.user;<\/div>\n<div>ERROR 2006 (HY000): MySQL server has gone away<\/div>\n<div>No connection. Trying to reconnect&#8230;<\/div>\n<div>Connection id: 10<\/div>\n<div>Current database: mysql<\/div>\n<div>ERROR 1146 (42S02): Table &#8216;mysql.user&#8217; doesn&#8217;t exist<\/div>\n<div>\u5404\u79cd\u64cd\u4f5c\u4e4b\u540e\u53d1\u73b0\u662f\u8868\u4e0d\u5168\u7684\u95ee\u9898\uff0c\u67e5\u770bmysql\u9519\u8bef\u65e5\u5fd7\uff0c\u91cc\u9762\u8981\u6c42<\/div>\n<div><img decoding=\"async\" src=\"C:\/software\/YoudaoNote\/YDdata\/kerneler527@163.com\/fabda359aad3445b963fd29b706fbbb7\/clipboard.png\" alt=\"\" data-media-type=\"image\" data-attr-org-src-id=\"0AB88447CEAF4E29B31021F39BCDBDC0\" \/><\/div>\n<div>[ERROR] [MY-010735] [Server] Can&#8217;t open the mysql.plugin table. Please run mysql_upgrade to create it.<\/div>\n<div>[ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we&#8217;re sending the information to the error-log instead: MY-001146 &#8211; Table &#8216;mysql.component&#8217; doesn&#8217;t exist<\/div>\n<div>[ERROR] [MY-010326] [Server] Fatal error: Can&#8217;t open and lock privilege tables: Table &#8216;mysql.user&#8217; doesn&#8217;t exist<\/div>\n<div>[ERROR] [MY-010353] [Server] Can&#8217;t open and lock privilege tables: Table &#8216;mysql.servers&#8217; doesn&#8217;t exist<\/div>\n<div>[ERROR] [MY-010422] [Repl] Error in checking mysql.slave_master_info repository info type of TABLE.<\/div>\n<div>[ERROR] [MY-010415] [Repl] Error creating master info: Error checking repositories.<\/div>\n<div>[ERROR] [MY-010426] [Repl] Slave: Failed to initialize the master info structure for channel &#8221;; its record may still be present in &#8216;mysql.slave_master_info&#8217; table, consider deleting it.<\/div>\n<div><\/div>\n<div>\u6309\u7167\u8981\u6c42\u6267\u884c\u4e86 mysql_upgrade \u6ca1\u6709\u4f5c\u7528<\/div>\n<div><\/div>\n<div>\u6700\u540e\u51b3\u5b9a\uff0c\u5220\u9664\u6570\u636e\u91cd\u65b0\u751f\u6210\u6570\u636e<\/div>\n<div># rm -rf \/server\/data\/*<\/div>\n<div># \/server\/mysql\/bin\/mysqld &#8211;initialize-insecure &#8211;user=mysql &#8211;basedir=\/server\/mysql &#8211;datadir=\/server\/data<\/div>\n<div># \u518d\u6b21\u767b\u9646<\/div>\n<div>mysql&gt; show databases;<\/div>\n<div><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-33\" src=\"http:\/\/www.luyouli.com\/wp-content\/uploads\/2018\/05\/2.png\" alt=\"\" width=\"224\" height=\"205\" \/><\/div>\n<div>mysql&gt; use mysql;<\/div>\n<div>Database changed<\/div>\n<div>mysql&gt; show tables;<\/div>\n<div>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<\/div>\n<div>| Tables_in_mysql |<\/div>\n<div>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<\/div>\n<div>| columns_priv |<\/div>\n<div>| component |<\/div>\n<div>| db |<\/div>\n<div>| default_roles |<\/div>\n<div>| engine_cost |<\/div>\n<div>| func |<\/div>\n<div>| general_log |<\/div>\n<div>| global_grants |<\/div>\n<div>| gtid_executed |<\/div>\n<div>| help_category |<\/div>\n<div>| help_keyword |<\/div>\n<div>| help_relation |<\/div>\n<div>| help_topic |<\/div>\n<div>| innodb_index_stats |<\/div>\n<div>| innodb_table_stats |<\/div>\n<div>| password_history |<\/div>\n<div>| plugin |<\/div>\n<div>| procs_priv |<\/div>\n<div>| proxies_priv |<\/div>\n<div>| role_edges |<\/div>\n<div>| server_cost |<\/div>\n<div>| servers |<\/div>\n<div>| slave_master_info |<\/div>\n<div>| slave_relay_log_info |<\/div>\n<div>| slave_worker_info |<\/div>\n<div>| slow_log |<\/div>\n<div>| tables_priv |<\/div>\n<div>| time_zone |<\/div>\n<div>| time_zone_leap_second |<\/div>\n<div>| time_zone_name |<\/div>\n<div>| time_zone_transition |<\/div>\n<div>| time_zone_transition_type |<\/div>\n<div>| user |<\/div>\n<div>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<\/div>\n<div>33 rows in set (0.00 sec)<\/div>\n<div><img decoding=\"async\" src=\"C:\/software\/YoudaoNote\/YDdata\/kerneler527@163.com\/8706bc6beff442b79d15085f03d78f42\/clipboard.png\" alt=\"\" data-media-type=\"image\" data-attr-org-src-id=\"1715A31C298F4321BA333D2AEC86B91E\" \/><\/div>\n<div>\u8fd9\u4e0bmysql\u6b63\u5e38\u4e86<\/div>\n<div><\/div>\n<div>mysql&gt; ALTER USER &#8216;root&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;newpassword&#8217;;<\/div>\n<div>mysql&gt; flush privileges;<\/div>\n<div>\u65b0\u5bc6\u7801\u8bbe\u7f6e\u5b8c\u6bd5<\/div>\n<div><\/div>\n<div>\u8bbe\u7f6e\u542f\u52a8\u811a\u672c<\/div>\n<div># vim \/lib\/systemd\/system\/mysql.service<\/div>\n<div>[Unit]<\/div>\n<div>Description=MySQL Server<\/div>\n<div>Documentation=man:mysqld(8)<\/div>\n<div>Documentation=http:\/\/dev.mysql.com\/doc\/refman\/en\/using-systemd.html<\/div>\n<div>After=network.target<\/div>\n<div>After=syslog.target<\/div>\n<div><\/div>\n<div>[Install]<\/div>\n<div>WantedBy=multi-user.target<\/div>\n<div><\/div>\n<div>[Service]<\/div>\n<div>User=mysql<\/div>\n<div>Group=mysql<\/div>\n<div>Type=simple<\/div>\n<div><\/div>\n<div>ExecStart=\/server\/mysql\/bin\/mysqld_safe &#8211;defaults-file=\/etc\/my.cnf &#8211;basedir=\/server\/mysql &#8211;datadir=\/server\/data\/mysql<\/div>\n<div>LimitNOFILE = 5000<\/div>\n<div><\/div>\n<div>\u521b\u5efa\u7528\u6237aaa<\/div>\n<div>mysql&gt; GRANT SELECT, INSERT, UPDATE, DELETE ON aaa.* TO aaa@localhost IDENTIFIED BY &#8216;aaaaaaaaaaaaa&#8217;;<\/div>\n<div>ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &#8216;IDENTIFIED BY &#8216;aaaaaaaaaaaaa&#8221; at line 1<\/div>\n<div>\u62a5\u9519\u662f\u56e0\u4e3amyslq 8.0\u4e0d\u518d\u652f\u6301grant\u76f4\u63a5\u521b\u5efa\u7528\u6237\uff0c\u6539\u6210\u9700\u8981\u5148\u521b\u5efa\u7528\u6237\u518d\u6388\u6743<\/div>\n<div><\/div>\n<div>mysql&gt; create user aaa@localhost IDENTIFIED BY &#8216;aaaaaaaaaaaaa&#8217;;<\/div>\n<div>mysql&gt; flush privileges;<\/div>\n<div>mysql&gt; GRANT SELECT, INSERT, UPDATE, DELETE ON aaa.* TO aaa@localhost;<\/div>\n<div>\u4e0b\u8ff0\u8bed\u53e5\u7684\u610f\u601d\u662faaa\u53ef\u4ee5\u628a\u6743\u9650\u7ed9\u522b\u7684\u7528\u6237<\/div>\n<div>mysql&gt; GRANT SELECT, INSERT, UPDATE, DELETE ON aaa.* TO aaa@localhost with grant option;<\/div>\n<div>mysql&gt; flush privileges;<\/div>\n<div><\/div>\n<div>\u8fd9\u6837\u5c31\u5b8c\u6210mysql 8.0.11\u7684\u5b89\u88c5\u53ca\u521b\u5efa\u7528\u6237<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u521b\u5efamysql\u7528\u6237<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-28","post","type-post","status-publish","format-standard","hentry","category-mysql"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"views":19242,"_links":{"self":[{"href":"https:\/\/www.luyouli.com\/index.php?rest_route=\/wp\/v2\/posts\/28","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.luyouli.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.luyouli.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.luyouli.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.luyouli.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=28"}],"version-history":[{"count":5,"href":"https:\/\/www.luyouli.com\/index.php?rest_route=\/wp\/v2\/posts\/28\/revisions"}],"predecessor-version":[{"id":45,"href":"https:\/\/www.luyouli.com\/index.php?rest_route=\/wp\/v2\/posts\/28\/revisions\/45"}],"wp:attachment":[{"href":"https:\/\/www.luyouli.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=28"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.luyouli.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=28"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.luyouli.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=28"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}