{"id":75582,"date":"2023-08-16T17:43:14","date_gmt":"2023-08-16T09:43:14","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=75582"},"modified":"2023-08-16T17:43:14","modified_gmt":"2023-08-16T09:43:14","slug":"centos-install-mysql-5-7-17","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/centos-install-mysql-5-7-17.html","title":{"rendered":"CentOS 6.5\u4e0b\u5feb\u901f\u5b89\u88c5MySQL 5.7.17"},"content":{"rendered":"

\u672c\u6b21\u64cd\u4f5c\u5728OpenStack\u865a\u62df\u673a192.168.0.230\u4e0a\u8fdb\u884c\u64cd\u4f5c\uff0chostname\u4e3a\uff1ahost-172-16-5-7<\/p>\n

1.\u4e0b\u8f7d\u5b89\u88c5\u5305<\/strong><\/div>\n

\u4eceMySQL\u5b98\u7f51\u4e0a\u4e0b\u8f7d\u6700\u65b0\u7684mysql\u5b89\u88c5\u5305mysql-5.7.17-Linux-glibc2.5-x86_64.tar.gz <\/p>\n

\u4e0b\u8f7d\u5730\u5740\uff1a<\/p>\n

http:\/\/dev.mysql.com\/downloads\/file\/?id=467556 <\/strong><\/p>\n

\u6ce8\u610f\uff0c\u4e00\u5b9a\u8981\u4e0b\u8f7d.tar.gz\uff0c\u4e0d\u8981\u4e0b\u8f7d\u90a3\u4e2a.tar\u7684\u5305 <\/p>\n

\u5c06\u5b89\u88c5\u5305\u4e0a\u4f20\u5230\/opt\u76ee\u5f55\u4e0b\uff1a<\/p>\n

2.\u68c0\u67e5\u5e93\u6587\u4ef6\u662f\u5426\u5b58\u5728\uff0c\u5982\u679c\u5b58\u5728\u5219\u5220\u9664<\/strong><\/div>\n
[root@host-172-16-5-7 ~]# rpm -qa | grep mysql\r\nmysql-libs-5.1.73-3.el6_5.x86_64\r\n[root@host-172-16-5-7 ~]# rpm -e mysql-libs-5.1.73-3.el6_5.x86_64 --nodeps\r\n\/sbin\/ldconfig: File \/usr\/lib64\/libpq.so.5.8 is empty, not checked.\r\n[root@host-172-16-5-7 ~]# rpm -qa | grep mysql\r\n<\/pre>\n

\u6574\u4e2a\u5b89\u88c5\u8fc7\u7a0b\u53c2\u8003\u5982\u4e0b\u6587\u6863\u8fdb\u884c\uff1a<\/p>\n

http:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/binary-installation.html<\/strong><\/p>\n

3.Mysql\u4f9d\u8d56\u4e8elibaio\u5e93<\/strong><\/div>\n
\r\nyum search libaio  # search for info\r\nyum install libaio # install library\r\n<\/pre>\n
4.\u5206\u522b\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\u5b89\u88c5Mysql<\/strong><\/div>\n
\r\ngroupadd mysql\r\nuseradd -r -g mysql -s \/bin\/false mysql\r\ncd \/usr\/local\r\ntar -zxvf \/opt\/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz -C \/opt\/\r\nln -s \/opt\/mysql-5.7.17-linux-glibc2.5-x86_64 mysql\r\ncd mysql\r\nmkdir mysql-files\r\nchmod 750 mysql-files\r\nchown -R mysql .\r\nchgrp -R mysql .\r\nbin\/mysqld --initialize --user=mysql\r\n<\/pre>\n

\u5982\u679c\u8fd9\u4e00\u6b65\u62a5\u9519\u5982\u4e0b\uff1a<\/p>\n

[ERROR] --initialize specified but the data directory has files in it. Aborting.<\/p>\n

\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n

rm -rf \/var\/lib\/mysql\/<\/pre>\n

\u91cd\u65b0\u6267\u884c\u4e0a\u9762\u7684\u547d\u4ee4\uff0c\u63d0\u793a\u751f\u6210\u4e86\u4e00\u4e2a\u4e34\u65f6\u5bc6\u7801\uff1a<\/p>\n

2017-01-03T09:12:33.748807Z 1 [Note] A temporary password is generated for root@localhost: =*-gFoje>1Pr<\/pre>\n

\u6267\u884c\u8fd9\u4e00\u6b65\u5e94\u8be5\u751f\u6210\u4e00\u4e2adata\u76ee\u5f55\uff0c\u5982\u679c\u6ca1\u6709\u751f\u6210\uff0c\u90a3\u4e00\u5b9a\u662f\u56e0\u4e3a\u7cfb\u7edf\u4e2d\u5b58\u5728\u5df2\u7ecf\u5b89\u88c5\u597d\u4e86\u7684mysql\uff0c\u5148\u6309\u7167\u6b65\u9aa42\u5378\u8f7d\u6389\uff0c\u7136\u540e\u91cd\u65b0\u6267\u884c<\/p>\n

bin\/mysqld --initialize --user=mysql\r\nbin\/mysql_ssl_rsa_setup\r\nchown -R root .\r\nchown -R mysql data mysql-files\r\nbin\/mysqld_safe --user=mysql &\r\n<\/pre>\n

\u4e0b\u9762\u8fd9\u4e00\u6b65\u53ef\u9009<\/p>\n

cp support-files\/mysql.server \/etc\/init.d\/mysqld<\/pre>\n
5.\u5b89\u88c5\u540e\u7684\u914d\u7f6e<\/strong><\/div>\n

\u4fee\u6539\/usr\/local\/mysql\/support-files\/my-default.cnf<\/p>\n

\r\nbasedir = \/usr\/local\/mysql\r\ndatadir = \/usr\/local\/mysql\/data\r\nport = 3306\r\n<\/pre>\n

\u6539\u5b8c\u4e4b\u540e\u590d\u5236\u4e00\u4efd\u5230\/etc\/\u76ee\u5f55\u4e0b\uff0c\u91cd\u547d\u540d\u4e3amy.cnf<\/p>\n

cp my-default.cnf \/etc\/my.cnf<\/pre>\n

\u6dfb\u52a0mysql\u73af\u5883\u53d8\u91cf<\/p>\n

\r\nvim \/etc\/profile\r\nexport MYSQL_HOME=\/usr\/local\/mysql\r\nexport PATH=$MYSQL_HOME\/bin:$PATH\r\nsource \/etc\/profile \r\n<\/pre>\n
6.\u542f\u52a8mysql<\/strong><\/div>\n
service mysqld start<\/pre>\n

\u542f\u52a8\u6210\u529f\uff1a<\/p>\n

\r\n[root@ambari support-files]# service mysqld start\r\nStarting MySQL.Logging to '\/usr\/local\/mysql\/data\/ambari.err'.\r\n.                                                          [  OK  ]\r\n[root@ambari support-files]# service mysqld status\r\nMySQL running (8010)                                       [  OK  ]\r\n<\/pre>\n

\u6267\u884c\u8fd9\u4e00\u6b65\u7684\u65f6\u5019\u6709\u53ef\u80fd\u4f1a\u5bfc\u81f4\u542f\u52a8\u4e0d\u6210\u529f\uff0c\u9519\u8bef\u4fe1\u606f\u5927\u6982\u5982\u4e0b\uff1a<\/p>\n

MySQL: Starting MySQL\u2026.. ERROR! The server quit without updating PID file<\/pre>\n

\u53ef\u53c2\u7167\u5982\u4e0b\u94fe\u63a5\u89e3\u51b3\uff1a<\/p>\n

https:\/\/icesquare.com\/wordpress\/mysql-starting-mysql-error-the-server-quit-without-updating-pid-file\/<\/strong> <\/p>\n

\u5982\u679c\u4e0d\u613f\u610f\u9ebb\u70e6\uff0c\u53ef\u4ee5\u76f4\u63a5\u91cd\u542f\u673a\u5668\u4e5f\u53ef\u4ee5\u89e3\u51b3\u8be5\u95ee\u9898<\/p>\n

\u81f3\u6b64\uff0cmysql\u5c31\u5b89\u88c5\u597d\u5e76\u542f\u52a8\u6210\u529f\u4e86\u3002<\/p>\n

7.\u4fee\u6539root\u5bc6\u7801\uff1a<\/strong><\/div>\n

\u91c7\u7528<\/p>\n

mysql -uroot -p<\/pre>\n

\u767b\u5f55\u7684\u65f6\u5019\uff0c\u8f93\u5165\u524d\u9762\u8bb0\u5f55\u7684root\u5bc6\u7801\uff0c\u63d0\u793a\u5bc6\u7801\u4e0d\u6b63\u786e\uff0c\u6ca1\u529e\u6cd5\uff0c\u6211\u4eec\u53ea\u597d\u81ea\u5df1\u53bb\u4fee\u6539root\u5bc6\u7801\u4e86 <\/p>\n

\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a <\/p>\n

step1:<\/strong><\/p>\n

vim \/etc\/my.cnf<\/pre>\n

\u5728[mysqld]\u4e0b\u6dfb\u52a0\u4e00\u884cskip-grant-tables <\/p>\n

step2: <\/strong><\/p>\n

service mysqld restart\u540e\uff0c\u5373\u53ef\u76f4\u63a5\u7528mysql\u8fdb\u5165<\/p>\n

\r\nmysql> update mysql.user set authentication_string=password('root') where user='root' and Host = 'localhost';\r\nmysql> flush privileges;\r\nmysql> quit;\r\n<\/pre>\n

step3: <\/strong><\/p>\n

\u5c06\/etc\/my.cnf\u6587\u4ef6\u8fd8\u539f\uff0c\u91cd\u65b0\u542f\u52a8mysql:service mysqld restart,\u8fd9\u4e2a\u65f6\u5019\u53ef\u4ee5\u4f7f\u7528mysql -u root -p'root'\u8fdb\u5165\u4e86 <\/p>\n

step4:<\/strong><\/p>\n

\u8fdb\u5165\u5230sql\u540e\u4ee5\u540e\u5728\u901a\u8fc7\u5982\u4e0b\u547d\u4ee4\u4fee\u6539\u4e00\u6b21\u5bc6\u7801\uff0c\u5426\u5219\u65e0\u6cd5\u8fdb\u884c\u5176\u4ed6\u64cd\u4f5c\uff1a<\/p>\n

mysql> SET PASSWORD = PASSWORD('mysql');<\/pre>\n

step5: <\/strong><\/p>\n

\u5728sql\u63a7\u5236\u53f0\u6267\u884cshow databases;\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n

mysql> show databases;\r\n+--------------------+\r\n| Database           |\r\n+--------------------+\r\n| information_schema |\r\n| mysql              |\r\n| performance_schema |\r\n| sys                |\r\n+--------------------+\r\n4 rows in set (0.00 sec)\r\n<\/pre>\n

\u9644\uff1a\u53c2\u8003\u6587\u6863\uff0c\u611f\u8c22\u4f60\u4eec\u7684\u5206\u4eab\uff0c\u6b63\u662f\u56e0\u4e3a\u4f60\u4eec\u7684\u7ecf\u9a8c\uff0c\u8ba9\u6211\u80fd\u591f\u5feb\u901f\u89e3\u51b3\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u9047\u5230\u7684\u5404\u79cd\u95ee\u9898\uff1a <\/p>\n

http:\/\/www.cnblogs.com\/tuhooo\/p\/5189236.html<\/p>\n

https:\/\/icesquare.com\/wordpress\/mysql-starting-mysql-error-the-server-quit-without-updating-pid-file\/<\/strong><\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttp:\/\/blog.csdn.net\/embracejava\/article\/details\/53996794<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/centos-install-mysql-5-7-17.html<\/a>\u7f16\u8f91\uff1a\u5cb3\u6c38\uff0c\u5ba1\u6838\u5458\uff1a\u51af\u632f\u534e<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u672c\u6b21\u64cd\u4f5c\u5728OpenStack\u865a\u62df\u673a192.168.0.230\u4e0a\u8fdb\u884c\u64cd\u4f5c\uff0chostname\u4e3a\uff1ahost-172- […]<\/p>\n","protected":false},"author":63,"featured_media":17093,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-75582","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\/75582","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\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=75582"}],"version-history":[{"count":12,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/75582\/revisions"}],"predecessor-version":[{"id":280361,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/75582\/revisions\/280361"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/17093"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=75582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=75582"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=75582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}