{"id":29525,"date":"2023-02-14T09:45:37","date_gmt":"2023-02-14T01:45:37","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=29525"},"modified":"2023-02-14T09:45:37","modified_gmt":"2023-02-14T01:45:37","slug":"centos-cmake-mysql","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/centos-cmake-mysql.html","title":{"rendered":"CentOS6.7\u4e0b\u4f7f\u7528cmake\u7f16\u8bd1\u5b89\u88c5MySQL5.5.32"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u4eceMySQL5.5\u7248\u672c\u5f00\u59cb\uff0cMySQL\u6e90\u7801\u5b89\u88c5\u7684\u7f16\u8bd1\u5de5\u5177\u7531configure\u5f00\u59cb\u5411cmake\u8fc7\u6e21\uff0c\u5b89\u88c5\u65b9\u5f0f\u548cMySQL5.5\u4e4b\u524d\u7684\u7248\u672c\u7565\u6709\u4e0d\u540c\u3002\u6e90\u7801\u7f16\u8bd1\u5b89\u88c5\u6700\u5bb9\u6613\u51fa\u9519\uff0c\u4e5f\u662f\u6700\u8017\u65f6\u95f4\u3002\u5efa\u8bae\u521d\u5b66\u8005\u5b66\u4f1a\u4e00\u79cd\u65b9\u5f0f\u4e4b\u540e\uff0c\u5c1d\u8bd5\u5e94\u7528\u591a\u79cd\u65b9\u5f0f\u5b89\u88c5\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"mysql\"<\/a><\/p>\n

\u4e00\u3001\u5b89\u88c5cmake\u7f16\u8bd1\u73af\u5883<\/strong><\/div>\n

1.1 \u4f7f\u7528yum\u65b9\u5f0f\u5b89\u88c5gcc gcc-c++<\/p>\n

[root@lenovo ~]# yum install gcc-c++ gcc -y<\/pre>\n

1.2 \u89e3\u538bcamke\u6e90\u6587\u4ef6
\n\u5c06cmake\u6e90\u6587\u4ef6\u653e\u5165\/tmp\/\u6587\u4ef6\u5939\u4e0b<\/p>\n

[root@lenovo ~]# cd \/tmp\r\n[root@lenovo ~]# tar -xf cmake-2.8.8.tar.gz<\/pre>\n

1.3\u7f16\u8bd1\u5b89\u88c5cmake<\/p>\n

[root@lenovo ~]# cd cmake-2.8.8\r\n[root@lenovo ~]# .\/configure\r\n[root@lenovo ~]# make\r\n[root@lenovo ~]# make install<\/pre>\n

\u81f3\u6b64cmake\u7f16\u8bd1\u73af\u5883\u5b89\u88c5\u6210\u529f<\/p>\n

\u4e8c\u3001\u5b89\u88c5MySQL5.5.32<\/strong><\/div>\n

2.1\u5b89\u88c5mysql\u4f9d\u8d56\u5305<\/p>\n

[root@lenovo ~]#yum install ncurses-devel -y<\/pre>\n

2.2\u521b\u5efamysql\u7528\u6237\u548c\u7528\u6237\u7ec4<\/p>\n

[root@lenovo ~]# groupadd mysql\r\n[root@lenovo ~]# useradd -g mysql mysql<\/pre>\n

2.3\u521b\u5efamysql\u5b89\u88c5\u76ee\u5f55<\/p>\n

[root@lenovo ~]# mkdir -p \/usr\/local\/mysql\/<\/pre>\n

2.4\u521b\u5efa\u6570\u636e\u5b58\u653e\u76ee\u5f55<\/p>\n

[root@lenovo ~]# mkdir -p \/data\/mysql\/<\/pre>\n

2.5\u8d4b\u4e88\u6570\u636e\u5b58\u653e\u76ee\u5f55\u6743\u9650<\/p>\n

[root@lenovo ~]# chown mysql.mysql -R \/data\/mysql\/<\/pre>\n

2.6\u89e3\u538bMySQL\u6e90\u7801\u5305
\n\u5c06MySQL5.5.32\u6e90\u6587\u4ef6\u653e\u5165\/tmp\/\u6587\u4ef6\u5939\u4e0b<\/p>\n

[root@lenovo ~]# cd \/tmp\r\n[root@lenovo ~]# tar -xf mysql-5.5.32.tar.gz<\/pre>\n

2.7\u7f16\u8bd1\u5b89\u88c5mysql5.5.32<\/p>\n

[root@lenovo ~]#cd mysql-5.5.32<\/pre>\n

\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4<\/p>\n

[root@lenovo ~]\r\ncmake -DCMAKE_INSTALL_PREFIX=\/usr\/local\/mysql \\\r\n-DMYSQL_UNIX_ADDR=\/data\/mysql\/mysql.sock \\\r\n-DDEFAULT_CHARSET=utf8 \\\r\n-DDEFAULT_COLLATION=utf8_general_ci \\\r\n-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \\\r\n-DWITH_MYISAM_STORAGE_ENGINE=1 \\\r\n-DWITH_INNOBASE_STORAGE_ENGINE=1 \\\r\n-DWITH_MEMORY_STORAGE_ENGINE=1 \\\r\n-DWITH_READLINE=1 \\\r\n-DENABLED_LOCAL_INFILE=1 \\\r\n-DMYSQL_DATADIR=\/data\/mysql \\\r\n-DMYSQL_USER=mysql \\\r\n-DMYSQL_TCP_PORT=3306\r\n[root@lenovo ~]# make\r\n[root@lenovo ~]# make install<\/pre>\n

2.8\u590d\u5236\u914d\u7f6e\u6587\u4ef6<\/p>\n

[root@lenovo ~]# cp support-files\/my-medium.cnf \/etc\/my.cnf<\/pre>\n

2.9\u521d\u59cb\u5316\u6570\u636e\u5e93<\/p>\n

[root@lenovo ~]# chmod 755 scripts\/mysql_install_db\r\n[root@lenovo ~]# scripts\/mysql_install_db \\\r\n--user=mysql \\\r\n--basedir=\/usr\/local\/mysql \\\r\n--datadir=\/data\/mysql\/<\/pre>\n

\u6ce8\uff1abasedir\u4e3amysql\u5b89\u88c5\u8def\u5f84 datadir\u4e3a\u6570\u636e\u5e93\u6587\u4ef6\u50a8\u5b58\u8def\u5f84
\n2.10\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/p>\n

[root@lenovo ~]# vim \/etc\/profile<\/pre>\n

\u5728\/etc\/profile\u6587\u4ef6\u4e2d\u8ffd\u52a0PATH=\/usr\/local\/mysql\/bin:$PATH
\n\u6ce8\u610f\uff1a\u5728\u201c=\u201d\u7684\u4fe9\u8fb9\u4e0d\u53ef\u4ee5\u6709\u7a7a\u683c
\n\u6ce8\u610f\uff1a\u82e5\u91c7\u7528\u4fee\u6539profile\u6587\u4ef6\u7684\u65b9\u6cd5\u6539\u53d8PATH\uff0c\u5219\u5fc5\u987b\u91cd\u65b0\u767b\u5f55\u624d\u80fd\u751f\u6548\uff0c\u4ee5\u4e0b\u65b9\u6cd5\u53ef\u7b80\u5316\u5de5\u4f5c\uff1a
\n\u5982\u679c\u4fee\u6539\u4e86\/etc\/profile\uff0c\u90a3\u4e48\u7f16\u8f91\u7ed3\u675f\u540e\u6267\u884csource profile \u6216\u6267\u884c\u70b9\u547d\u4ee4\uff1a\/etc\/profile\uff0c
\nPATH\u7684\u503c\u5c31\u4f1a\u7acb\u5373\u751f\u6548\u4e86\u3002\u8fd9\u4e2a\u65b9\u6cd5\u7684\u539f\u7406\u662f\u518d\u6267\u884c\u4e00\u6b21\/etc\/profile shell\u811a\u672c\uff0c
\n\u6ce8\u610f\u5982\u679c\u7528sh \/etc\/profile\u662f\u4e0d\u884c\u7684\uff0c\u56e0\u4e3ash\u662f\u5728\u5b50shell\u8fdb\u7a0b\u4e2d\u6267\u884c\u7684\uff0c\u5373\u4f7fPATH\u6539\u53d8\u4e86\u4e5f\u4e0d\u4f1a\u53cd\u6620\u5230\u5f53\u524d\u73af\u5883\u4e2d\uff0c
\n\u4f46\u662fsource\u662f\u5728\u5f53\u524dshell\u8fdb\u7a0b\u4e2d\u6267\u884c\u7684\uff0c\u6240\u4ee5\u6211\u4eec\u80fd\u770b\u5230PATH\u7684\u6539\u53d8\u3002<\/p>\n

[root@lenovo ~]# source \/etc\/profile<\/pre>\n

2.11\u67e5\u770b\u5f53\u524d\u73af\u5883\u53d8\u91cf<\/p>\n

[root@lenovo ~]# echo $PATH<\/pre>\n

\u73b0\u5728\u53ef\u4ee5\u53d1\u73b0\u73af\u5883\u53d8\u91cf\u4e2d\u591a\u4e86\/usr\/local\/mysql\/bin:<\/p>\n

\/usr\/local\/mysql\/bin:\/usr\/lib64\/qt-3.3\/bin:\/usr\/local\/sbin:\/usr\/local\/bin:\/sbin:\/bin:\/usr\/sbin:\/usr\/bin:\/root\/bin<\/pre>\n

\u81f3\u6b64mysql\u7f16\u8bd1\u5b89\u88c5\u6210\u529f<\/p>\n

\u4e09\u3001\u542f\u52a8mysql\u6570\u636e\u5e93<\/strong><\/div>\n

3.1\u542f\u52a8mysql\u670d\u52a1<\/p>\n

[root@lenovo ~]# cp support-files\/mysql.server \/etc\/init.d\/mysqld\r\n[root@lenovo ~]# chmod 755 \/etc\/init.d\/mysqld\r\n[root@lenovo ~]# \/etc\/init.d\/mysqld start \/\/<\/pre>\n

\u670d\u52a1\u5668\u7aef\u5f00\u5173
\n\u542f\u52a8\u5b8c\u6210\u4e4b\u540e\u7528ps -ef |grep mysql \u547d\u4ee4\u67e5\u770b\u662f\u5426\u542f\u52a8<\/p>\n

[root@lenovo ~]# ps -ef |grep mysql<\/pre>\n

3.2\u4e3aroot\u7528\u6237\u8bbe\u7f6e\u5bc6\u7801<\/p>\n

[root@lenovo ~]# mysqladmin -u root password 'yourpassword'<\/pre>\n

3.3\u8fdb\u5165mysql<\/p>\n

[root@lenovo ~]# mysql -u root -p \/\/<\/pre>\n

\u8fdb\u5165\u6570\u636e\u5e93<\/p>\n

mysql>use mysql\r\nmysql>select user,password,host from user;\r\nmysql>update user set host = '192.168.%' where user = '127.0.0.1';\r\nmysql>grant all privileges on *.* to root@'%' identified by \"root\";<\/pre>\n

\/\/\u7ed9\u4ee5root@ip\u767b\u5f55\u7684\u8fdc\u7a0b\u8fde\u63a5\u8d4b\u4e88\u6743\u9650\uff0c\u80fd\u591f\u8fde\u63a5\u6570\u636e\u5e93\u3002\u8fdc\u7a0b\u65e0\u6cd5\u8fde\u63a5\u7684\u5e38\u89c1\u95ee\u9898\u539f\u56e0\u3002\u5e76\u628a\u8fdc\u7a0b\u767b\u5f55\u7528\u6237\u7684\u5bc6\u7801\u8bbe\u7f6e\u4e3aroot<\/p>\n

mysql> flush privileges;\r\nmysql>quit<\/pre>\n

\u672c\u6587\u539f\u521b\u5730\u5740\uff1a http:\/\/lrxjmw.cn\/centos-cmake-mysql.html <\/a>\u4f5c\u8005\uff1a\u515a\u4f1f\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb \u4eceMySQL5.5\u7248\u672c\u5f00\u59cb\uff0cMySQL\u6e90\u7801\u5b89\u88c5\u7684\u7f16\u8bd1\u5de5\u5177\u7531configure\u5f00\u59cb\u5411cmake\u8fc7\u6e21\uff0c\u5b89\u88c5\u65b9 […]<\/p>\n","protected":false},"author":309,"featured_media":34572,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-29525","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/29525","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/309"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=29525"}],"version-history":[{"count":13,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/29525\/revisions"}],"predecessor-version":[{"id":264101,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/29525\/revisions\/264101"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/34572"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=29525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=29525"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=29525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}