mysqld_multiã®ã¯ããæ¹
ä¸å°ã®PCã§è¤æ°ã®mysqldãç«ã¡ä¸ãããã¨ãã«ä¾¿å©ãªmysqld_multiã®è§£èª¬ã§ãã
mysqlã¯ã¬ããªã±ã¼ã·ã§ã³ã®ãã¹ã¿ã¼ãdaemonãã¨ã«ããæå®ã§ããªãã®ã§ãéããã¹ã¿ã¼ãåç
§ãã¦ããã¹ã¬ã¼ããåãPCã§æ§ç¯ãããæãªã©ã«ä¾¿å©ã§ãã
è¨å®æ¹æ³
/etc/my.cnfã次ã®ãããªæãã«å¤æ´
[mysqld_multi] mysqld = /usr/bin/mysqld_safe mysqladmin = /usr/bin/mysqladmin user = multi_admin password = XXXXXXX [mysqld] user=mysql [mysqld1] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock pid-file=/var/run/mysqld/mysqld.pid log-error=/var/log/mysqld.log slave-skip-errors=1062,1064 server-id=1721602 [mysqld2] port = 3307 datadir=/var/lib/mysql2 socket=/var/lib/mysql2/mysql.sock pid-file=/var/run/mysqld/mysqld2.pid log-error=/var/log/mysqld2.log slave-skip-errors=1062,1064 server-id=17216012
解説
- [mysqld1] ã®ããã«æ«å°¾ã«çªå·ãä»ãã¦ããã¨ããããããããã®mysqldã¤ã³ã¹ã¿ã³ã¹ã®è¨å®ã«ãªãã¾ãã
- [mysqld] ã«ã¯å ±éã®è¨å®ãããã¾ãã
[mysqld_multi] user = multi_admin password = XXXXXX
ãã®é¨åã¯mysqlã§ã®ã¦ã¼ã¶ã¼ãæå®ãã¦ãã¦ãunixã®ã¦ã¼ã¶ã¼ã§ã¯ããã¾ããã
ãã®ã¦ã¼ã¶ã¼ããå®éã®mysqlã¤ã³ã¹ã¿ã³ã¹ã®ã·ã£ãããã¦ã³ãè¡ãã®ã§ GRANT ã®è¨å®ãå¿
è¦ã§ãã以ä¸ã®ã³ãã³ãã§é©åã«GRANTãæå®ãã¦ä¸ããã
mysql> GRANT SHUTDOWN ON *.* TO multi_admin@localhost IDENTIFIED BY 'XXXXXXX'
ä¸ã®è¨å®ã ã¨ãäºã¤ç®ã®mysqld㯠/var/lib/mysql2 以ä¸ã«ãã¼ã¿ãç½®ãã®ã§ãããããã«mysqlèªä½ã®æ å ±( 'mysql'ãã¼ã¿ãã¼ã¹ )ããªãã¨ãããããäºã¤ç®ã® mysql ãèµ·åãã¾ããã
ãªã®ã§
sudo mysql_install_db --datadir=/var/lib/mysql2
ã¨ã㦠mysql ã®åæåããã¦ããã¾ãã
ããã¾ã§ã§ããã°
$ sudo mysqld_multi start
ã§ãµã¼ãã¼ãèµ·åãã¾ã `ps aux | grep mysql` ãªã©ã§äºã¤ã®ãµã¼ãã¼ãèµ·åãã¦ãããã¨ã確èªãã¾ãããã
ãã¾ãèµ·ååºæ¥ã¦ããªãæã¯ãmy.cnf ã§æå®ããããããã®ãã°ãã¡ã¤ã«ã確èªãããã /usr/shara/mysqld_multi.log ã
確èªããã¨è¯ãã§ãããã