{"id":100921,"date":"2024-07-17T22:37:10","date_gmt":"2024-07-17T14:37:10","guid":{"rendered":"https:\/\/gulass.cn\/?p=100921"},"modified":"2024-07-17T22:37:10","modified_gmt":"2024-07-17T14:37:10","slug":"centos7-mariadb","status":"publish","type":"post","link":"https:\/\/gulass.cn\/centos7-mariadb.html","title":{"rendered":"Centos 7 \u4e8c\u8fdb\u5236\u5b89\u88c5\u914d\u7f6e MariaDB\u6570\u636e\u5e93"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5f88\u4e45\u6ca1\u5b89\u88c5\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e86\uff0c\u8bb0\u5f97\u4e0a\u6b21 MySQL \u5b89\u88c5\u914d\u7f6e\u7684\u65f6\u5019\uff0c\u7cfb\u7edf\u8fd8\u662f Cenots 6.5 \uff0c\u73b0\u5728 Centos \u7cfb\u7edf\u7248\u672c\u66f4\u65b0\u592a\u5feb\uff0c\u90fd\u8ddf\u4e0d\u4e0a\u6b65\u4f10\u4e86\uff0c\u521a\u597d\u6700\u8fd1\u516c\u53f8\u9700\u8981\u51e0\u53f0 Mariadb Server \u521a\u597d\u7ec3\u7ec3\u624b\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u7531\u4e8e\u6bcf\u5bb6\u516c\u53f8\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668 \u7248\u672c\u4e0d\u540c\uff0c\u4f46\u6211\u4f9d\u7136\u63a8\u8350\u5927\u5bb6\u4f7f\u7528 Mariadb \u6570\u636e\u5e93\uff0c\u81f3\u5c11\u76ee\u524d\u8be5\u793e\u533a\u53ca\u4ea7\u54c1\u975e\u5e38\u7a33\u5b9a\uff0c\u81f3\u4e8e\u6709\u4ec0\u4e48\u65b0\u529f\u80fd\uff0c\u5efa\u8bae\u53bb\u5176\u5b98\u65b9\u4e86\u89e3\u66f4\u591a\u7279\u6027\u3002<\/p>\n

\u67e5\u770b\u7cfb\u7edf\u7248\u672c\u547d\u4ee4<\/p>\n

\r\n$ cat \/etc\/redhat-release\r\nCentOS Linux release 7.4.1708 (Core) x64\r\n<\/pre>\n
\u5b89\u88c5 MariaDB\uff08MySQL\uff09<\/strong><\/span><\/div>\n

\u4e0b\u8f7dMariaDB\u4e8c\u8fdb\u5236\u5b89\u88c5\u5305\uff1a<\/p>\n

\r\nhttps:\/\/downloads.mariadb.org\r\n\u89e3\u538b\u5e76\u5b89\u88c5 Mariadb-devel \u9759\u6001\u5e93\uff1a\r\n\r\n$ yum install mariadb-devel numactl -y\r\n$ mkdir \/renwole\r\n$ cd \/renwole\r\n$ tar zxvf mariadb-10.2.8-linux-glibc_214-x86_64.tar.gz\r\n\u79fb\u52a8\u76ee\u5f55\u5e76\u521b\u5efa\u8f6f\u8fde\u63a5\uff1a\r\n\r\n$ mv mariadb-10.2.8-linux-glibc_214-x86_64 \/usr\/local\r\n$ cd \/usr\/local\r\n$ ln -s mariadb-10.2.8-linux-glibc_214-x86_64 mysql\r\n\u521b\u5efa MariaDB\uff08MySQL\uff09\u7528\u6237\u548c\u7ec4\r\n\r\n$ groupadd mysql\r\n$ useradd -g mysql mysql\r\n\u8d4b\u4e88 MariaDB\uff08MySQL\uff09\u76ee\u5f55\u6743\u9650\uff1a\r\n\r\n$ cd \/usr\/local\/mysql\r\n$ chown -R root .\r\n$ chown -R mysql data\r\n<\/pre>\n
\u914d\u7f6e MariaDB\uff08MySQL\uff09<\/strong><\/span><\/div>\n

\u5220\u9664\u81ea\u5e26\u7684 my.cnf \u914d\u7f6e\u6587\u4ef6\uff0c\u5e76\u521b\u5efa\u65b0\u7684\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n

\r\n$ rm -rf \/etc\/my.cnf\r\n$ cp \/usr\/local\/mysql\/support-files\/my-large.cnf \/etc\/my.cnf\r\n<\/pre>\n

\u6ce8\uff1a\/usr\/local\/mysql\/support-files\u4e0b\u67095\u4e2a\u914d\u7f6e\u6587\u4ef6\uff0c\u8bf7\u6839\u636e\u670d\u52a1\u5668\u7684\u5185\u5b58\u5927\u5c0f\u9009\u62e9\u914d\u7f6e\u6587\u4ef6\uff08\u4f60\u4e5f\u53ef\u4ee5\u81ea\u5b9a\u4e49\u4f18\u5316my.cnf\u914d\u7f6e\u6587\u4ef6\uff0c\u5982\u679c\u4f60\u4e4b\u524d\u6709\uff0c\u53ea\u8981\u662f\u540c\u7248\u672c\u5c31\u53ef\u4ee5\u6b63\u5e38\u4f7f\u7528\uff0c\u4ece\u800c\u65e0\u987b\u518d\u6b21\u521b\u5efa\uff0cMariaDB\uff08MySQL\uff09\u542f\u52a8\u7684\u65f6\u5019\u4f1a\u81ea\u52a8\u5230\/etc\u4e0b\u5bfb\u627emy.cnf\u6587\u4ef6\uff09\u3002<\/p>\n

\u6587\u4ef6\u5206\u522b\u662f\uff1a<\/p>\n

\r\nmy-small.ini \uff08\u5185\u5b58 < = 64M\uff09\r\nmy-medium.ini \uff08\u5185\u5b58 128M \uff09\r\nmy-large.ini \uff08\u5185\u5b58 512M\uff09\r\nmy-huge.ini \uff08\u5185\u5b58 1G-2G\uff09\r\nmy-innodb-heavy-4G.ini \uff08\u5185\u5b58 4GB\uff09\r\n\u5728my.cnf\u6587\u4ef6\u7684 mysqld \u5b57\u6bb5\u52a0\u5165\u6570\u636e\u5e93\u8def\u5f84\uff1a\r\n<\/pre>\n
\r\n$ vim \/etc\/my.cnf\r\n\r\ndatadir = \/usr\/local\/mysql\/data<\/pre>\n

\u6ce8\u610f\uff1a\u8fd9\u4e2a\u8def\u5f84\u5c31\u662f\u521d\u59cb\u5316\u6570\u636e\u5e93\u7528\u7684\uff0c\u5c06\u6765\u4f60\u7684\u6570\u636e\u5e93\u90fd\u5b58\u5728\u8fd9\u4e2a\u76ee\u5f55\uff0c\u8fd9\u4e2a\u5b58\u50a8\u8def\u5f84\u662f\u53ef\u4ee5\u66f4\u6539\u5230\u5176\u4ed6\u8def\u5f84\u7684\uff0c\u4ee5\u514d\u5c06\u6765\u7cfb\u7edf\u5b95\u673a\u5e26\u6765\u4e0d\u5fc5\u8981\u7684\u635f\u5931\uff0c\u6240\u4ee5\u8bf7\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u66f4\u6362\u76f8\u5bf9\u7684\u8def\u5f84\uff0c\u522b\u5fd8\u8bb0\u7ed9\u6743\u9650\u5c31\u884c\u3002<\/p>\n

\u521d\u59cb\u5316\u6570\u636e\u5e93<\/strong><\/span><\/div>\n
\r\n$ cd \/usr\/local\/mysql\/scripts\r\n$ .\/mysql_install_db --user=mysql --basedir=\/usr\/local\/mysql --datadir=\/usr\/local\/mysql\/data\r\n\r\n$ cd \/usr\/local\/mysql\/support-files\r\n$ cp mysql.server \/etc\/init.d\/mysql\r\n$ chmod +x \/etc\/init.d\/mysql\r\n$ systemctl enable mysql\r\n\r\n\u6dfb\u52a0\u7cfb\u7edf\u53d8\u91cf\uff0c\u4f8b\u5982\u76f4\u63a5\u8f93\u5165\uff1amysql -uroot -p \u4f1a\u63d0\u793a\u65e0\u6b64\u547d\u4ee4\uff1a\r\n\r\n$ vim \/etc\/profile\r\n\u5728\u6587\u4ef6\u672b\u7aef\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a\r\n\r\nPATH=$PATH:\/usr\/local\/mysql\/bin\r\nexport PATH\r\n\u4f7f\u53d8\u91cf\u7acb\u5373\u751f\u6548\u5e76\u542f\u52a8Mysql\u6570\u636e\u5e93\uff1a\r\n\r\n$ source \/etc\/profile\r\n$ systemctl restart mysql\r\n$ ss -antp\r\n<\/pre>\n
\u521d\u59cb\u5316MariaDB\uff08MySQL\uff09\u5b89\u5168\u8d26\u6237<\/strong><\/span><\/div>\n
\r\n$ \/usr\/local\/mysql\/bin\/mysql_secure_installation<\/pre>\n

\u6ce8\u610f\uff1a\u56de\u8f66\u63d0\u793a\u4f60\u8f93\u5165MariaDB\uff08MySQL\uff09\u5bc6\u7801\uff0c\u65b0\u5b89\u88c5\u7684mysql\u5bc6\u7801\u9ed8\u8ba4\u4e3a\u7a7a\uff0c\u6240\u4ee5\u76f4\u63a5\u56de\u8f66\uff0c\u7136\u540e\u8f93\u5165Y\u8bbe\u7f6eMySQL\u5bc6\u7801\uff0c\u8f93\u5165\u4e24\u6b21\u56de\u8f66\u5373\u53ef\uff0c\u63a5\u4e0b\u6765\u5168\u90e8\u6309Y\u5373\u53ef\uff08\u5927\u81f4\u610f\u601d\u662f\u5220\u9664test\u6570\u636e\u5e93\u3001\u533f\u540d\u8d26\u53f7\u3001\u6700\u540eY\u914d\u7f6e\u751f\u6548\u3002<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/renwole.com\/archives\/23<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttps:\/\/gulass.cn\/centos7-mariadb.html<\/a>\u7f16\u8f91\uff1a\u5434\u5411\u5e73\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb \u5f88\u4e45\u6ca1\u5b89\u88c5\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e86\uff0c\u8bb0\u5f97\u4e0a\u6b21 MySQL \u5b89\u88c5\u914d\u7f6e\u7684\u65f6\u5019\uff0c\u7cfb\u7edf\u8fd8\u662f Cenots 6.5 \uff0c\u73b0\u5728 […]<\/p>\n","protected":false},"author":668,"featured_media":100930,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-100921","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/100921","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/668"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=100921"}],"version-history":[{"count":10,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/100921\/revisions"}],"predecessor-version":[{"id":292303,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/100921\/revisions\/292303"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/100930"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=100921"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=100921"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=100921"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}