Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
ããã«ã¡ã¯ããã£ããç§ã§ããï¼@yone098 ã§ãã ã¿ãªããDBã®è¨è¨ãã¦ã¾ããï¼ DBè¨è¨æã®ãµã¤ãºè¦ç©ã 以åã¯ã¦ãªãã¤ã¢ãªã¼ã§æ¸ããè¨äºã¯5å¹´åã®ãã®ã§ããããªã³ã¯ãåãã¦ãããã®ãããã®ã§ææ°çã¨ã㦠MySQL, PostgreSQL, Oracle, SQLServer ã«ãããDBè¨è¨æã®ãµã¤ãºè¦ç©ããã¾ã¨ãç´ãã¾ããã MySQL URLå ã®ãã¼ã¸ã§ã³è¡¨è¨ãå¤ããã¨ä»¥åã®ãã¼ã¸ã§ã³ã®æ å ±ã«ãªãã¾ãã MySQLã¯ããã¾ãæ å ±ã«å¤åã¯ç¡ãã£ãã®ã§ Excel ã§ãã¯ããªã©ãä½æãã¦èªç¤¾ã§èªåç®åºåºæ¥ãããã«ããã®ãè¯ãã¨æãã¾ãã ãã¼ã¿ã¿ã¤ããã¨ã«å¿ è¦ãªè¦æ±ã¹ãã¬ã¼ã¸ã決ã¾ã£ã¦ããã®ã§ã¬ã³ã¼ããµã¤ãºã決ã¾ãããã¨ã¯è¦ä»¶æ¬¡ç¬¬ã§ä½ã¬ã³ã¼ãã«ãªãããäºæ¸¬ãã¾ãã ãã¼ã¿ã¿ã¤ããã¨ã«å¿ è¦ãªè¨æ¶å®¹é ãã¼ãã«ã®æ大ãµã¤ãºé¢é£ http://dev.mysql.com/doc/re
â»ä»¥åå¥ã®å ´æã§æ¸ããæç« ãåå¿çã«æ¸ãè¨ãã¦ããã¾ãã 売ä¸ãæ¥æå¥ã«éè¨ãããéãã©ããã£ã¦ã°ã«ã¼ãåããã°ãããã¡ãã£ã¨æ©ãã§ããã¨ãããMysqlã®ããã¥ã¢ã«ãè¦ãé端ã«ãã£ãã解決ãDATE_FORMATé¢æ°ã使ã£ã¦æ¥ä»ãã¼ã¿ãå å·¥ããã°ï¼¯ï¼«ã§ããã åå¿çã«å ·ä½ä¾ãè¨è¼ãã¦ããã¾ããï¼â»æ¥æãæ ¼ç´ãã¦ãããã£ã¼ã«ããtimeãã®åã¯datetimeï¼ //ãå¹´å¥ã«éè¨ã SELECT id, DATE_FORMAT(time,'%Yå¹´') as time1 FROM table1 GROUP BY time1 //ãæå¥ã«éè¨ã SELECT id, DATE_FORMAT(time,'%Yå¹´%mæ') as time2 FROM table1 GROUP BY time2 //ãæ¥å¥ã«éè¨ã SELECT id, DATE_FORMAT(time,'%Yå¹´%mæ%dæ¥') a
DBæä½ãã¼ã« Emacs DBI ãä½ã£ã¦ã¿ã - æè¡æ¥è¨ï¼ kiwanami ãã®ãã¼ã«ã®ç®çã¯ãã¯ãã¹ãã©ãããã©ã¼ã ã§ä¾¿å©ãªDBæä½ç°å¢ãå®ç¾ãããã¨ã§ãã pgAdmin ã MySQL Query Browser ã®ãããªGUIã®è¯ããCUIã§å®ç¾ãã¦ã¿ããã¨ãã¦ã¿ã¾ãããããªãã¡ãã¼ãã®ããããããããããã®DBãã¼ã«ã§ããã¡ãªã¿ã«ããã®ãã¼ã«ã«ã¨ã£ã¦Emacsã¯ãã ã®å®è¡ç°å¢ã§ããEmacs使ããªã人ã§ã使ãã¨ä¾¿å©ã ã¨æãã¾ãã http://d.hatena.ne.jp/kiwanami/20120305/1330939440 Vimãã¼Vimãã¼ï¼ ã£ã¦äºã§ä½ãã¾ããã mattn/vdbi-vim - GitHub Database client for Vim https://github.com/mattn/vdbi-vim Emacsçã¯epcã¨ããRPCããã
ã¬ããªã±ã¼ã·ã§ã³ã¯MySQLã§æããã使ãããæ©è½ã®ã²ã¨ã¤ã ãã¬ããªã±ã¼ã·ã§ã³ã¯åºæ¬çã«éåæã§ãã¼ã¿ã®è¤è£½ãè¡ãä»çµã¿ã«ãªã£ã¦ããã®ã ããéåææ ã«ã©ããã¦ãéããããªãåé¡ãããããã®ã²ã¨ã¤ãä»åã®ãã¼ããé 延ã§ãããã¨ããã¨ãMySQLã®ã¬ããªã±ã¼ã·ã§ã³ã¯ããã«é 延ãçãã¦ãã¾ãããã«æãã¦ãã¾ãããç¥ããªããããã®ãããªãã¨ã¯ãªããã»ã¨ãã©ã®å ´åã¯å³åº§ã«ã¹ã¬ã¼ãã®æ´æ°ãè¡ãããã ãªãé 延ã¯çºçããã®ããã©ã®ããã«é 延ãèµ·ãã¦ãããã¨ã調ã¹ãã®ããã©ã®ããã«åé¿ããã®ãã¨ãããã¨ãæ¬ã¨ã³ããªã§ã¯è§£èª¬ãããããã¾ãé 延ã¨ä»ãåã£ã¦ãMySQLã®ã¬ããªã±ã¼ã·ã§ã³ãããå¿«é©ã«éç¨ãã¦ããããã°ã¨æãã ããããé 延ã¨ã¯ä½ãMySQLã®ã¬ããªã±ã¼ã·ã§ã³ã¯éåæã§è¡ããããããã¯æºåæã§ãåãã§ãããã¹ã¬ã¼ãã«ããã¦æ´æ°ãèµ·ããã®ã¯ãã¹ã¿ã¼ãããä¸ç¬é ãã¦ãã¾ããããã¯éåæã§ãããæ ã«éã
Jaslabs: High performance phpã§MySQL ã®ã¯ã¨ãªãæé©åããããã®10ã®Tipsãå ¬éããã¦ãã¾ããexplainãå©ç¨ããä¸è¬çãªæ¹æ³ãããSELECTã»INSERTã®ã¯ã¨ãªãªãã·ã§ã³ã使ç¨ãããããªæ¹æ³ã¾ã§ç´¹ä»ããã¦ãã¾ããMySQLã¯ã¨ãªã®é度ä½ä¸ã«ãæ©ã¿ã®æ¹ã¯ä¸åº¦èªãã§ã¿ãã¨ããã§ãããã Jaslabs: High performance phpã§MySQL ã®ã¯ã¨ãªãæé©åããããã®10ã®Tipsãå ¬éããã¦ãã¾ããexplainãå©ç¨ããä¸è¬çãªæ¹æ³ãããSELECTã»INSERTã®ã¯ã¨ãªãªãã·ã§ã³ã使ç¨ãããããªæ¹æ³ã¾ã§ç´¹ä»ããã¦ãã¾ããMySQLã¯ã¨ãªã®é度ä½ä¸ã«ãæ©ã¿ã®æ¹ã¯ä¸åº¦èªãã§ã¿ãã¨ããã§ãããã 1. explainã³ãã³ãã®ä½¿ç¨ explainã³ãã³ãã¯ã¯ã¨ãªã§ã©ã®ã¤ã³ããã¯ã¹ãæå®ããã¦ããã®ãããªã©ã®æ å ±ãåå¾ã§ãã¾ãã e
http://mysql-casual.org/2011/11/mysql-casual-advent-calendar-2011.html ã®6æ¥ç®ã®è¨äºã¨ãã¦æ¸ããã¦ããã ãã¾ããsugyanã§ãã å¢ãã§åå 表æãã¦ãã¾ããä»æ¥æ ã¦ã¦ä¹ ãã¶ãã«MySQLã触ãã¾ããã MySQLã§FizzBuzz ã¹ãã¢ãããã·ã¼ã¸ã£ã£ã¦ä½¿ã£ããã¨ç¡ãã£ãã®ã§åãã¦è§¦ã£ã¦ã¿ã¾ããã DROP PROCEDURE IF EXISTS FizzBuzz; delimiter // CREATE PROCEDURE FizzBuzz(n INT) BEGIN DECLARE i INT DEFAULT 1; WHILE i <= n DO SELECT CASE WHEN i % 3 = 0 AND i % 5 = 0 THEN 'FizzBuzz' WHEN i % 5 = 0 THEN 'Buzz'
ããã£ãï¼DBA å ¼ãªãã¬ã¼ã·ã§ã³ã¨ã³ã¸ãã¢å ¼ã¿ã¹ã¯ããã¼ã¸ã£ãã£ã¦ã riywo ã§ããä½ã®ãã¿ãæ¸ããããªãã¨èããã®ã§ãããæ£ç´ãã¿ãä»è¾¼ãæéããªãã£ãã®ã§åããã¤ããã£ã¦ããã¨ãããã£ã¨ç´¹ä»ããã¨ãããã¨ã§åå¼ãã¦ä¸ããï¼ï¼ MySQL ãããããï¼ 03:14 hidek: ãªããã¨ã©ã¼åºã¾ãã£ã¦ããã ãã©ï¼ 03:14 zigorou: MySQL ã¨éä¿¡ãã¦ãã¨ãã£ã½ã 03:15 riywo: è¦ã¾ã ãããªããã¨ãã¯çããæ¥å¸¸è¶é£¯äºã§ãããï¼ãï¼ãï¼ãããªæã«ãDB ã«è²¬ä»»ãæã¤ãã®ã¨ãã¦çã£å ã«å¯¾å¿ããã®ãåãã®ä»äºã§ããã§ãããããå ·ä½çã«ãã®ãã¨ä½ããã¾ãããï¼æ¢ã«ãµã¼ãã¹ã¯ã¨ã©ã¼ã ããã§ä¸å»ãäºãç¶æ ã§ãã (対å¿éå§) ã¾ãã¯ã¨ã©ã¼ã¡ãã»ã¼ã¸ ä»åã®æ§ãªå ´åã¯ã¢ããªã®ã¨ã©ã¼ãã°ã«ã©ã°ã£ã¨ MySQL ã«é¢ããã¨ã©ã¼ãåºã¦ããã§ããããã¾ãã¯ãããè¦ããã¨ãå§ã¾
MySQLããã¦ã³ããã¨ãã«èªåçã«å¥ã®MySQLã¸å¦çãå¼ãç¶ããã¨ã§ãé«å¯ç¨æ§ãå®ç¾ãããã§ã¤ã«ãªã¼ãã¼ãã¼ã«ãMySQL-MHA: MySQL Master High Availability manager and toolsãããªã¼ãã³ã½ã¼ã¹ã¨ãã¦å ¬éããããã¨ããä½è ã®æ¾ä¿¡åç¯ï¼ã¾ã¤ã®ã¶ããã®ãï¼æ°ãããã°ã§ä¼ãã¦ãã¾ãã Yoshinori Matsunobu's blog: Announcing MySQL-MHA: "MySQL Master High Availability manager and tools" æ¾ä¿¡æ°ã¯ã¢ãã²ã¼ãªã©ã§ç¥ãããDeNAã«å¤åãã¦ãããMySQL-MHAã«ããèªåãã§ã¤ã«ãªã¼ãã¼æ©è½ã¯DeNAã®ã¤ã³ãã©éç¨ãæ¯ãã¦ããã¨ã®ãã¨ãåæ°ã®ããã°ããå¼ç¨ãã¾ãã Difficulties of master failover is one of
MySQLã¢ã¯ã»ã¹ãè² è·åæ£ãã ã¦ã¼ã¶ã¼ããã®ã¢ã¯ã»ã¹æ°ãé常ã«å¤ãWebãµã¤ãã«ããã¦ãMySQLã®SLAVEãµã¼ãã¼ãè¤æ°å°ä¸¦ã¹ã¦è² è·åæ£ãããã¨ãããã¨ãããè¡ããã¦ãã¾ãããã ãWebã¢ã¯ã»ã¹ã®è² è·åæ£ã¯ä¸è¬çãªãã¼ããªã®ã§ãããããªã¨ããã§èªããã¦ããã®ã«å¯¾ããDBã¢ã¯ã»ã¹ã®è² è·åæ£ã¨ãããã¼ãã¯ä¸è¬çã§ãªãã®ããã¾ãèªããã¦ããªãããã«æãã¾ãã DBã¢ã¯ã»ã¹ãè² è·åæ£ããã«ããã£ã¦ä¸çªèã£ã½ãæ¹æ³ã¯ãWebãµã¼ãã¼ä¸ã®ããã°ã©ã ã®ä¸ã§ã©ã®SLAVEãµã¼ãã¼ã«æ¥ç¶ããããã©ã³ãã ã§æ±ºããæ¹æ³ã§ããã©ã³ãã ã¨è¨ã£ã¦ãé·æéã¢ã¯ã»ã¹ãã¦ããã¨ã»ã¼æ¥ç¶å ãåçåãããã®ã§ãä¸è¦ãã®æ¹æ³ã§ãåé¡ãªãããã«è¦ãã¾ããããããã®æ¹æ³ã ã¨ãæ¥ç¶ãã«è¡ããã¨ããSLAVEãµã¼ãã¼ãé«è² è·ãããã¯ãµã¼ãã¹åæ¢ä¸ã§ãã£ã¦ãæ§ããæ¥ç¶ãã«è¡ã£ã¦ãã¾ãã¨ããåé¡ãããã¾ãã ãã®ãããªåé¡ã解決ãã
ä¸æ¹ã§ãWebãµã¼ãã¹ç³»ãªã©ã§è«çè¨è¨ã¨ç©çè¨è¨ãããä¸ç·ããã«ãã£ã¦ãããããªå ´åã¯ã æ£è¦åã®è«çã«ç®ã®åã«ãããµãã²ã¼ããã¼ãå«ããªãããã«ãããã¨ã大åã§ãã¢ããªã³ã°ã¯ããã¥ã©ã«ãã¼ãåºè»¸ã«èãã¦ããã¨ããã§ãããã ãµãã²ã¼ããã¼ (代çãã¼) ãµãã²ã¼ããã¼ + (è¤å)ã¦ãã¼ã¯å¶ç´ ããã¥ã©ã«ãã¼ãPKã«ãããä¾ãã°é£çªã¨ãªããããªã«ã©ã ãç¨æãã¦ããããPKã«ãã¾ãã ããããµãã²ã¼ããã¼ã¨è¨ããããã®ã§ãããããã¥ã©ã«ãã¼ã«ã¯å¥éã¦ãã¼ã¯å¶ç´ãä»ä¸ãã ã¨ããã®ãå¿ãã¦ã¯ããã¾ããã ããã§ã¯ãããã¥ã©ã«ãã¼ã«ã¦ãã¼ã¯å¶ç´ãä»ããã«ãµãã²ã¼ããã¼ã ããå°å ¥ããæ¹å¼ã¯ãæ¥åçã»å®è£ çã«æå³ã¯ãªãã¨èããããã§ã¯åãæ±ãã¾ããã è°è«ã®å¯¾è±¡ã«ãããã¾ãããã¦ãã¼ã¯å¶ç´ãä»ãããã¨ã§æ¥åçãªã¦ãã¼ã¯æ§ãä¿ã¡ã¤ã¤ãµãã²ã¼ããã¼ã®æ©æµãå¾ããã¨ãã§ããåæã«ããã¥ã©ã«ãã¼ãæ示ãã
MySQLã®masterã¨slave 1:1ã«ãã¦åç §ãslaveåããã®ã£ã¦ããããã人å¤ãã¿ããã ãã©ãæ§è½ãããã¦ä¸ãããªãå²ã«å¯ç¨æ§è½ã¡ãã ãã ãããããããã£ã³ãã¼ã³ 2011-06-19 00:16:30 via YoruFukurou MySQL ã¯ã¬ããªã±ã¼ã·ã§ã³ãç°¡åã«æ§æã§ããã®ã§ãããææ master 1å° ã«å¯¾ã㦠slave 1å°ãæ´æ°å¦ç㯠master ã«ãåç §ã¯ slave ã«ãã¨ããæ§æãç®ã«ãã¾ãã å人çã«ã¯ãã®æ§æã¯ãå§ãã§ãªãã¨æã£ã¦ããã®ã§ããã®çç±ãèå¯ãã¦ã¿ã¾ãã 1. å¯ç¨æ§ãè½ã¡ã å½ç¶ã§ãããmaster, slave ã®ã©ã¡ããè½ã¡ã¦ãå½±é¿ãåããããã«å¯ç¨æ§ãä½ä¸ãã¾ãã 2. å ¨ä½ã®æ§è½ãã»ã¨ãã©ä¸ãããªã master 1å°ã§ãã¹ã¦ã®ã¯ã¨ãªãå¦çããå ´åã¨æ¯ã¹ã¦ãå¯ç¨æ§ãè½ã¡ãå¼ãæãã¨ãã¦è¦åã£ãæ§è½åä¸ãå¾ãããããã¨ãã
OSC 2011 Hokkaidoã®çºè¡¨ã§ä½¿ç¨ããã¹ã©ã¤ãè³æã§ãã å¼ç¤¾ãããã©ã¦ã¶ä¸å½å¿ãããè±éã¯ã¨ã¹ããã¨ãã£ãã²ã¼ã ããPHPï¼MySQLã§æ§ç¯ãã¦ããä¸ã§ã身ã«ã¤ãããã¦ãã¦ãã注æãã¹ãç®æãæéãªã©ãã¾ã¨ããè³æã¨ãªã£ã¦ãã¾ããRead less
ã¯ããã« PHPã«ã¯ãã¼ã¿ãã¼ã¹ã«ã¢ã¯ã»ã¹ããæ¹æ³ãããã¤ãç¨æããã¦ãã¾ãããã®ãããªæ¹æ³ã®ä¸ã¤ã«ããPEAR MDB2ããããã¾ããååã®éãPEARã®ã©ã¤ãã©ãªã¨ãã¦å ¬éããã¦ãã¾ããPEARã«ã¯MDB2ã®ã»ãã«ãDBãããMDBãã¨ãã£ãã©ã¤ãã©ãªããããç¾å¨ã§ãå©ç¨ãããã¨ãã§ãã¾ããããããªããããããã®éçºã¯ãã§ã«çµäºãã¦ãããéçºè ã¯MDB2ã«ç§»è¡ãããã¨ãæ¨å¥¨ããã¦ãã¾ãã æ¬ç¨¿ã§ã¯ãPEAR MDB2ã使ã£ã¦ãPHPãããã¼ã¿ãã¼ã¹ãæä½ãã次ã®ãããªåºæ¬çãªæ¹æ³ãç´¹ä»ãã¾ãã PEAR MDB2ã使ãã¨ãã¼ã¿ãã¼ã¹ç®¡çã·ã¹ãã ï¼MySQLãPostgreSQLãSQLiteçï¼ã«ä¾åããªãã³ã¼ããæ¸ããã¨ãã§ããã SQLã®å®è¡ã«ã¯ãããªãã¢ã¼ãã¹ãã¼ãã¡ã³ãã使ãã®ãåºæ¬ã§ããï¼ä¾å¤ããï¼ã PHPã«ã¯PEAR MDB2ã®ä»ã«ããã¼ã¿ãã¼ã¹ã¸ã®ã¢ã¯ã»ã¹æ段ãæ°å¤ãç¨
éåã¨æ´æ°ã空ãã¦ãã¾ã£ããããåªããMySQL DBAãè¦åãã27+3ã®è³ªåãã«å¯¾ããåçä¾ï¼æ¼¢ãã¼ã¸ã§ã³ï¼ãç´¹ä»ããããå®ã¯è³ªåãæ²è¼ããéãé£ããï¼ãã¨ããã³ã¡ã³ããé常ã«å¤ããããå°ãæãã質åã«ããã¹ãã ã£ããã¨æã£ã¦æ¬¡ã®ããã«åãã¦ã¿ãã®ã ãã»ã»ã» é常ã«å¿å¼·ãã¦å®å¿ããããããã«æ¥æ¬ã代表ããMySQLã®ã¨ãã¹ãã¼ãã§ãããåºé¡ã®ã¬ãã«ã¯ééã£ã¦ã¯ããªãã£ãï¼ï¼ ãããªããã§ãåçã®æ¹ã«ç§»ããã MySQLã®ãµã¼ãã¼ããã»ã¹ã¯ããã¤ããï¼ã²ã¨ã¤ãmysqldã¯ã·ã³ã°ã«ããã»ã¹ã»ãã«ãã¹ã¬ããã¢ãã«ãæ¡ç¨ãã¦ããã®ã§ã"ãµã¼ãã¼"ããã»ã¹ã¯ã²ã¨ã¤ã§ãããå¤ãã®å ´åãLinuxãªã©ã§mysqldãåããå ´åã«ã¯ããä¾ã«mysqld_safeã常ã«åãã¦ãããã¨ãå¤ãããmysqld_safeã¯ãµã¼ãã¼ã§ã¯ãªããmysqldã®ããã®ã©ããã¼ã§ããã®ã§æ°ã«ã¯å«ããªãã rootã¦ã¼
ã½ã¼ã·ã£ã«ã²ã¼ã éçºè ãªãç¥ã£ã¦ãããã MySQL INDEX + EXPLAINå ¥é åºãæµ ããæ å½ãã¦ã¾ããota ã§ãã æè¡ããã°ç¬¬ä¸åããæ©éæµç¨ã¹ã©ã¤ãã§ç³ã訳ããã¾ãããã社å åå¼·ä¼è³æã¨ãã¦ä½æãããMySQL INDEX + EXPLAINå ¥éãã§ãã å½ç¤¾ã§ãã½ã¼ã·ã£ã«ã²ã¼ã ã®éçºãè¡ã£ã¦ãã¾ããããã®ãããªå¤§éã®ãã¼ã¿ã使ç¨ããã»ã¯ã¨ãªã®é度ãæ±ããããå ´åã«ã¤ã³ããã¯ã¹ã¯å¤§å¤éè¦ã§ãã ã¤ã³ããã¯ã¹ã®æå¹ãªå©ç¨ã«ã¯DBè¨è¨è ã ãã§ã¯ãªãããã°ã©ãã«ãããç¨åº¦ã®ç¥èãæä½éå¿ è¦ã¨ãªãã¾ãããã¤ã³ããã¯ã¹ã«ã¤ãã¦ã®åå¿è åãè³æããã¾ããªãããã§ãã ãã®ã¹ã©ã¤ãã§ã¯ããã°ã©ãã«ç¥ã£ã¦ããã¦æ¬²ãã以ä¸ã®åºæ¬çãªç¹ãã¾ã¨ãã¾ããã INDEXã使ç¨ããæã«æ°ãã¤ããã㨠WHEREå¥ !=ã<>ã¯ã¤ã³ããã¯ã¹ã使ç¨ã§ããªã WHEREå¥ã®å ¨ã¦ã®ANDã«ããã£ã¦ããªãã¤ã³
CentOSã«myphpadminãã¤ã³ã¹ãã¼ã«ããã¨ããã ã¨ãªã # rpm -q php-mysql ã¨ããã¨ã ããã±ã¼ã¸ php-mysql ã¯ã¤ã³ã¹ãã¼ã«ããã¦ãã¾ããã ã¨ã ã¯ããã§ã¯php-mysqlãã¤ã³ã¹ãã¼ã«ãããã # yum -y install php-mysql ãããã Loaded plugins: downloadonly, fastestmirror Loading mirror speeds from cached hostfile * base: ftp.iij.ad.jp * updates: ftp.iij.ad.jp * addons: ftp.iij.ad.jp * extras: ftp.iij.ad.jp Setting up Install Process Parsing package install arguments Reso
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}