MySQL µ¥ÀÌÅͺ£À̽º ¼¹ö
¿ä¾à:
MySQLÀº SQL(Structured Query Language:±¸Á¶Àû ÁúÀǾî) database serverÀÌ´Ù.
¸®´ª½º¸¦ Æ÷ÇÔÇÑ ¸¹Àº Ç÷§ÆûÀ» Áö¿øÇÏ°í, ƯÈ÷ ¸®´ª½º ¹öÀüÀº ¼öÇà ¼Óµµ°¡ ¸Å¿ì ºü¸£´Ù.
µé¾î°¡´Â ±Û
MySQLÀº SQL(Structured Query Language:±¸Á¶Àû ÁúÀǾî) database serverÀÌ´Ù.
MySQLÀº client-server ÀÀ¿ë ÇÁ·Î±×·¥À¸·Î¼ ¼¹ö¿Í ¸¹Àº client·Î ±¸¼ºµÇ¾î ÀÖ´Ù.
SQL database¿¡ ´ëÇؼ ¼³¸íÀ» ÇÏ´Â °ÍÀº ¸Å¿ì º¹ÀâÇÑ ÀÏÀÌ´Ù.
°ü°èÇü µ¥ÀÌŸ º£À̽ºÀÇ À¯·¡ºÎÅÍ ¼³¸íÀ» ÇؾßÇÒ »Ó¸¸ ¾Æ´Ï¶ó ÀÌ°ÍÀº
ÀÌ ±ÛÀÇ ¸ñÀûÀÌ ¾Æ´Ï´Ù. µû¶ó¼ SQL ¼¹ö¿¡ ´ëÇؼ °£´ÜÈ÷ »ìÆ캸°Ú´Ù.
1981³â¿¡ IBMÀº SQLÀ» °³¹ßÇÏ¿´´Ù. ±× ÀÌÈÄ SQLÁ¦Ç°Àº °ü°èÇü µ¥ÀÌŸ º£À̽º¿¡¼
°¡Àå ±âÃÊÀûÀÎ ¿ªÇÒÀ» ´ã´çÇÏ°Ô µÇ¾ú´Ù. IBMÀº SQL(´õ µÚ¿¡ äÅõǾú´Ù)À» American
National Standards Institute(ANSI;¹Ì±¹Ç¥ÁØÀ§¿øȸ)¿¡ Á¦ÃâÇÏ¿´°í, ±× ÈÄ °ü°èÇü
µ¥ÀÌŸ º£À̽º¿¡¼ ÀϹÝÈ µÇ¾ú´Ù. 1983³â¿¡ ¸¸µé¾îÁø DB2´Â ÀαâÀÖ´Â database°¡
µÇ¾ú°í, Áö±Ý±îÁöµµ ¸¹Àº ¸ÞÀÎÇÁ·¹ÀÎ±Þ ÄÄÇ»ÅÍ¿¡¼ ³Î¸® ¾²ÀÌ°í ÀÖ´Ù.
º¸Åë GNU¿¡¼ °ü°èÇü database¿¡ ´ëÇÑ ¿¹±â¸¦ ÇÒ ¶© MySQLÀ» ¾ê±âÇÑ´Ù.
MySQLÀº GNU Çü½ÄÀÇ ¶óÀ̼¾½º¸¦ °¡Áö°í ÀÖÁö ¾Ê±â ¶§¹®¿¡, º¸Åë ¸®´ª½º ¹èÆ÷ÆÇ¿¡´Â
Æ÷ÇԵǾî ÀÖÁö ¾Ê´Ù. Áï MySQLÀ» »ó¾÷Àû ¸ñÀûÀ¸·Î ÀÌ¿ëÇÏ·Á¸é ¶óÀ̼¾½º°¡ ÇÊ¿äÇÏ´Ù.
MySQLÀº (ÀÌ ±Û¿¡¼µµ ¾ð±ÞÇß´Ù½ÃÇÇ) µ¿±ÞÀÇ ¼¹ö¿Í ºñ±³ÇßÀ» ¶§ ¸Å¿ì ºü¸£°í,
µ¥ÀÌÅÍÀÇ ¾çÀÌ Å©°Å³ª À۰ųª ¸Å¿ì ¾ÈÁ¤ÀûÀÌ´Ù. µÚ¿¡¼ ¸»ÇÏ°ÚÁö¸¸, ó¸® ¼Óµµ°¡
ºü¸¥ °ÍÀº SQLÀÇ ÀϹÝÀûÀÎ ¸î°¡Áö Ư¡À» ¾ø¾Ö¼ ±×·¸´Ù.
MySQLÀº (¼Ò½ºµç ¹ÙÀ̳ʸ®µç) Linux 2.0.x, SCO, Solais 2.5, 2.6,
SunOS 4.x, BSDI 2.x, 3.0, SGI IRIX 6.x, AIX 4.x, DEC UNIX 4.x,
HPUX 1020, Windows 95, µî °ÅÀÇ ¸ðµç OS¿¡¼ »ç¿ëÇÒ ¼ö ÀÖ´Ù.
ÀÚÀ¯·Ó°Ô ¹«·á·Î ÀÌ¿ëÇÒ ¼ö ÀÖ´Â ¹öÀüÀº Michael Windenis°¡ ¸¸µé¾ú°í,
»ó¿ë ¹öÀüÀº TCX Datakonsulter AB¿¡ ÀÇÇØ ¹èÆ÷µÈ´Ù.
MySQLÀÇ Æ¯Â¡
- MySQLÀÇ ±âº»¸ñÇ¥Àº ¼Óµµ¿Í ¾ÈÁ¤¼ºÀÌ´Ù.
- C, C++·Î ÀÛ¼ºµÇ¾ú°í, GCC 2.7.2.1¿¡¼ Å×½ºÆ®µÇ¾ú´Ù.Æ÷ÆÃÀ» À§ÇØ GNU autoconf¸¦ »ç¿ëÇÑ´Ù.
- C, C++, JAVA, Perl, TCL·Î Ŭ¶óÀ̾ðÆ®¸¦ ¸¸µé ¼ö ÀÖ´Ù.
- ¸ÖƼ ÇÁ·Î¼¼¼¸¦ Áö¿øÇÑ´Ù. »ç¿ëÀÚ°¡ °¡´ÉÇÏ´Ù¸é, ¼¹ö´Â ¿©·¯ °³ÀÇ CPU¸¦ »ç¿ëÇÒ ¼ö ÀÖ´Ù.
- ´Ù¾çÇÑ Ç÷§Æû°ú OS¿¡¼ ÀÛµ¿ÇÑ´Ù.
- ½Ã½ºÅÛÀÇ ¾ÏÈ£¿Í ±ÇÇÑÀÌ ¸Å¿ì À¯¿¬ÇÏ°í(flexible) ¾ÈÀüÇÏ´Ù.
- ¸ðµç ¾ÏÈ£´Â ³×Æ®¿÷ »ó¿¡¼ ¾ÏȣȵǾî Àü¼ÛµÈ´Ù.
- º¯¼ö¿Í °íÁ¤µÈ Å©±âÀÇ ·¹ÄÚµå(record)
- Å×À̺í´ç 16°³ÀÇ À妽º°¡ ÀÖ°í, °¢°¢ÀÇ À妽º´Â 1¿¡¼ 15°³ÀÇ Ä÷³À¸·Î ±¸¼ºµÇ°Å³ª,
ÃÖ´ë 127 ¹ÙÀÌÆ®±æÀ̳»ÀÇ Ä÷³ºÎºÐÀ¸·Î ±¸¼ºÇÒ ¼ö ÀÖ´Ù.
- ¸ðµç Ä÷³µéÀº ±âº» °ªÀ» °¡Áú ¼ö ÀÖ´Ù.
- ÃÖÀûÈÇϰųª Å×À̺íÀ» °íÄ¡±â À§ÇÑ À¯Æ¿¸®Æ¼(Isamchk)°¡ Á¸ÀçÇÑ´Ù.
- ¸ðµç µ¥ÀÌŸ´Â ISO8859_1 Çü½ÄÀ¸·Î ÀúÀåµÇ´Ù.
- Ŭ¶óÀ̾ðÆ®´Â ¼¹ö¿Í Åë½ÅÀ» Çϱâ À§Çؼ ¼ÒÄÏ(socket)À̳ª, TCP¸¦ ÀÌ¿ëÇÒ ¼ö ÀÖ´Ù.
- ¼¹ö¿¡¼ ¿¡·¯°¡ ¹ß»ýÇÏ¸é ¿©·¯ ¾ð¾î·Î ¿¡·¯ ¸Þ½ÃÁö¸¦ º¸¿©ÁØ´Ù.
- ¸ðµç ¸í·É¾î´Â -help³ª -? ¿É¼ÇÀ» °¡Áö°í ÀÖ¾î¼ µµ¿ò¸»À» º¼ ¼ö ÀÖ´Ù.
- Ä÷³Àº ¿©·¯ Çü½Ä(type)ÀÌ µÉ ¼ö ÀÖ´Ù.(integer(1,2,4,5,8 ¹ÙÀÌÆ®), float, double recision,
character, dates, enum µîµî)
- Windows 95¸¦ À§ÇÑ ODBC°¡ ÀÖ´Ù(¼Ò½º¿Í ÇÔ²¾), ACCESS°¡ ¼¹ö¿Í ¿¬°áÇϱâ À§ÇØ ¾²ÀÏ ¼ö ÀÖ´Ù.
¼³Ä¡
¼³Ä¡ÇÏ·Á¸é ¿ì¼± ¼Ò½º Äڵ带 À¥¿¡¼ ´Ù¿î·Îµå ¹Þ¾Æ¾ß ÇÑ´Ù.:
http://www.tcx.se
FTP¸¦ ÀÌ¿ëÇÒ ¼öµµ ÀÖ´Ù. :
ftp://ftp.sunet.se/pub/unix/databases/relational/mysql
¿ì¼± ¼Ò½º Äڵ带 ¹ÞÀ» °ÍÀÎÁö ¾Æ´Ï¸é ¹ÙÀ̳ʸ®·Î ¹ÞÀ» °ÍÀÎÁö °áÁ¤À» ÇØ¾ß ÇÑ´Ù.
¹ÙÀ̳ʸ®·Î ¹ÞÀ» °æ¿ì´Â ¼³Ä¡ÇÒ Ç÷§Æû¿¡ ´ëÇÑ ¹ÙÀ̳ʸ®°¡ ÀÌ¹Ì ÀÖ´ÂÁö ¾Ë¾Æ¾ß ÇÑ´Ù.
(´ëºÎºÐÀÇ Ç÷§Æû¿¡ ´ëÇØ ÀÌ¹Ì ¹ÙÀ̳ʸ®´Â Á¸ÀçÇÑ´Ù.)
¹ÙÀ̳ʸ® ¼³Ä¡
´Ù¿î·Îµå ¹Þ´Â´Ù.:
mysql-Version.tar.gz
¾ÐÃàÀ» Ǭ´Ù. ¿©±â¿¡´Â ¿©·¯°¡Áö ¹æ¹ýÀÌ Àִµ¥ ÇÊÀÚ´Â ´ÙÀ½ ¹æ½ÄÀ» ÁÁ¾ÆÇÑ´Ù.:
- ¾ÐÃàÀ» ¸ÕÀú Ǭ´Ù. :
gunzip -dfv mysql-Version.tar.gz
- ¾ÆÄ«À̺êµÈ °ÍÀ» ´Ù½Ã Ǭ´Ù.:
tar -xvf mysql-Version.tar
¸¸¾à /usr/local¿¡¼ ¾ÐÃàÀ» Ç®¾ú´Ù¸é, ´ÙÀ½ µð·ºÅ͸®¿¡¼ ¾ÐÃàÀÌ Ç®¸° ÆÄÀÏÀ» º¼ ¼ö ÀÖÀ» °ÍÀÌ´Ù.
/usr/local/mysql-3.20.32a-pc-linux-gnu-i586
À§¿Í °°Àº µð·ºÅ͸®À̸§Àº ½ÇÁ¦·Î Àß »ç¿ëÇÏÁö ¾Ê´Â´Ù. µû¶ó¼ ´ÙÀ½°ú °°ÀÌ ½Éº¼¸¯(¼ÒÇÁÆ®) ¸µÅ©¸¦
ÇÏ´Â °ÍÀ» ÃßõÇÑ´Ù.
> ln -s mysql-3.20.32a-pc-linux-gnu-i586/bin mysql
ÀÌÁ¦ mysql µð·ºÅ͸®ÀÇ ±¸¼ºÀº ´ÙÀ½°ú °°À» °ÍÀÌ´Ù:
- drwxr-xr-x 8192
Nov 24 1993 bin
-
drwxr-xr-x 8192 Nov
24 1993 etc
-
drwxr-xr-x 8192 Aug
17 1997 i18n
-
drwxr-xrx 8192 Mar
16 1994 include
-
drwxr-xr-x 8192 Mar
19 02:03 jdk1.1.3
-
drwxr-xr-x 8192 Aug
17 1997 jre
-
drwxr-xr-x 8192 Mar
16 1994 lib
-
lrwxrwxrwx 36 Jan
18 19:40 mysql
- drwxr-xr-x 8192
Feb 5 00:07 mysql-3.20.32a-pc-linux-gnu-i586
-
drwxr-xr-x 8192 Nov
24 1993 sbin
-
drwxr-xr-x 8192 Nov
24 1993 src
-
'cd mysql'¿¡¼ MySQL ¹ÙÀ̳ʸ®¸¦ ãÀ» ¼ö ÀÖ´Ù. ¸ðµç °ÍÀÌ ´Ù µÇ¾úÀ¸¸é
ÀÌÁ¦ µ¥ÀÌÅͺ£À̽º ¼¹ö¸¦ ½ÇÇà ½Ãų Áغñ°¡ Àß µÈ °ÍÀÌ´Ù.
¼Ò½º·Î ¼³Ä¡Çϱâ
À§¿¡¼ ¾ÐÃàÀ» Ç®¾ú´ø °Íó·³ ¾ÐÃàÀ» Ǭ´Ù.
- cd mysql-Version
- ./configure
-
- make install
-
¼Ò½º ÄÚµå ¹èÆ÷ÆÇ¿¡´Â ¼³Ä¡°úÁ¤¿¡ ´ëÇÑ ¸¹Àº ¹®¼µéÀÌ ÀÖ´Ù.
¾Ë·ÁÁø ¹ö±×³ª ƯÁ¤ Ç÷§Æû¿¡ ´ëÇÑ ¹®¼¿Í ¸¹Àº OS¿¡ ´ëÇÑ ¼³¸í
FAQ¿Í ¼³Á¤Çϴµ¥ ÇÊ¿äÇÑ ¼³¸íµµ ÀÖ´Ù. ¼³Ä¡°¡ Àß µÇ¾ú´Ù¸é,
¹ÙÀ̳ʸ® ¼³Ä¡¶§¿Í ºñ½ÁÇÑ µð·ºÅ͸®¸¦ º¼ ¼ö ÀÖ´Ù.
¼Ò½º Äڵ带 ÅëÇÑ ¼³Ä¡´Â ¼³Ä¡¸¦ ¸¹ÀÌ Çغ» »ç¿ëÀÚ¿Í ÄÄÆÄÀÏ ÇÏ´Â
¿À·£ µ¿¾È ±â´Ù¸±¸¸ÇÑ Àγ»½ÉÀ» °¡Áø ÀÚ, ÄÄÆÄÀÏ µ¿¾È ¸¹Àº ¿¡·¯¸¦ Àß
ÂüÀ» ¼ö ÀÖ´Â »ç¿ëÀÚ¿¡°Ô ±ÇÇÏ´Â ¹ÙÀÌ´Ù.
ù ´Ü°è: °ü¸®Çϱâ(º¸¾È)
À§ÀÇ ¼³Ä¡ °úÁ¤À» ¼º°øÀûÀ¸·Î ¸¶ÃÆ´Ù¸é, ´ÙÀ½°ú °°Àº µð·ºÅ͸®¸¦ º¼ ¼ö ÀÖÀ» °ÍÀÌ´Ù :
/usr/local/mysql-3.20.32a-pc-linux-gnu-i586
À§ÀÇ µð·ºÅ͸®¿¡´Â ´ÙÀ½°ú °°Àº ÆÄÀÏ°ú µð·ºÅ͸®°¡ ÀÖÀ» °ÍÀÌ´Ù.:
- -rw-r--r-- 1
root root 4133 Oct 1 1997 INSTALL-BINARY
-
-rw-r--r-- 1 root
root 16666 Oct 7 21:10 INSTALL-SOURCE
-
-rw-r--r-- 1 root
root 24088 Oct 27 23:06 NEWS
-
-rw-r--r-- 1 root
root 3562 Apr 11 1997 PORTING
-
-rw-r--r-- 1 root
root 8512 May 21 1997 PUBLIC
-
-rw-r--r-- 1 root
root 1963 Jul 31 1997 README
-
-rw-r--r-- 1 root
root 3416 Jun 4 1997 TODO
-
drwxr-xr-x 6 root
root 8192 Oct 28 00:44 bench
-
drwxr-xr-x 2 cuenta1
users 8192 Mar 27 00:42 bin
-
drwxr-xr-x 5 root
root 8192 Mar 31 00:26 data
-
drwxr-xr-x 2 root
root 8192 Oct 28 00:44 include
-
drwxr-xr-x 2 root
root 8192 Oct 28 00:44 lib
-
-rw-r--r-- 1 root
root 132883 Jun 8 1997 mysql-faq.html
-
-rw-r--r-- 1 root
root 117622 Jun 10 1997 mysql-faq.txt
-
-rw-r--r-- 1 root
root 9301 Jun 8 1997 mysql-faq_toc.html
-
drwxr-xr-x 4 root
root 8192 Oct 28 00:44 mysqlperl
-
drwxr-xr-x 2 root
root 8192 Oct 28 00:44 scripts
-
drwxr-xr-x 3 root
root 8192 Oct 28 00:44 share
-
drwxr-xr-x 2 root
root 8192 Oct 28 00:44 tests
-
¼³Ä¡ °úÁ¤¿¡ ´ëÇÑ Á»´õ ¸¹Àº Á¤º¸¸¦ º¸·Á¸é, README, TODO, INSTALL, mysql-faq
µîÀÇ ¹®¼¸¦ Àо±â ¹Ù¶õ´Ù.(ÀÌ ±ÛÀº À§ÀÇ ±ÛµéÀ» ±âÃÊ·Î »ï¾Ò´Ù.)
/dataµð·ºÅ͸®´Â »õ·Î ¸¸µé¾îÁø µ¥ÀÌŸº£À̽ºµéÀÌ ÀúÀåµÇ´Â µð·ºÅ͸®ÀÌ´Ù.
óÀ½ ¼³Ä¡¸¦ ÇÏ¸é ±âº»ÀûÀ¸·Î º¸¾ÈÀ» À§ÇÑ mysqlÀ̶ó´Â µ¥ÀÌŸº£À̽º°¡ ÀÖ´Ù.
/bench µð·ºÅ͸®¿¡´Â ¸¹Àº SQL ¿¹Á¦µéÀÌ ÀÖ´Ù. ¹ÙÀ̳ʸ®·Î ¼³Ä¡ÇÏ´Â °Íº¸´Ù
¼Ò½ºÄÚµå·ÎºÎÅÍ ¼³Ä¡ÇÏ´Â °æ¿ì°¡ ´õ ¸¹Àº ¿¹Á¦µéÀ» Æ÷ÇÔÇÏ°í ÀÖ´Ù.
/shareµð·ºÅ͸®¿¡´Â ¼¹ö°¡ Áö¿øÇÏ´Â ¿©·¯ ¾ð¾î·ÎµÈ ¿¡·¯ ¸Þ½ÃÁö°¡ ÀÖ´Ù.
/include¿Í /libµð·ºÅ͸®¿¡´Â Çì´õ ÆÄÀÏ°ú ¶óÀ̺귯¸® ÆÄÀÏÀÌ Á¸ÀçÇÑ´Ù.
/bin µð·ºÅ͸®¿¡´Â ¸¹Àº ½ÇÇà ÆÄÀÏÀÌ ÀÖ°í,´ÙÀ½°ú °°ÀÌ ¸Å¿ì Áß¿äÇÑ ÆÄÀÏÀ» ´ã°í ÀÖ´Ù.:
`mysql'
SQL ½©ÀÌ´Ù. ÀÎÅÍ·ºÆ¼ºêÇÏ°Ô »ç¿ëµÇ°Å³ª ÀÎÅÍ·¢Æ¼ºêÇÏÁö ¾Ê°Ô »ç¿ëµÉ ¼ö ÀÖ´Ù.
`mysqladmin'
°ü¸® µµ±¸ÀÌ´Ù. µ¥ÀÌŸº£À̽º¸¦ »õ·Î ¸¸µé°Å³ª »èÁ¦ÇÒ ¼ö ÀÖ°í, ÇÁ·Î¼¼½º¿¡ ´ëÇÑ Á¤º¸¿Í
¹öÀü¿¡ ´ëÇÑ Á¤º¸¸¦ º¸¿©ÁØ´Ù.
`mysqld'
SQL µ¥¸óÀÌ´Ù. ÀÌ µ¥¸óÀº Ç×»ó ½ÇÇà ÁßÀ̾î¾ß ÇÑ´Ù.
`mysqlshow'
µ¥ÀÌŸ º£À̽º¿¡ ´ëÇÑ Á¤º¸¿Í µ¥ÀÌŸ º£À̽ºÀÇ Å×À̺í°ú Çʵ忡 ´ëÇÑ Á¤º¸¸¦ º¸¿©ÁØ´Ù.
`safe_mysqld'
mysqld¸¦ ½ÇÇàÇÏ´Â ÆÄÀÏÀÌ´Ù..
`mysqlaccess'
È£½ºÆ®, »ç¿ëÀÚ, µ¥ÀÌŸ º£À̽ºµî¿¡ ´ëÇÑ »ç¿ë ±ÇÇÑÀ» È®ÀÎÇÏ´Â ½ºÅ©¸³Æ®ÀÌ´Ù.
`mysqlbug'
¼¹ö¿¡¼ ¹ß»ýÇÑ ¹ö±×¸¦ ±â·ÏÇÑ´Ù.
`mysql_install_db'
±âº» ±ÇÇÑ¿¡ ´ëÇÑ Ä¿´Ù¶õ Å×À̺íÀ» »ý¼ºÇÑ´Ù. º¸Åë ÀνºÅçÇÑ ´ÙÀ½ ½ÇÇàÇÑ´Ù.
`isamchk'
Å×À̺íÀ» È®ÀÎÇÏ°í °íÄ¡°Å³ª, ÃÖÀûÈ ÇÑ´Ù.
º¸¾È
MySQLÀÇ º¸¾È ½Ã½ºÅÛÀº »ç¿ëÀÚ°¡ (´õµµ ´úµµ ¾Æ´Ñ) ÁÖ¾îÁø ±ÇÇѸ¸ÅÀÇ ÀÛ¾÷À» ÇÒ ¼ö ÀÖµµ·Ï ÇÑ´Ù.
½Ã½ºÅÛÀº ¾î¶² È£½ºÆ®¿¡¼ Á¢¼ÓÇÑ ¾î¶² »ç¿ëÀÚ°¡
¾î¶² µ¥ÀÌŸ º£À̽º¿¡ ¿¬°áÇÏ·Á´ÂÁö¿¡ ´ëÇÑ ±ÇÇÑÀ» ¼³Á¤ÇÑ´Ù.
½Ã½ºÅÛÀÇ ±ÇÇÑÀº mysqlÀ̶ó´Â µ¥ÀÌŸº£À̽º¿¡ ±âÃʸ¦ ÇÑ´Ù.
mysql µ¥ÀÌŸº£À̽º¿¡´Â USER, HOST¿Í
DB¶ó´Â Å×À̺íÀÌ ÀÖ´Ù.(¿©±â¼ ¸»ÇÏ´Â mysqlÀ̶ó´Â µ¥ÀÌŸº£À̽º´Â
MySQLÀ» ¼³Ä¡ÇÏ¸é ±âº»ÀûÀ¸·Î ¼³Ä¡µÇ¾î ÀÖ´Â µ¥ÀÌŸº£À̽º¸¦ ¸»ÇÑ´Ù.)
À§ÀÇ ¼¼ °³ÀÇ Å×ÀÌºí¿¡ ÀÖ´Â Ä÷³µéÀº ´ÙÀ½°ú °°´Ù.:
µ¥ÀÌÅͺ£À̽º¸í: mysql
Å×À̺í: db
Çʵå(Field) |
Çü½Ä(Type) |
Null |
Å°(Key) |
±âº»°ª(Default) |
Extra |
Host |
char(60) |
|
PRI |
|
|
Db |
char(32) |
|
PRI |
|
|
User |
char(16) |
|
PRI |
|
|
Select_priv |
char(1) |
|
|
N |
|
Insert_priv |
char(1) |
|
|
N |
|
Update_priv |
char(1) |
|
|
N |
|
Delete_priv |
char(1) |
|
|
N |
|
Create_priv |
char(1) |
|
|
N |
|
Drop_priv |
char(1) |
|
|
N |
|
Table: host
Çʵå(Field) |
Çü½Ä(Type) |
Null |
Å°(Key) |
±âº»°ª(Default) |
Extra |
Host |
char(60) |
|
PRI |
|
|
Db |
char(32) |
|
PRI |
|
|
Select_priv |
char(1) |
|
|
N |
|
Insert_priv |
char(1) |
|
|
N |
|
Update_priv |
char(1) |
|
|
N |
|
Delete_priv |
char(1) |
|
|
N |
|
Create_priv |
char(1) |
|
|
N |
|
Drop_priv |
char(1) |
|
|
N |
|
Table: user
Çʵå(Field) |
Çü½Ä(Type) |
Null |
Å°(Key) |
±âº»°ª(Default) |
Extra |
Host |
char(60) |
|
PRI |
|
|
User |
char(16) |
|
PRI |
|
|
Password |
char(16) |
|
|
|
|
Select_priv |
char(1) |
|
|
N |
|
Insert_priv |
char(1) |
|
|
N |
|
Update_priv |
char(1) |
|
|
N |
|
Delete_priv |
char(1) |
|
|
N |
|
Create_priv |
char(1) |
|
|
N |
|
Drop_priv |
char(1) |
|
|
N |
|
Reload_priv |
char(1) |
|
|
N |
|
Shutdown_priv |
char(1) |
|
|
N |
|
Process_priv |
char(1) |
|
|
N |
|
File_priv |
char(1) |
|
|
N |
|
Å×ÀÌºí¿¡ SELECT, INSERT, UPDATE¿Í DELETEÇÒ ±ÇÇÑÀ» ÁÙÁö ¾ÈÁÙÁö °áÁ¤ÇÒ ¼ö ÀÖ´Ù.
¶Ç, Å×À̺í°ú µ¥ÀÌŸº£À̽º¸¦ CREATE(»ý¼º)Çϰųª DROP(»èÁ¦)ÇÒ ±ÇÇÑÀ» ÁÙ ¼öµµ ¾È ÁÙ ¼öµµ ÀÖ´Ù.
Àç¹ÌÀÖ´Â ±ÇÇѵ鵵 Àִµ¥ shutdown°ú reload, process µîµîÀÌ ÀÖ´Ù.
ÇöÀç ¾î¶² ±ÇÇÑÀÌ ¼³Á¤µÇ¾î ÀÖ´ÂÁö´Â mysqlaccess¸¦ ÀÌ¿ëÇؼ Á¶»çÇÒ ¼ö ÀÖ´Ù.
HOST´Â Ç×»ó host localÀ̳ª IP ÁÖ¼Ò, ȤÀº SQL Ç¥ÇöÀ̾î¾ß ÇÑ´Ù. ¸¸¾à
db Å×ÀÌºí¿¡¼ host Ä÷³ÀÌ ºñ¾î¾ú´Ù¸é, host Å×ÀÌºí¿¡ ÀÖ´Â ¾î¶² È£½ºÆ®µµ¸¦ ÀǹÌÇÑ´Ù.
¹Ý¸é, host¿Í user Å×ÀÌºí¿¡¼ host Ä÷³ÀÌ ºñ¾î ÀÖ´Ù¸é, Àü¼¼°è ¾î¶² È£½ºÆ®µµ
¿ì¸® ¼¹ö¿¡ TCP·Î ¿¬°áµÉ ¼ö ÀÖ´Ù´Â °ÍÀ» ÀǹÌÇÑ´Ù.
Db´Â µ¥ÀÌÅͺ£À̽ºÀÇ À̸§ÀÌ´Ù.
"USER" Ä÷³ÀÌ ºñ¾î ÀÖ´Ù¸é, ¾î¶² userµµ¸¦ ÀǹÌÇÑ´Ù.
ù ´Ü°è
¼¹ö¸¦ ÀÛµ¿½ÃÅ°´Â °¡Àå ºü¸¥ ¹æ¹ýÀº ´ÙÀ½°ú °°´Ù.:
mysql.server start
¸ØÃß±â À§Çؼ´Â ´ÙÀ½ ¸í·ÉÀ» ³»¸°´Ù.:
mysql.server stop
¹°·Ð mysqld·Îµµ °°Àº ÀÏÀ» ÇÒ ¼ö ÀÖ´Ù. ¼³Ä¡¾È³»ºÎºÐ¿¡¼
¸»Çß´Ù½ÃÇÇ mysqld µ¥¸óÀ» ½ÇÇà½Ãų »ÓÀÌ´Ù.
½±°Ô ¾ê±âÇÏÀÚ¸é, ¼¹ö°¡ ½ÇÇàÁßÀÎ »óÅ¿¡¼¸¸ µ¥ÀÌŸ º£À̽º¸¦ ÀÌ¿ëÇÒ ¼ö ÀÖ´Ù.
ÀÏ´Ü ¼¹ö°¡ ÀÛµ¿ ÁßÀ̶ó¸é,mysqladminÀ̶ó´Â ¸í·É¾î¸¦ ½ÇÇà ½Ãų ¼ö ÀÖ´Ù.:
mysqladmin [OPTIONS] command command
´ÙÀ½°ú °°Àº ¿É¼ÇÀÌ Á¦°øµÈ´Ù.:
- -f, --force Å×À̺íÀ» Áö¿ï ¶§ »ç¿ëÀÚ È®ÀÎÀ» ¹ÞÁö ¾Ê´Â´Ù.
- -?, --help ÇöÀçÀÇ µµ¿ò¸» ¸Þ´º¸¦ º¸¿©ÁØ´Ù.
-
-h, --host=# È£½ºÆ®¿¡ ¿¬°áÇÑ´Ù.
-
-p, --password[=...] ¼¹ö¿¡ Á¢±ÙÇϱâ À§ÇÑ ¾ÏÈ£
-
-P --port=...
Á¢¼Ó¿¡ »ç¿ëµÇ´Â Æ÷Æ® ¹øÈ£
-
-S --socket=...
Á¢¼Ó¿¡ »ç¿ëµÇ´Â ¼ÒÄÏÆÄÀÏ
-
-u, --user=#
ÇöÀç »ç¿ëÀÚ°¡ ¾Æ´Ï¶ó¸é ¿¬°áÇÒ ¶§ »ç¿ëÀÚ
- -V, --version
ÇöÀç ¼¹öÀÇ ¹öÁ¯¿¡ ´ëÇÑ Á¤º¸¸¦ º¸¿©ÁØ´Ù.
-
command´Â ´ÙÀ½°ú °°Àº °ÍÀÌ µÉ ¼ö ÀÖ´Ù.:
- create µ¥ÀÌÅͺ£À̽º_À̸§
»õ·Î¿î µ¥ÀÌÅͺ£À̽º¸¦ »ý¼ºÇÑ´Ù.
- drop µ¥ÀÌÅͺ£À̽º_À̸§
ÇØ´ç µ¥ÀÌÅͺ£À̽º¿¡ µé¾îÀÖ´Â Å×À̺íÀ» Áö¿ì°í µ¥ÀÌÅͺ£À̽º¸¦ »èÁ¦ÇÑ´Ù.
- kill ÇÁ·Î¼¼½º_¾ÆÀ̵ð
mysql°ú ¿¬°áµÈ ÇÁ·Î¼¼½ºµéÀ» Á×ÀδÙ.
- processlist
ÇöÀç ¼¹ö¿¡¼ ½ÇÇàÁßÀÎ ÇÁ·Î¼¼½ºµéÀ» º¸¿©ÁØ´Ù.
- shutdown
¼¹ö¸¦ ¼Ë´Ù¿î½ÃŲ´Ù.
- status
¼¹öÀÇ ÇöÀç»óŸ¦ º¸¿©ÁØ´Ù.
- version
¼¹öÀÇ ¹öÁ¯À» º¸¿©ÁØ´Ù.
¿¹¸¦ µé¾î¼ ´ÙÀ½ ¸í·ÉÀ» »ìÆ캸ÀÚ. :
mysqladmin create newdatabase
"newdatabase"¶ó´Â µ¥ÀÌŸº£À̽º¸¦ »õ·Î ¸¸µç´Ù.
´ÙÀ½ ¸í·ÉÀº ¼¹ö¿¡ ÀÇÇØ ¼öÇà ÁßÀÎ ÇÁ·Î¼¼½º¸¦ º¼ ¼ö ÀÖ´Ù.
mysqladmin processlist
¶Ç Áß¿äÇÑ ¸í·ÉÀ¸·Î´Â mysqlshow°¡ Àִµ¥, ÀÌ ¸í·ÉÀº
»ç¿ë°¡´ÉÇÑ µ¥ÀÌÅͺ£À̽ºµéÀÇ ¸ñ·ÏÀ» º¸¿©ÁØ´Ù. Áï ¼¹ö¿¡ Á¸ÀçÇÏ´Â µ¥ÀÌÅͺ£À̽ºµéÀ» º¸¿©ÁØ´Ù.
mysqlshow µ¥ÀÌÅͺ£À̽º¶ó°í Ä¡¸é ÁöÁ¤ÇÑ µ¥ÀÌÅͺ£À̽º¿¡ ¾î¶² Å×À̺íÀÌ ÀÖ´ÂÁö¸¦ º¸¿©ÁØ´Ù.:
> mysqlshow
+-----------+
| Databases |
+-----------+
| mysql |
| people |
| test |
+-----------+
MySQL¿¡¼ÀÇ SQL ¾ð¾î
ÀÌ¹Ì 'µé¾î°¡´Â ¸»' ºÎºÐ¿¡¼ MySQLÀÌ µ¿±ÞÀÇ ¼¹ö Áß¿¡¼ Å©°í ÀÛÀº µ¥ÀÌÅ͸¦ ó¸®ÇÒ ¶§
°¡Àå ºü¸¥ °Í ÁßÀÇ Çϳª¶ó°í ¸»À» ÇÏ¿´´Ù. ¶ÇÇÑ ±×·¸°Ô ¼Óµµ°¡ ºü¸¥ °ÍÀº SQLÀÇ
¸î°¡Áö ÀϹÝÀûÀΠƯ¡À» ±¸ÇöÇÏÁö ¾Ê¾Ò±â ¶§¹®À̶ó°í ÇÏ¿´´Ù(Áß¿äÇÏ´Ù).
±¸ÇöÇÏÁö ¾Ê´Â °Í Áß Áß¿äÇÑ µÎ °¡Áö´Â Æ®¸®°Å(Trigger)¿Í Æ®·£Àè¼Ç(Transaction)ÀÌ´Ù.
Æ®¸®°Å´Â µ¥ÀÌÅÍ¿¡ ¾î¶² µ¿ÀÛ(UPDATE, DELETE µî)ÀÌ ÀϾ¸é ÁöÁ¤µÈ µ¿ÀÛÀ» ¼öÇàÇϵµ·Ï
ÇÏ´Â °ÍÀÌ´Ù. Æ®¸®°Å¸¦ Å×½ºÆ® Çغ¸¾Ò´õ´Ï, Æ®¸®°Å´Â ½Ã½ºÅÛÀÇ ÀÚ¿øÀ» ¸¹ÀÌ »ç¿ëÇÑ´Ù´Â °ÍÀ»
¾Ë¾Ò´Ù. ÀÌ ¶§¹®¿¡ MySQL¿¡¼ ±¸ÇöµÇÁö ¾Ê¾Ò´Ù.
µ¥ÀÌŸº£À̽º¿¡¼ ÀÏ°ü¼º(consistency)´Â ¸Å¿ì Áß¿äÇÏ´Ù. ÀÏ°ü¼ºÀ» À§Çؼ SQLÀº
¿©·¯ ÅøÀ» Á¦°øÇÑ´Ù. ¼¹ö´Â ÆÄÀÏÀ» ºí·°(block)ÇÏ°í, ¼öÇàÇß´ø ÀÏÀ» µÇ µ¹¾Æ¿À´Â ÀÏ¿¡ ´ëÇÑ
¸ÞÄ«´ÏÁòÀ» Á¦°øÇØ¾ß ÇÑ´Ù. ±×·±µ¥, MySQL¿¡¼´Â ¼Óµµ¸¦ ³ôÀ̱â À§Çؼ Æ®·£Àè¼ÇÀ» Á¦°øÇÏÁö ¾Ê´Â´Ù.
(MySQLÀÇ ¹®¼¿¡ ±×·¸°Ô ³ª¿ÍÀÖ´Ù) ´Ù¸¸ Å×À̺íÀ» ºí·°Çϱâ À§Çؼ LOCKÅ×À̺í, UNLOCKÅ×À̺íÀ» ÀÌ¿ëÇÒ ¼ö ÀÖÁö¸¸,
¼öÇà Çß´ø ÀÏÀ» Ãë¼ÒÇÒ ¼ö´Â ¾ø´Ù.(Áï, UNDO ±â´ÉÀÌ ¾ø´Ù.)
¼¹öÀÇ Á¦¾àÁ¶°ÇµéÀ» ¿°µÎ¿¡ µÎ°í SQL ¸í·É¿¡ ´ëÇؼ ¾Ë¾Æº¸ÀÚ.
SQLÀÇ ¸í·ÉÀ» ¼³¸íÇÏ·Á´Â °ÍÀº ¾Æ´Ï°í, ´Ù¸¸ ¼¹ö°¡ SQL ¸í·ÉÀ» ¾î¶»°Ô
±¸ÇöÇÏ´ÂÁö¸¦ º¸°íÀÚ ÇÑ´Ù.
ÀÏ´Ü ¼¹ö°¡ ½ÇÇàµÇ¾úÀ¸¸é ÀÌÁ¦ºÎÅÍ ¸í·ÉÀ» ÁÙ ¼ö ÀÖ´Ù. ¿¹¸¦ µé¾î "clients",
"states"¿Í "countries"ÀÇ Å×À̺í·Î ±¸¼ºµÈ "people"À̶ó´Â µ¥ÀÌŸº£À̽º¸¦ ¸¸µé ¼ö ÀÖ´Ù.
À§ÀÇ ¿¹´Â ±×¸® ÁÁÁö ¾ÊÀº ¿¹ÀÌÁö¸¸, °£´ÜÇÏ°í, ½ÇÁ¦·Î µ¥ÀÌŸ°¡ ¾î¶»°Ô ´Ù·ç¾îÁö°Ô µÇ´ÂÁö¸¦
º¸¿© ÁØ´Ù.
ÀÌ·¯ÇÑ ÀÏÀº ¸¹Àº ¹æ¹ýÀ» ÀÌ¿ëÇؼ ÇÒ ¼ö ÀÖ´Ù. C, C++°ú JAVAÀÇ API¸¦ ÀÌ¿ëÇÒ ¼öµµ ÀÖ°í,
win95¸¦ ¾²°í ÀÖ´Ù¸é, ODBC¸¦ ÀÌ¿ëÇÒ ¼öµµ ÀÖ´Ù. ¶ÇÇÑ MySQL¿¡ ÀÖ´Â ½©À» ÀÌ¿ëÇÒ ¼öµµ ÀÖ´Ù.
ÀÌ ±ÛÀÇ ¸ñÀûÀº ÇÁ·Î±×·¡¹Ö ¾ð¾î¸¦ °¡¸£Ä¡´Â °ÍÀÌ ¾Æ´Ï¹Ç·Î ¿ì¸®´Â ½©À» ÀÌ¿ëÇϱâ·Î ÇÑ´Ù.
MySQLÀÇ ½©Àº ´ÙÀ½°ú °°ÀÌ ½ÃÀÛÇÒ ¼ö ÀÖ´Ù.:
mysql databasename
½© ÇÁ·ÒÇÁÆ®°¡ º¸À̸é ÀÌÁ¦ ¼¹ö¿¡°Ô ¸í·ÉÀ» ³»¸± ¼ö ÀÖ´Ù.
¹èÄ¡(batch) ¸ðµå·Î ´ÙÀ½°ú °°ÀÌ ½ÃÀÛÀ» ÇÒ ¼ö ÀÖ´Ù.:
mysql -e
(SQL command
)databasename
À§ ¸í·ÉÀº ¼¹ö¿¡°Ô SQL ¸í·ÉÀ» ³»¸®°Ô ÇÑ´Ù..
"people"À̶ó´Â µ¥ÀÌŸº£À̽º¸¦ ¸¸µé±â À§Çؼ´Â ´ÙÀ½°ú °°ÀÌ ÇÑ´Ù.:
mysqladmin create people
´ÙÀ½ ½©À» ½ÃÀÛÇÑ´Ù.
mysql people
ÀÌÁ¦ ½©À» ÀÌ¿ëÇؼ ¿ì¸®´Â ¼¹ö¿¡ ¸í·ÉÀ» ³»¸± ¼ö ÀÖ´Ù. ¿¹¸¦ µé¾î ÇöÀç µ¥ÀÌŸº£À̽º¿¡¼
»ç¿ëÇÒ ¼ö ÀÖ´Â Å×À̺íÀÇ ¸ñ·ÏÀ» º¸±â ¿øÇϸé :
> show tables /g
¶ó°í Çϸé, ´ÙÀ½°ú °°ÀÌ ³ª¿Â´Ù.:
Database: people
+-------------+
| Tables |
+-------------+
| clients |
| counties |
| states |
+-------------+
¼¹ö·Î º¸³»´Â ¸ðµç ¸í·ÉÀº ';'·Î ³¡³´Ù. ';'¸¦ ¸¸³ª¸é ¸í·ÉÀ» ¼¹ö¿¡ º¸³»°Ô µÈ´Ù.
´ç¿¬È÷ À§¿Í °°Àº °á°ú´Â CREAT¸í·ÉÀ» ÀÌ¿ëÇÏ¿© ÇØ´ç Å×À̺íÀ» ¸¸µé¾î¾ß º¼ ¼ö ÀÖ´Ù.
ÀϹÝÀûÀÎ CREATE¸í·ÉÀº ´ÙÀ½°ú °°ÀÌ »ç¿ëÇÑ´Ù.:
CREATE TABLE clients
(NIF CHAR(9) NOT NULL PRIMARY KEY,
Name CHAR(15) NOT NULL,
Family_name CHAR(35) NOT NULL,
Address CHAR(50) NOT NULL,
City INT(5) NOT NULL,
State INT(2) NOT NULL,
Phone INT(9),
Date DATE NOT NULL) /g
CREATE TABLE states
(Cod_state INT(2) NOT NULL PRIMARY KEY,
Description_s CHAR(30) NOT NULL) /g
CREATE TABLE counties
(Cod_state INT(2) NOT NULL,
Cod_county INT(3) NOT NULL,
Description_c CHAR(30) NOT NULL,
PRIMARY KEY(Cod_state,Cod_county)) /g
ÀÌÁ¦ ´ÙÀ½°ú °°Àº ¸í·ÉÀ» ³»¸®¸é
> show colums from
clients from people /g
> show columns
from states from people /g
> show columns from
counties from people /g
´ÙÀ½°ú °°ÀÌ ³ªÅ¸³´Ù.
Database: people Table: clients Rows: 4
+--------------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+----------+------+-----+---------+-------+
| NIF | char(9) | |PRI | | |
| Name | char(15) | YES | | | |
| Family_name | char(35) | | | | |
| Address | char(50) | | | | |
| City | int(5) | | | 0 | |
| State | int(2) | | | 0 | |
| Phone | int(9) | YES | | | |
| Date | date | YES | | | |
+--------------+----------+------+-----+---------+-------+
Database: people Table: states Rows: 3
+-----------------+----------+------+-----+---------+-------+
| Field | Type | Null | Key| Default | Extra |
+-----------------+----------+------+-----+---------+-------+
| Cod_state | int(2) | | PRI | 0 | |
| Descripcion_s | char(30) | | | | |
+-----------------+----------+------+-----+---------+-------+
Database: people Table: counties Rows: 9
+------------------+----------+------+-----+---------+-------+
| Field | Type | Null | Key| Default | Extra |
+------------------+----------+------+-----+---------+-------+
| Cod_state | int(2) | | PRI | 0 | |
| Cod_county | int(3) | | PRI | 0 | |
| Descripcion_c | char(30) | | | | |
+------------------+----------+------+-----+---------+-------+
ÀÌÁ¦ data¸¦ °¢ Å×ÀÌºí¿¡ »ðÀÔÇÒ ¼ö°¡ ÀÖ´Ù. ÇÁ·Î±×·¡¹Ö ¾ð¾î³ª API¸¦ ¾²Áö ¸»°í,
SQL ¸í·ÉÀ» ½á¼ µ¥ÀÌŸ¸¦ »ðÀÔÇÏ¿© º¸ÀÚ.:
"clients", "counties"¿Í "states" Å×ÀÌºí¿¡ ·¹Äڵ带 »ðÀÔÇϱâ À§Çؼ ´ÙÀ½°ú °°ÀÌ ÇÏ¸é µÈ´Ù.:
- INSERT INTO clients
VALUES
-
("5316828K","PEDRO","ROMERO
DIAZ","C/ HOLA 9 ",29003,29,911111111,19980203)
- /g
-
- INSERT INTO counties
VALUES
-
(28,001,"Fuenlabrada")
/g
-
- INSERT INTO states
VALUES
-
(08,"Barcelona")
/g
-
¸¶Áö¸·À¸·Î SELECT¸¦ ÀÌ¿ëÇؼ »ðÀÔÇÑ record¸¦ º¸ÀÚ. Á¶°ÇÀ» ÁÖ¾î Á¶°Ç¿¡ ¸Â´Â ·¹Äڵ常À»
ãÀ» °ÍÀÌ´Ù. :
> SELECT ALL
Cod_state, Cod_county, Description_c from counties
where Cod_state = 28 /g
Cod_state Cod_county Description_c
28 1 Fuenlabrada
28 2 Pozuelo
28 3 Madrid
> SELECT ALL
NIF,Name,Family_name,Address from clientes
where City =
28001
- NIF Name
Family_name direccion
-
2416728U JOSE FERNANDEZ
ROMERO C/ FELIZ 1 3G
-
- > SELECT ALL
NIF,Name,Family_name,Address from clients
-
where State =
29
-
-
NIF Name Family_name Address
23198623N JUAN ANDRES RUIZ MORALES C/ CATEDRAL 12 2B
5316828K PEDRO ROMERO DIAZ C/ HOLA 9
52312844J LUIS ALBERTO LISTO JIMENEZ C/ ROSA DE LOS VIENTOS 129 3I
¸¶Ä¡´Â ±Û
ÀÌ ±ÛÀº MySQLÀÇ ±âº»ÀûÀº Ư¡À» ¾Ë¾Æ º¸±â À§Çؼ ¾²¿©Á³´Ù. MySQLÀÇ ¸í·ÉÀ̳ª, »ç¿ë»óÀÇ
±â¹ýÀ» ¾Ë·ÁÁÖ±â À§ÇØ ¾²ÀÎ °ÍÀÌ ¾Æ´Ï´Ù. ´ë½Å MySQLÀÇ Á¦ÇÑ°ú MySQL·Î °¡´ÉÇÑ ÀÏÀ»
°øºÎÇß´Ù. ÇÁ·Î±×·¥ÀÇ Á¦ÇÑ Æ¯Â¡À» Àß ÀÌÇØÇÏ´Â °ÍÀº ÀÛ¾÷À» Çϴµ¥ ¸Å¿ì Å« ÀåÁ¡ÀÌ µÉ °ÍÀÌ´Ù.
MySQL¿¡¼´Â Æ®¸®°Å¿Í Æ®·£Àè¼ÇÀ» »ý·«ÇÏ¿´À¸¹Ç·Î, ¸¹Àº »ç¿ëÀÚ¿Í º¹ÀâÇÑ Å×À̺íÀ» ´Ù·ç´Âµ¥´Â
»ç¿ëÀÌ ºÎÀûÇÕÇÏ´Ù. ´ë½Å ÇÊÀÚ´Â Å« µ¥ÀÌŸº£À̽º¿¡ ºü¸¥ ¼Óµµ¸¦ ¿äÇÏ´Â ÇÁ·Î±×·¥¿¡ MySQLÀ»
ÃßõÇÏ´Â ¹ÙÀÌ´Ù.
¸¶Áö¸·À¸·Î ÀÌ ±â»çÀÇ ´ëºÎºÐ Á¤º¸´Â MySQL ¹èÆ÷ÆÇ¿¡ °°ÀÌ ¿Â ¹®¼¿Í ÀâÁö, IBMÀÇ SQL
¸Å´º¾ó¿¡ ±âÃÊÇÏ¿´À½À» ¹àÇô µÐ´Ù.
¹ø¿ª : ÇãÁ¤¼ö
|