\u9019\u500b\u9700\u6c42\u662f\u9019\u6a23\u5b50\u7522\u751f\u7684\uff1a\u67d0\u4e00\u500b\u5ba2\u6236\u9700\u8981\u5ba2\u88fd\u5316my.cnf\u6a94\u3002\u4f46\u662fmy.cnf\u6a94\u7684\u8a2d\u5b9a\u53c8\u6703\u4e00\u6b21\u5957\u7528\u5230\u6240\u6709\u7684\u5ba2\u6236\u4e0a\u3002<\/p>\n
\u6211\u67e5\u8a62\u7684\u95dc\u9375\u5b57\u662f running multiple mysql instances on one server<\/p>\n
\u53c3\u8003\u8cc7\u6599<\/a>\u00a0( \u9019\u500b\u53c3\u8003\u8cc7\u6599\u53ea\u80fd\u7576\u53c3\u8003\uff0c\u6211\u5be6\u6e2c\u4e4b\u5f8c\uff0c\u6709\u8a31\u591a\u7d30\u7bc0\u4e0d\u540c\u3002)<\/p>\n \u4fee\u6539\u7684\u6b65\u9a5f\uff1a (2) cp \/etc\/my.cnf \/etc\/my2.cnf (3) cp \/etc\/init.d\/mysql \/etc\/init.d\/mysql2 (4) chkconfig –add mysql2<\/p>\n (5) \u7406\u8ad6\u4e0a\uff0c\u8981\u7528mysql_install_db\u7684\u6307\u4ee4\u4f86\u5b89\u88dd\u65b0\u7684default mysql database cp -a \/var\/lib\/mysql\/performance_schema \/var\/lib\/mysql2 (6) service mysql2 start<\/p>\n (7) mysql -h127.0.0.1 -P3307 \u7406\u8ad6\u4e0a\uff0c\u5982\u679c\u662f\u53ea\u51fa\u73fe \u4e09\u500b\u8cc7\u6599\u5eab\u7684\u8a71\uff0c\u9019\u6a23\u5b50\u5c31\u4ee3\u8868\u8a2d\u7f6e\u6210\u529f\u4e86\uff01<\/p>\n","protected":false},"excerpt":{"rendered":" \u9019\u500b\u9700\u6c42\u662f\u9019\u6a23\u5b50\u7522\u751f\u7684\uff1a\u67d0\u4e00\u500b\u5ba2\u6236\u9700\u8981\u5ba2\u88fd\u5316my.cnf\u6a94\u3002\u4f46\u662fmy.cnf\u6a94\u7684\u8a2d\u5b9a\u53c8\u6703\u4e00\u6b21\u5957\u7528\u5230\u6240\u6709\u7684\u5ba2\u6236\u4e0a … \u95b1\u8b80\u5168\u6587 \u5982\u4f55\u5728\u540c\u4e00\u53f0\u6a5f\u5668\u57f7\u884c\u5169\u500bmysql\u8cc7\u6599\u5eab\u7684\u7a0b\u5f0f\uff1f<\/span><\/a><\/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},"categories":[1],"tags":[70,22],"_links":{"self":[{"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/posts\/268"}],"collection":[{"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/comments?post=268"}],"version-history":[{"count":2,"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/posts\/268\/revisions"}],"predecessor-version":[{"id":270,"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/posts\/268\/revisions\/270"}],"wp:attachment":[{"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/media?parent=268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/categories?post=268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/tags?post=268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
\n(1) mkdir \/var\/lib\/mysql2
\nchown mysql.mysql \/var\/lib\/mysql2<\/p>\n
\n\u4fee\u6539\/etc\/my2.cnf \u7684\u5167\u5bb9\uff1a
\ndatadir=\/var\/lib\/mysql2
\nport=3307<\/p>\n
\n\u4fee\u6539\/etc\/init.d\/mysql2 \u7684\u5167\u5bb9\uff1a<\/p>\n\n
\nmysql_install_db –datadir=\/var\/lib\/mysql2 –defaults-file=\/etc\/my2.cnf –user=mysql
\n\u4f46\u662f\uff0c\u5be6\u969b\u4e0a\uff0c\u6211\u9019\u6a23\u5b50\u505a\u4e4b\u5f8c\uff0c\u9084\u662f\u6709\u554f\u984c\uff0c\u6240\u4ee5\u6211\u5f8c\u4f86\u6c92\u4f7f\u7528\u9019\u500b\u6307\u4ee4\u3002\u6211\u628a\/var\/lib\/mysql2 \u9019\u500b\u8cc7\u6599\u593e\u6e05\u7a7a\u4e4b\u5f8c\uff0c<\/p>\n
\ncp -a \/var\/lib\/mysql\/mysql \/var\/lib\/mysql2<\/p>\n
\n\u5982\u679c\u53ef\u4ee5\u9806\u5229\u767b\u5165\u7684\u8a71\uff0c
\nmysql> show databases;<\/p>\n
\nmysql
\ninformation_schema
\nperformance_schema<\/p>\n