{"id":1534,"date":"2011-10-02T00:20:43","date_gmt":"2011-10-01T15:20:43","guid":{"rendered":"http:\/\/blog.isnext.net\/issy\/?p=1534"},"modified":"2011-10-02T00:21:51","modified_gmt":"2011-10-01T15:21:51","slug":"scientific-linux-5-7%e3%81%a7mysqld%e8%a4%87%e6%95%b0%e8%b5%b7%e5%8b%95%e8%a8%ad%e5%ae%9a","status":"publish","type":"post","link":"https:\/\/blog.isnext.net\/issy\/archives\/1534","title":{"rendered":"Scientific Linux 5.7\u3067mysqld\u8907\u6570\u8d77\u52d5\u8a2d\u5b9a"},"content":{"rendered":"<p><strong>\u25a0Scientific Linux 5.7\u3067mysqld\u8907\u6570\u8d77\u52d5\u8a2d\u5b9a<\/strong><br \/>\n\u3000\u57fa\u672c\u306fCentOS5\u7cfb\u3068\u540c\u3058\u306a\u306e\u3060\u304c\u3001\u7701\u7565\u3067\u304d\u306a\u3044\u624b\u9806\u304c\u3042\u308a\u305d\u306e\u307e\u307e\u3067\u306fmysqld_multi\u304c\u8d77\u52d5\u3067\u304d\u306a\u304b\u3063\u305f\u305f\u3081\u3001\u6539\u3081\u3066\u66f8\u3044\u3066\u304a\u304f\u3002CentOS\u3088\u308a\u3082\u81ea\u52d5\u3067\u51e6\u7406\u3057\u3066\u3082\u3089\u3048\u308b\u90e8\u5206\u304c\u5c11\u306a\u3044\u306e\u3067\u6ce8\u610f\u3002<\/p>\n<p><strong>\uff11\uff09\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6\u3059\u308b<\/strong><br \/>\n# cat \/etc\/my.cnf<\/p>\n<p>[client]<br \/>\n#password = your_password<br \/>\nport = 13306<br \/>\nsocket = \/var\/lib\/mysql1\/mysql.sock<br \/>\ndefault-character-set=utf8<\/p>\n<p>[mysqld_multi]<br \/>\nmysqld = \/usr\/bin\/mysqld_safe<br \/>\nmysqladmin = \/usr\/bin\/mysqladmin<br \/>\nuser = root<br \/>\npassword = rootpasswd<\/p>\n<p># The MySQL server<br \/>\n[mysqld1]<br \/>\nport = 13306<br \/>\nsocket = \/var\/lib\/mysql1\/mysql.sock<br \/>\npid-file = \/var\/lib\/mysql1\/host.pid<br \/>\ndatadir = \/var\/lib\/mysql1\/<br \/>\nskip-locking<br \/>\nkey_buffer = 96M<br \/>\nmax_allowed_packet = 3M<br \/>\ntable_cache = 128<br \/>\nsort_buffer_size = 1M<br \/>\nread_buffer_size = 1M<br \/>\nread_rnd_buffer_size = 4M<br \/>\nmyisam_sort_buffer_size = 64M<br \/>\nthread_cache_size = 8<br \/>\nquery_cache_size= 16M<br \/>\n# Try number of CPU\u2019s*2 for thread_concurrency<br \/>\nthread_concurrency = 8<br \/>\ndefault-character-set=utf8<br \/>\ncharacter_set_server=utf8<br \/>\nskip-federated<br \/>\nlog-bin=mysql-bin<\/p>\n<p>[mysqld2]<br \/>\nport = 13307<br \/>\nsocket = \/var\/lib\/mysql2\/mysql.sock2<br \/>\npid-file = \/var\/lib\/mysql2\/host.pid2<br \/>\ndatadir = \/var\/lib\/mysql2\/<br \/>\nskip-locking<br \/>\nkey_buffer = 96M<br \/>\nmax_allowed_packet = 3M<br \/>\ntable_cache = 128<br \/>\nsort_buffer_size = 1M<br \/>\nread_buffer_size = 1M<br \/>\nread_rnd_buffer_size = 4M<br \/>\nmyisam_sort_buffer_size = 64M<br \/>\nthread_cache_size = 8<br \/>\nquery_cache_size= 16M<br \/>\n# Try number of CPU\u2019s*2 for thread_concurrency<br \/>\nthread_concurrency = 8<br \/>\ndefault-character-set=utf8<br \/>\ncharacter_set_server=utf8<br \/>\nskip-federated<br \/>\nlog-bin=mysql-bin<\/p>\n<p>[mysqldump]<br \/>\nquick<br \/>\nmax_allowed_packet = 16M<\/p>\n<p>[mysql]<br \/>\nno-auto-rehash<\/p>\n<p>[isamchk]<br \/>\nkey_buffer = 128M<br \/>\nsort_buffer_size = 128M<br \/>\nread_buffer = 2M<br \/>\nwrite_buffer = 2M<\/p>\n<p>[myisamchk]<br \/>\nkey_buffer = 128M<br \/>\nsort_buffer_size = 128M<br \/>\nread_buffer = 2M<br \/>\nwrite_buffer = 2M<\/p>\n<p>[mysqlhotcopy]<br \/>\ninteractive-timeout<\/p>\n<p><strong>\uff12\uff09mysqld_multi\u3067\u8d77\u52d5\u3067\u304d\u308b\u3088\u3046\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5404datadir\u3067\u884c\u3046<\/strong><br \/>\n#\/usr\/bin\/mysql_install_db &#8211;user=mysql &#8211;datadir=\/var\/lib\/mysql1\/<br \/>\n#\/usr\/bin\/mysql_install_db &#8211;user=mysql &#8211;datadir=\/var\/lib\/mysql2\/<\/p>\n<p><strong>\uff13\uff09\u5404mysqld\u3092\u8d77\u52d5\u3057\u30d1\u30b9\u30ef\u30fc\u30c9\u8a2d\u5b9a\u3092\u884c\u3046<\/strong><br \/>\n# mysqld_multi start 1<br \/>\n# mysql &#8211;socket=\/var\/lib\/mysql1\/mysql.sock -u root<br \/>\nmysql> set password = password(&#8216;rootpasswd&#8217;);<br \/>\nmysql> quit<br \/>\n# mysqld_multi stop 1<br \/>\n# mysqld_multi start 2<br \/>\n# mysql &#8211;socket=\/var\/lib\/mysql2\/mysql.sock -u root<br \/>\nmysql> set password = password(&#8216;rootpasswd&#8217;);<br \/>\nmysql> quit<br \/>\n# mysqld_multi stop 2<\/p>\n<p><strong>\uff14)\u8d77\u52d5\u78ba\u8a8d\u3092\u884c\u3046<\/strong><br \/>\n# mysqld_multi start<br \/>\n# mysqld_multi stop<\/p>\n<p><strong>\u25a0php\u95a2\u9023\u306e\u8a2d\u5b9a\u65b9\u6cd5<\/strong><br \/>\nphp\u30a2\u30d7\u30ea\u306econfig.php\u3067\u306e\u8a2d\u5b9a\u4f8b<br \/>\n\u2018hostspec\u2019 => \u2018localhost:13306\u2032,<br \/>\n\u3000\u6a19\u6e96socket\u3067\u306a\u3044\u5834\u5408\u306b\u306f<br \/>\n\u2018hostspec\u2019 => \u2018localhost:\/var\/lib\/mysql2\/mysql.sock2\u2032,<\/p>\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u306f\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u7b49\u3082\u8003\u616e\u3057\u3066clients\u4ed63306\u3067\u904b\u7528\u304c\u671b\u307e\u3057\u3044<\/p>\n<p><strong>\u25a0\u8d77\u52d5script\u3092\u8a2d\u7f6e\u3059\u308b<\/strong><br \/>\n\u8d77\u52d5\u7528\u306b \/etc\/init.d\/\u306b\u4ee5\u4e0b\u306escript\u3092\u914d\u7f6e<\/p>\n<p># vi \/etc\/init.d\/mysqld_multi<br \/>\n&#8212;\u3053\u3053\u304b\u3089<br \/>\n# cat \/etc\/init.d\/mysqld_multi<br \/>\n#!\/bin\/sh<br \/>\n# Mysql daemon start\/stop script.<br \/>\n#<br \/>\n# Usually this is put in \/etc\/init.d (at least on machines SYSV R4<br \/>\n# based systems) and linked to \/etc\/rc3.d\/S99mysql and \/etc\/rc0.d\/S01mysql.<br \/>\n# When this is done the mysql server will be started when the machine is started<br \/>\n# and shut down when the systems goes down.<br \/>\n# Comments to support chkconfig on RedHat Linux<br \/>\n# chkconfig: 2345 90 90<br \/>\n# description: A very fast and reliable SQL database engine.<br \/>\n# The following variables are only set for letting mysql.server find things<br \/>\n# if you want to affect other MySQL variables, you should make your changes<br \/>\n# in the \/etc\/my.cnf or other configuration files<br \/>\nMYSQLDIR=\/usr<br \/>\nPATH=\/sbin:\/usr\/sbin:\/bin:\/usr\/bin:\/usr\/local\/bin:$MYSQLDIR\/bin<br \/>\nexport PATH<br \/>\n# See how we were called.<br \/>\ncase \u201c$1\u2033 in<br \/>\nstart)<br \/>\necho -n \u201cStarting mysqld: \u201c<br \/>\n$MYSQLDIR\/bin\/mysqld_multi start 1,2<br \/>\necho<br \/>\n;;<br \/>\nstop)<br \/>\necho -n \u201cShutting down mysqld: \u201c<br \/>\n$MYSQLDIR\/bin\/mysqld_multi stop 1,2<br \/>\necho<br \/>\n;;<br \/>\nstatus)<br \/>\n$MYSQLDIR\/bin\/mysqld_multi report 1,2<br \/>\n;;<br \/>\nrestart)<br \/>\n$0 stop<br \/>\n$0 start<br \/>\n;;<br \/>\n*)<br \/>\necho \u201cUsage: $0 {start|stop|restart|status}\u201d<br \/>\nexit 1<br \/>\nesac<br \/>\nexit 0<br \/>\n&#8211;\u3053\u3053\u307e\u3067<\/p>\n<p>\u4f5c\u6210\u3057\u305f\u3089\u5b9f\u884c\u6a29\u9650\u3092\u4e0e\u3048\u308b<br \/>\n# chmod +x \/etc\/init.d\/mysqld_multi<\/p>\n<p>\u5b9f\u884c\u53ef\u80fd\u304b\u52d5\u4f5c\u78ba\u8a8d\u3092\u3059\u308b<br \/>\n# service mysqld_multi start<br \/>\n# service mysqld_multi stop<\/p>\n<p><strong>\u25a0\u81ea\u52d5\u8d77\u52d5\u6642\u306e\u8a2d\u5b9a\u3092\u8ffd\u52a0<\/strong><br \/>\n\u5143\u3005\u306emysqld\u306f\u30aa\u30d5\u306b\u3001mysqld_multi\u3092\u30aa\u30f3\u306b<br \/>\nmysqld_multi \u306f\u30ea\u30b9\u30c8\u306b\u306a\u3044\u306e\u3067\u8ffd\u52a0\u3059\u308b<\/p>\n<p># chkconfig mysqld off<br \/>\n# chkconfig &#8211;add mysqld_multi<br \/>\n# chkconfig mysqld_multi on<\/p>\n<p>#ntsysv\u3000\u3067\u78ba\u8a8d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u25a0Scientific Linux 5.7\u3067mysqld\u8907\u6570\u8d77\u52d5\u8a2d\u5b9a \u3000\u57fa\u672c\u306fCentOS5\u7cfb\u3068\u540c\u3058\u306a\u306e\u3060\u304c\u3001\u7701\u7565\u3067\u304d\u306a\u3044\u624b\u9806\u304c\u3042\u308a\u305d\u306e\u307e\u307e\u3067\u306fmysqld_multi\u304c\u8d77\u52d5\u3067\u304d\u306a\u304b\u3063\u305f\u305f\u3081\u3001\u6539\u3081\u3066\u66f8\u3044\u3066\u304a\u304f\u3002CentO &hellip; <a href=\"https:\/\/blog.isnext.net\/issy\/archives\/1534\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Scientific Linux 5.7\u3067mysqld\u8907\u6570\u8d77\u52d5\u8a2d\u5b9a&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[24,123],"class_list":["post-1534","post","type-post","status-publish","format-standard","hentry","category-linux","tag-mysql","tag-scientific"],"_links":{"self":[{"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/posts\/1534","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/comments?post=1534"}],"version-history":[{"count":3,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/posts\/1534\/revisions"}],"predecessor-version":[{"id":1536,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/posts\/1534\/revisions\/1536"}],"wp:attachment":[{"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/media?parent=1534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/categories?post=1534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/tags?post=1534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}