{"id":79,"date":"2010-03-01T23:09:37","date_gmt":"2010-03-01T14:09:37","guid":{"rendered":"http:\/\/blog.isnext.net\/issy\/?p=79"},"modified":"2010-03-01T23:09:37","modified_gmt":"2010-03-01T14:09:37","slug":"mysqld%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\/79","title":{"rendered":"mysqld\u8907\u6570\u8d77\u52d5\u8a2d\u5b9a"},"content":{"rendered":"<p># cat \/etc\/my.cnf<\/p>\n<p>[client]<br \/>\n#password       = your_password<br \/>\nport            = 3306<br \/>\nsocket          = \/var\/lib\/mysql\/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\/mysql\/mysql.sock<br \/>\npid-file        = \/var\/lib\/mysql\/host.pid<br \/>\ndatadir = \/var\/lib\/mysql\/<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&#8217;s*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&#8217;s*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># mysqld_multi start<br \/>\n# mysqld_multi stop<\/p>\n<p>php\u30a2\u30d7\u30ea\u306econfig.php\u3067\u306e\u8a2d\u5b9a\u4f8b<\/p>\n<p>    &#8216;hostspec&#8217; => &#8216;localhost:13306&#8217;,<br \/>\n\u3000\u6a19\u6e96socket\u3067\u306a\u3044\u5834\u5408\u306b\u306f<br \/>\n    &#8216;hostspec&#8217; => &#8216;localhost:\/var\/lib\/mysql2\/mysql.sock2&#8217;,<\/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<\/p>\n<p>\u8d77\u52d5\u7528\u306b \/etc\/init.d\/\u306b\u4ee5\u4e0b\u306escript\u3092\u914d\u7f6e<\/p>\n<p># cat \/etc\/init.d\/mysqld_multi<br \/>\n#!\/bin\/sh<\/p>\n<p># Mysql daemon start\/stop script.<br \/>\n#<\/p>\n<p># 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.<\/p>\n<p># Comments to support chkconfig on RedHat Linux<br \/>\n# chkconfig: 2345 90 90<br \/>\n# description: A very fast and reliable SQL database engine.<\/p>\n<p># 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<\/p>\n<p>MYSQLDIR=\/usr<br \/>\nPATH=\/sbin:\/usr\/sbin:\/bin:\/usr\/bin:\/usr\/local\/bin:$MYSQLDIR\/bin<br \/>\nexport PATH<\/p>\n<p># See how we were called.<br \/>\ncase &#8220;$1&#8221; in<br \/>\nstart)<br \/>\necho -n &#8220;Starting mysqld: &#8221;<br \/>\n$MYSQLDIR\/bin\/mysqld_multi start 1,2<br \/>\necho<br \/>\n;;<br \/>\nstop)<br \/>\necho -n &#8220;Shutting down mysqld: &#8221;<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 &#8220;Usage: $0 {start|stop|restart|status}&#8221;<br \/>\nexit 1<br \/>\nesac<\/p>\n<p>exit 0<\/p>\n<p>\u8d77\u52d5\u6642\u306e\u8a2d\u5b9a\u3092\u8ffd\u52a0<br \/>\n\u5143\u3005\u306emysqld\u306f\u30aa\u30d5\u306b\u3001mysqld_multi\u3092\u30aa\u30f3\u306b<\/p>\n<p># checkconfig mysqld off<br \/>\n# checkconfig mysqld_multi on<\/p>\n<p>#ntsysv\u3000\u3067\u78ba\u8a8d<\/p>\n","protected":false},"excerpt":{"rendered":"<p># cat \/etc\/my.cnf [client] #password = your_password port = 3306 socket = \/var\/lib\/mysql\/mysql.sock default-ch &hellip; <a href=\"https:\/\/blog.isnext.net\/issy\/archives\/79\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;mysqld\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":[16,24],"class_list":["post-79","post","type-post","status-publish","format-standard","hentry","category-linux","tag-db","tag-mysql"],"_links":{"self":[{"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/posts\/79","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=79"}],"version-history":[{"count":1,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/posts\/79\/revisions"}],"predecessor-version":[{"id":80,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/posts\/79\/revisions\/80"}],"wp:attachment":[{"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/media?parent=79"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/categories?post=79"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.isnext.net\/issy\/wp-json\/wp\/v2\/tags?post=79"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}