{"id":48,"date":"2022-01-14T00:43:09","date_gmt":"2022-01-13T16:43:09","guid":{"rendered":"https:\/\/www.zhangc.net\/?p=48"},"modified":"2023-02-20T01:32:56","modified_gmt":"2023-02-19T17:32:56","slug":"linux-%e7%bc%96%e8%af%91%e5%ae%89%e8%a3%85-mysql-5-7-30","status":"publish","type":"post","link":"https:\/\/www.zhangc.net\/index.php\/2022\/01\/14\/linux-%e7%bc%96%e8%af%91%e5%ae%89%e8%a3%85-mysql-5-7-30\/","title":{"rendered":"linux \u7f16\u8bd1\u5b89\u88c5 mysql 5.7.30"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u672c\u6587\u53c2\u8003\uff1ahttp:\/\/chenzehe.iteye.com\/blog\/1266260&nbsp;&nbsp;\u611f\u8c22\u539f\u4f5c\u8005\u7684\u5206\u4eab\uff01<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u9996\u5148\u5b89\u88c5\/\u66f4\u65b0\u4e00\u4e9b\u7f16\u8bd1\u65f6\u4f1a\u7528\u5230\u7684\u57fa\u7840\u5305<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">[root@localhost local]# yum -y install gcc gcc-c++ make cmake ncurses ncurses-devel libxml2 libxml2-devel openssl-devel bison bison-devel\n[root@localhost local]# \n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b98\u7f51\u4e0b\u8f7dmysql 5.7.30\u7248\u672c\u6e90\u7801\u5305<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7f16\u8bd1\u5b89\u88c5mysql 5.7.30\u7684\u7248\u672c\u9700\u8981gcc\u652f\u6301c++11\uff0c\u4e0d\u61c2\u7684\u670b\u53cb\u53ef\u4ee5\u770b\u6211\u53e6\u5916\u4e00\u7bc7\u6587\u7ae0\uff1a<a href=\"http:\/\/www.cnblogs.com\/succeed\/p\/6204438.html\" target=\"_blank\" rel=\"noreferrer noopener\">\u6e90\u7801\u5b89\u88c5GCC-4.9.2<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u521b\u5efamysql\u7528\u6237<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">[root@localhost local]# groupadd mysql \n[root@localhost local]# useradd -s \/sbin\/nologin -g mysql -M mysql #\u4e0d\u5141\u8bb8mysql\u7528\u6237\u767b\u5f55\n[root@localhost local]# \n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u521b\u5efa\u6570\u636e\u5b58\u653e\u76ee\u5f55<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">[root@localhost local]# mkdir -pv \/data\/mysql\n[root@localhost local]# chown -R mysql.mysql \/data\/mysql\/\n#\u4fee\u6539\u76ee\u5f55\u6743\u9650\u4e3amysql<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u5b89\u88c5mysql<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#\u5b98\u7f51\u4e0b\u8f7dboost\u6587\u4ef6\uff0c\u89e3\u538b\u5230\u5f53\u524d\u76ee\u5f55\n\n\n# \u5728mysql\u8def\u5f84\u4e0b\u6dfb\u52a0bld\u6587\u4ef6\u5939\uff0c\u5c06\u7f16\u8bd1\u7684\u6587\u4ef6\u653e\u5728\u8fd9\u4e2a\u6587\u4ef6\u5939\u91cc mysql-5.7.30\n<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">[root@localhost mysql-5.7.30]# mkdir bld\n\n[root@localhost mysql-5.7.30]#\ncmake .. -DMYSQL_UNIX_ADDR=\/tmp\/mysql.sock\\\u2028-DSYSCONFDIR=\/usr\/local\/mysql\\\u2028-DMYSQL_TCP_PORT=3306\\\u2028-DEXTRA_CHARSETS=all\\\u2028-DMYSQL_USER=mysql\\\u2028-DCMAKE_INSTALL_PREFIX=\/usr\/local\/mysql\\\u2028-DMYSQL_DATADIR=\/data\/mysql\\\u2028-DWITH_XTRADB_STORAGE_ENGINE=1\\\u2028-DWITH_FEDERATEDX_STORAGE_ENGINE=1\\\u2028-DWITH_ARCHIVE_STORAGE_ENGINE=1\\\u2028-DWITH_MYISAM_STORAGE_ENGINE=1\\\u2028-DWITH_INNOBASE_STORAGE_ENGINE=1\\\u2028-DWITH_ARCHIVE_STPRAGE_ENGINE=1\\\u2028-DWITH_BLACKHOLE_STORAGE_ENGINE=1\\\u2028-DWIYH_READLINE=1\\\u2028-DWIYH_SSL=system\\\u2028-DVITH_ZLIB=system\\\u2028-DWITH_LOBWRAP=0\\\u2028-DWITH_BOOST=\/usr\/local\/src\/mysql-5.7.30\/boost\/boost_1_59_0\/\\\u2028-DDEFAULT_CHARSET=utf8mb4\\\u2028-DDEFAULT_COLLATION=utf8mb4_general_ci\n[root@localhost mysql-5.7.30]# make\n[root@localhost mysql-5.7.30]# make install\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;\u5230\u8fd9\u91ccMariaDB\u5df2\u7ecf\u7b97\u662f\u5b89\u88c5\u4e0a\u4e86\uff0c\u8fdb\u884c\u914d\u7f6e\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e86\u3002\u672c\u4eba\u5728\u8fd9\u91cc\u7528\u7684\u662f\u591a\u5b9e\u4f8b\u914d\u7f6e\u65b9\u6cd5<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u914d\u7f6e\u6587\u4ef6<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">#&nbsp;\u4fee\u6539my.cnf\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \u4fee\u6539my.cnf\u6587\u4ef6\n\n[mysqld]\nport = 3306\nbasedir=\/usr\/local\/mysql\ndatadir=\/data\/mysql\nsocket=\/tmp\/mysql.sock\n\n#datadir=\/var\/lib\/mysql\n#socket=\/var\/lib\/mysql\/mysql.sock\n# Disabling symbolic-links is recommended to prevent assorted security risks\nsymbolic-links=0\n# Settings user and group are ignored when systemd is used.\n# If you need to run mysqld under a different user or group,\n# customize your systemd unit file for mariadb according to the\n# instructions in http:\/\/fedoraproject.org\/wiki\/Systemd\ncharacter-set-server = utf8mb4\ncollation_server = utf8mb4_general_ci\nlower_case_table_names =1\n\n[mysqld_safe]\n#log-error=\/var\/log\/mariadb\/mariadb.log\n#pid-file=\/var\/run\/mariadb\/mariadb.pid\nlog-error=\/data\/mysql\/mysql.log\npid-file=\/data\/mysql\/mysql.pid\n\n#\n# include all files from the config directory\n#\n!includedir \/etc\/my.cnf.d\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u521d\u59cb\u5316\u6570\u636e\u76ee\u5f55<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u3000\u3000#\u628a\u7528\u5230\u7684\u5de5\u5177\u6dfb\u52a0\u5230\/usr\/bin\u76ee\u5f55<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">[root@localhost mysql]# ln -s \/usr\/local\/mysql\/scripts\/mysql_install_db \/usr\/bin\/mysql_install_db\n[root@localhost mysql]# .\/bin\/mysqld --defaults-file=\/etc\/my.cnf \\\n--basedir=\/usr\/local\/mysql\/ \\\n--datadir=\/data\/mysql\/dbdata\/ \\\n--user=mysql \\\n--initialize-insecure \\\n--ssl \\\n--explicit_defaults_for_timestamp \\\n--verbose\n# --initialize-insecure \u4ee3\u8868\u4e0d\u8bbe\u7f6e\u5bc6\u7801\uff0c\u7a7a\u5bc6\u7801\u8fdb\u5165\uff0c   --initialize \u8bbe\u7f6e\u5bc6\u7801\uff0c\u5728\u65e5\u5fd7\u680f\u91cc\u8f93\u51fa<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u542f\u52a8\u6570\u636e\u5e93<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#\u5c06\/usr\/local\/mysql\/bin\u52a0\u5230$PATH\u73af\u5883\u53d8\u91cf\u91cc \u00a0\n[root@localhost mysql]# vi \/etc\/profile\n\nexport\u00a0PATH=\/usr\/local\/mysql\/bin:$PATH \u00a0#\u63d2\u5165\u5230\u6700\u540e\u4e00\u884c\n\n# \u542f\u52a8 mysql\n[root@localhost mysql]# cp\u00a0support-files\/mysql.server\u00a0\/etc\/init.d\/mysqld\u00a0\u00a0\u00a0\n\n[root@localhost mysql]# service mysqld start\n\n\u5728\u542f\u52a8\u7684\u65f6\u5019\u4f1a\u52a0\u8f7dinnodb\uff0c\u4e2d\u9014\u4e0d\u80fd\u91cd\u542f\uff0c\u5426\u5219\u4f1a\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\n151114 00:59:38\u00a0 mysqld started\n151114\u00a0 0:59:38 [Warning] option 'thread_stack': unsigned value 126976 adjusted to 131072\nInnoDB: No valid checkpoint found.\nInnoDB: If this error appears when you are creating an InnoDB database,\nInnoDB: the problem may be that during an earlier attempt you managed\nInnoDB: to create the InnoDB data files, but log file creation failed.\nInnoDB: If that is the case, please refer to\nInnoDB: http:\/\/dev.mysql.com\/doc\/refman\/5.0\/en\/error-creating-innodb.html\n151114\u00a0 0:59:38 [ERROR] Default storage engine (InnoDB) is not available\n151114\u00a0 0:59:38 [ERROR] Aborting\n151114\u00a0 0:59:38 [Note] \/usr\/local\/mysql\/bin\/mysqld: Shutdown complete\n151114 00:59:38\u00a0 mysqld ended\n\u5220\u9664innodb\u6587\u4ef6\u5939\uff0c\u91cd\u65b0\u542f\u52a8\u5c31\u53ef\u4ee5\u4e86\n\n<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># mysql5.7.30 \u9519\u8bef\u96c6\u9526\nmysql> show databases;\u2028ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.\n\n\u4e0a\u9762\u8fd9\u4e2a\u9519\u8bef\u662f\u7531\u4e8e mysql\u6ca1\u6709\u521d\u59cb\u5316\u5bc6\u7801\uff0c\u6267\u884c\u4ee5\u4e0b\u8bed\u53e5\u5373\u53ef\n\u2028mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456' PASSWORD EXPIRE NEVER;\u2028\nmysql> flush privileges;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3000\u3000<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u53c2\u8003\uff1ahttp:\/\/chenzehe.itey&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[7],"tags":[],"class_list":["post-48","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/posts\/48","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/comments?post=48"}],"version-history":[{"count":8,"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/posts\/48\/revisions"}],"predecessor-version":[{"id":106,"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/posts\/48\/revisions\/106"}],"wp:attachment":[{"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/media?parent=48"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/categories?post=48"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/tags?post=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}