¾È³çÇϼ¼¿ä. Hitel¿¡¼ ÆÛ¿Â °ÁÂÀÔ´Ï´Ù.
Àúó·³ »ýÃʺ¸¿¡°Ô ÇÊ¿äÇÑ°Å °°¾Æ¼¿ä..¤Ñ.¤Ñ
±×·³ ´Ùµé ¿»ð.
-----------------------------
-----------------------------
------ MySQL °ÁÂ #1 -------
-----------------------------
-----------------------------
-- ÀÛ¼ºÀÚ : ¹Ú¼øÇà
-- ÀÛ¼ºÀÏ : 1998.4.2
-- hitel : soonhg
-- õ¸®¾È : soonhg
-- À¯´ÏÅÚ : soonhg
-- E-mail : soonhg@chollian.net
<< ¼·Ð >>
Çѱ۷Π¹ø¿ªµÇ¾î ÀÖ´Â MySQL¿¡ ´ëÇÑ ¹®¼°¡ ¾ø´õ±º¿ä.
±×·¡¼ Àúó·³ °í»ýÇÏÁö ¸»°í ½±°Ô MySQLÀ» Á¢ÇÒ¼ö ÀÖµµ·Ï
Á¦°¡ °£´ÜÇÏ°Ô³ª¸¶ »ç¿ë¹ýÀ» ¼³¸í¼¸¦ ¸¸µé¾ú½À´Ï´Ù.
°è¼ÓÇؼ MySQL¿¡ ´ëÇÑ ³»¿ëÀ» Á¤¸®ÇØ ³ª°¥ »ý°¢ÀÌ¸ç ¸¹Àº
»ç¶÷µéÀÌ »ç¿ëÀ» ÇØ º¸¾ÒÀ¸¸é ÇÕ´Ï´Ù. Msql, PostgreSQLÀº ÀÚ·á°¡
¸¹À¸³ª ÀÌ MySQL Àº ÇÑ±Û ÀÚ·á°¡ ¾ø¾î °í»ýÇϽŠºÐµéÀº Á¦°¡ »ç¿ëÇØ
ºÐ °æÇèÀÌ µµ¿òÀÌ µÇ±â¸¦ ±â¿øÇÕ´Ï´Ù. °è¼ÓÀûÀ¸·Î ÀÌ DB¸¦ »ç¿ëÇغ¸°í
»ç¿ë´ãÀ» ¿Ã¸®µµ·Ï ÇÏ°Ú½À´Ï´Ù....
¸¹Àº »ç¶÷µé¿¡°Ô µµ¿òÀÌ µÇ¾úÀ¸¸é ÇÕ´Ï´Ù.....
#######################################
# #
# MySQL ±âº» ¼³¸í ¹× ¼³Ä¡Çϱâ #
# #
#######################################
¡á MySQL Àº ¹«¾ùÀΰ¡
MySQLÀº °ü°èÇü µ¥ÀÌŸº£À̽ºÀÌ´Ù. ÀÌ°ÍÀº °ø°³¿ë µ¥ÀÌŸº£À̽º·Î¼
ÀÏ¹Ý »ó¿ë µ¥ÀÌŸ º£À̽º¿Í ºñ±³ÇÏ¿© Å©°Ô µÚÁú°ÍÀÌ ¾ø´Â ¸Å¿ì ¶Ù¾î
³ °ü°èÇü µ¥ÀÌŸº£À̽ºÀÌ´Ù. ¹°·Ð ¾ÈÁ¤¼º ¹× ¹«°á¼³ÀÇ Ãø¸é¿¡¼ ´Ù
¸¥ »ó¿ë µ¥ÀÌŸº£À̽º¿¡ ºñÇÏ¿© ¶³¾îÁø´Ù´Â °ÍÀº ÀÎÁ¤ÇÑ´Ù. ÇÏÁö¸¸
¸Å¿ì ¾ÈÁ¤ÀûÀ̶ó°í ÇÒ¼ö ÀÖ´Ù. °ü¸®¸¸ Àß ÇÑ´Ù¸é ¸Å¿ì Àß »ç¿ëÇÒ¼ö
ÀÖÀ¸¸ç ´Ù¸¥ µ¥ÀÌŸº£À̽º¿¡ ºñÇÏ¿© º¸¾ÈÀ̳ª, °¢Á¾ ÇÔ¼öµµ ¸¹¾Æ¼
ÇÁ·Î±×·¥¿¡ ¿ëÀÌÇÏ´Ù.
°ø°³¿ë µ¥ÀÌŸ º£À̽º·Î´Â mSQL,PostgreSQL,MySQL µîÀÌ Àִµ¥ ±×Áß
Àü¼¼°èÀûÀ¸·Î º¼¶§ MySQLÀÌ ¸¹ÀÌ ¾Ö¿ëµÇ°í ÀÖ´Ù°í ÇÒ¼ö ÀÖ´Ù. ±×¸®³ª
¿ì¸®³ª¶ó¿¡¼´Â ¾ÆÁ÷ ÀÌ¿ëµµ°¡ ¹Ì¹ÌÇÏ´Ù.
PHP¿Íµµ ¿¬°áÀÌ ¿ëÀÌÇÏ°í °¢Á¾ °ø°³¿ë À¥¼¹ö¿Í ¿¬°áµµ °£ÆíÇÏ´Ù.
C, C++, Java, Python, TCK/TK, ±×¸®°í ODBC µµ Á¦°øÀÌ µÈ´Ù. ODBC´Â
windows3.1, win95, NT ¿ë ¸ðµÎ Á¦°øÀÌ µÇ°í ÀÖ´Ù.
Access ¿Í ÀڷḦ ¿¬µ¿ÇÒ¼ö ÀÖÀ¸¸ç Excel Àº ¹°·Ð Delphi(µ¨ÆÄÀÌ)¿Í
´Â DBE 3.2¸¦ »ç¿ëÇÏ¿© µ¥ÀÌŸ ¿¬µ¿ÀÌ °¡´ÉÇϸç C++ Builder ¿Í´Â
DBE 3.0À» ÅëÇÏ¿© »ç¿ë °¡´ÉÇÏ´Ù.
ÀÌ MySQLÀ» »ó¾÷ÀûÀ¸·Î »ç¿ëÇÒ °æ¿ì DB °³¹ßÀÚ µé¿¡°Ô ¾à°£ÀÇ °³¹ß
ÈÄ¿ø±ÝÀ» Á¦°øÇϸé Á¦Ç°¿¡ Æ÷ÇÔÇÏ¿© °³¹ßµÈ ÇÁ·Î±×·¥°ú ÇÔ²² ÆǸŵµ
ÇÒ ¼ö ÀÖÀ¸¸ç °³ÀÎÀûÀÎ ¿ëµµ·Î¸¸ »ç¿ëÇÑ´Ù¸é ¹«·á·Î »ç¿ëÇÒ ¼ö ÀÖ´Ù.
¡á MySQL ÀÇ °ø½Ä»çÀÌÆ®
http://www.tcx.se/ : Mysql °ø½Ä ȨÆäÀÌÁö
http://www.kreonet.re.kr/mysql/ : Çѱ¹ÀÇ °ø½Ä ¹Ì·¯¸µ»çÀÌÆ®
ftp://korenet.re.kr/pub/packages/db/mysql/ : ftp »çÀÌÆ®(Çѱ¹)
¡á MySQL ÀÇ ÇöÀç ÃֽŠ¹öÀü
MySQLÀº ÇöÀç °è¼ÓÀûÀ¸·Î ¾÷±×·¹À̵尡 ÀÌ·ç¾î Áö°í ÀÖ´Ù. 1998³â
4¿ù ÇöÀç·Î¼ °¡Àå ³ôÀº ¹öÀüÀº MySQL 3.21.27-gamma ÀÌ°í,
3.21.28-gamma °¡ °³¹ßµÇ¾î ÀÖÀ¸³ª ¾ÆÁ÷ ¹èÆ÷µÇÁö´Â ¾Ê°í ÀÖ´Ù.
°ð ¹èÆ÷°¡ ÀÌ·ç¾îÁö¸®¶ó°í »ý°¢ÀÌ µÇ¾îÁø´Ù.
¡á MySQL ¼³Ä¡ °¡´É OS
MySQLÀÇ ¼³Ä¡´Â ¸Å¿ì °£´ÜÇÏ´Ù. °ø½Ä »çÀÌÆ®·Î °¡¼ ¼Ò½º¸¦ °¡Áö°í
¿ÂÈÄ ÄÄÆÄÀÏÀ» ÇÏ¿© ¼³Ä¡ÇÏ¿©µµ µÇ°í, ¶Ç´Â ÄÄÆÄÀÏµÈ ½ÇÇà ÆÄÀÏÀ»
°¡Áö°í ¿Í¼ ½ÇÇàÇÏ¿©µµ ¹«¹æÇÏ´Ù.
ÇöÀç MySQLÀº °¢Á¾ OS¿¡¼ ¼³Ä¡µÇ°í ½ÇÇàµÉ¼ö ÀÖ´Ù. ½ÇÇà °¡´ÉÇÑ
OS¿Í ÆÐÅ°Áö´Â ´ÙÀ½°ú °°´Ù.
Solaris 2.5 & 2.6 with native threads.
SunOS 4.x with the included MIT threads package.
BSDI 2.x with the included MIT threads package.
BSDI 3.0 and 3.1 native threads.
SGI IRIX 6.x with native threads.
AIX 4.x whith native threads.
DEC UNIX 4.x with native threads.
Linux 2.0+ with LinuxThreads 0.5, 0.6 and 0.7.
FreeBSD 2.x with the included MIT threads package.
FreeBSD 3.x with native threads.
SCO OpenServer with a recent port of the FSU-threads package.
NetBSD 1.3 Intel and NetBSD 1.3 Alpha.
Openbsd 2.1
HPUX 10.20 with the included MIT threads package.
Win95 and NT. This version is currently only available for
users with a MySQL license or MySQL email support.
¡á MySQL À» ¼³Ä¡ÇÒ °æ¿ì ÇÊ¿äÇÑ °Í
MySQL À» ¼³Ä¡ÇÒ °æ¿ì ÇÊ¿äÇÑ °ÍÀÌ ÀÖ´Ù. ±×°ÍÀº ´ÙÀ½°ú °°´Ù.
- ¾ÐÃàµÇ¾îÁø ¹èÆ÷ÆÇÀ» Ç®±âÀ§ÇÑ GNU gzip ÇÁ·Î±×·¥
- tar ÇÁ·Î±×·¥
- ANSI C++ ÄÄÆÄÀÏ·¯.
- gcc ÄÄÆÄÀÏ·¯ : ¹öÀüÀº 2.7 ÀÌ»óÀΰÍ
¡á MySQL ÀÇ ¼³Ä¡¹æ¹ý
´ÙÀ½°ú °°Àº ¼ú¼·Î MySQLÀ» ¼³Ä¡ÇÑ´Ù.
1. °ø½Ä ȨÆäÀÌÁö¿¡¼ MySQLÀ» ¹Þ´Â´Ù.
2. root ¾ÆÀ̵ð·Î ¾Æ·¡ÀÇ ¸ðµç ÀÛ¾÷À» ÇÑ´Ù.
3. ´ÙÀ½ÀÇ ¸í·ÉÀ¸·Î ¾ÐÃàÀ» Ǭ´Ù.
gzip mysql-VERSION.tar.gz
¿©±â¼ mysql-VERSION.tar.gz Àº ¹æ±Ý ¹ÞÀº ¾ÐÃàÆÄÀÏÀÇ À̸§ÀÌ´Ù.
4. tar ¸í·ÉÀ» ÀÌ¿ëÇÏ¿© ¹¿©ÀÖ´Â ¼Ò½º¸¦ ´Ù½Ã Ç®¾î¾ß ÇÑ´Ù.
ÀÌ°æ¿ì mysql-VERSION À̶ó´Â µð·ºÅ丮°¡ »ý¼ºµÇ¸é¼ ±× ¾È¿¡ ¸ðµç
¼Ò½º¿Í ÆÄÀÏÀÌ Ç®¸®°Ô µÈ´Ù.
tar -xvf mysql-VERSION.tar
5. »ý¼ºµÈ µð·ºÅ丮·Î À̵¿ÇÑ´Ù.
cd mysql-VERSION
6. ȯ°æÀ» ¼³Á¤ÇÑ´Ù. ¸¸ÀÏ ¾î¶² ¿É¼ÇÀ» Ãß°¡Çϱ⸦ ¿øÇÑ´Ù¸é ´ÙÀ½°ú °°¾Æ ÇÑ´Ù.
./Configure --help
ÀÌ °æ¿ì °¢Á¾ ¿É¼ÇÀÌ ³ª¿À¹Ç·Î ÀÌ ³»¿ëÀ» º¸°í º¯°æÇϱ⠹ٶõ´Ù. ´õ ÀÚ¼¼ÇÑ
»çÇ×Àº ¿µ¹® ¸Þ´º¾óÀ» ÀÐ¾î º¸±â ¹Ù¶õ´Ù.
ÀϹÝÀûÀ¸·Î ±×³É ¾Æ·¡ÀÇ ¸í·ÉÀ» ½ÇÇàÇÏ¸é µÈ´Ù.
./Configure
7. 6Ç×ÀÇ ½ÇÇàÀÌ ³¡³ª¸é ´ÙÀ½ÀÇ ¸í·ÉÀ» ½ÇÇàÇÑ´Ù.
make
ÀÌ ¸í·É¿¡¼´Â ¸ðµç ³»¿ëÀÌ ÄÄÆÄÀÏ µÈ´Ù. 486-66¿¡¼ ¸Þ¸ð¸® 8¸Þ°¡ÀÎ
Àåºñ¿¡¼ ÄÄÆÄÀÏÀ» ÇÏ¿´´õ´Ï, 15½Ã°£ÀÌ °É·È´Ù. Àåºñ°¡ ÁÁ°í ¸Þ¸ð¸®°¡
´õ¿í ¸¹´Ù¸é 2~3½Ã°£ À̳»¿¡ ÄÄÆÄÀÏ µÇ¸®¶ó°í »ý°¢ÀÌ µÈ´Ù.
8. 7Ç×ÀÇ ÀÛ¾÷ÀÌ ³¡³ª¸é ÀÌÁ¦ ÄÄÆÄÀÏµÈ ½ÇÇàÆÄÀÏÀ» ÀνºÅç ÇÏ¿©¾ß ÇÑ´Ù.
make install
ÄÄÆÄÀÏµÈ ¸ðµç ½ÇÇà °¡´ÉÇÑ ÆÄÀÏÀÌ ¼³Ä¡°¡ µÇ°í ȯ°æÀÌ ¼³Á¤µÈ´Ù.
9. ¼³Ä¡°¡ ³¡³ÈÄ ¾Æ·¡ÀÇ ¸í·ÉÀ» ½ÇÇàÇÏ¿© ±âÃÊ Å×À̺í°ú admin À¯Àú¸¦ ¼³Ä¡
ÇÑ´Ù. ÀÌ ¸í·ÉÀº ´ÜÇѹøÇÑ ÇÏ´Â °ÍÀ¸·Î¼ µÎ¹ø ½ÇÇàÇÏ¸é ¾ÊµÈ´Ù. ÇöÀç 8Ç׿¡¼
ÀÛ¾÷ÇÑÈÄ µð·ºÅ丮¸¦ º¯°æÇÏÁö ¾Ê°í ¾Æ·¡ÀÇ ¸í·ÉÀ» ÀÔ·ÂÇÑ´Ù.
./scripts/mysql_install_db
ÀÌ °ÍÀº ½ºÅ©¸³Æ®·Î¼ ½ÇÇàÇÏ¿© ±âÃÊÀÛ¾÷À» ÇÑÈÄ MySQLÀ» ½ÇÇà½ÃÄÑ ÁØ´Ù.
10. ¼³Ä¡ µð·ºÅ丮¸¦ µðÆúÆ®·Î ÇÏ¿´´Ù¸é /usr/local/bin/ µð·ºÅ丮¿¡ ½ÇÇàÆÄÀÏÀÌ
¸ðµÎ ¼³Ä¡µÇ¾úÀ» °ÍÀÌ´Ù. µðÆúÆ®·Î ¼³Ä¡ÇÏ¿´´Ù°í °¡Á¤ÇÏ°í ´ÙÀ½ÀÇ ¸í·ÉÀ» ¼öÇà
ÇÏ¿© º»´Ù.
/usr/local/bin/mysqladmin version
MySQL ¹öÀü Á¤º¸°¡ ¾Æ·¡¿Í ºñ½ÁÇÏ°Ô Ãâ·ÂµÉ °ÍÀÌ´Ù.
mysqladmin Ver 6.8 Distrib 3.21.27-gamma, for unknown-freebsd2.2.1 on i386
TCX Datakonsult AB, by Monty
Server version 3.21.27-gamma-log
Protocol version 10
Connection localhost via TCP/IP
TCP port 3306
Uptime: 22 hours 20 min 9 sec
Running threads:1 Questions: 20 Opened_tables: 8 Reloads: 2 Open tables: 4
11. ÀÌÁ¦ mysql ÇÁ·Î±×·¥À» ¾Æ·¡¿Í °°ÀÌ ½ÇÇàÇÏ¿© ±âº»ÀûÀÎ µ¿ÀÛÀ» Å×½ºÆ®ÇÏÀÚ.
mysql mysql
ȤÀº mysql -u root mysql (½ÇÇà½ÃÅ°´Â À¯Àú°¡ root°¡ ¾Æ´Ò°æ¿ì)
12. ¾Æ·¡ÀÇ sql¹®ÀåÀ» mysql »ó¿¡¼ ¼öÇà½ÃÄѺ¸ÀÚ
select * from user
mysql ÀÇ »ç¿ë¹æ¹ýÀº mysqlÀÌ ½ÇÇàµÈ »óÅ¿¡¼ ´ÙÀ½ÀÇ ¸í·ÉÀ» ÁÖ¸é ¾Ë¼ö ÀÖ´Ù.
\h
°¢Á¾ ¸í·ÉÀ» Àß ÀÐ¾î º¸°í »ç¿ëÇÏ¸é µÈ´Ù. SQL¹®µµ Ç¥ÁØ SQLÀ» ¸ðµÎ Áö¿øÇϸç
MySQL¸¸ÀÇ È®Àå SQL¹®À» ¾Ë°í ½Í´Ù¸é ¿µ¹® ¸Þ´º¾óÀ» ÂüÁ¶Ç϶ó.(³ªÁß¿¡ ´Ù½Ã °
ÀÇÇÒ ¿¹Á¤)
¡á MySQL ServerÀÇ ½ÇÇà°ú Á¾·á
MySQL ServerÀ» ½ÇÇà ½ÃÅ°°Å³ª Á¾·á½ÃÅ°·Á¸é ´ÙÀ½ÀÇ ¸í·ÉÀ» root °¡ »ç¿ëÇÏ¸é µÈ´Ù.
mysql.server start --> mysql ServerÀÇ ½ÃÀÛ
mysql.server stop --> mysql ServerÀÇ Á¾·á
MySQL Server°¡ ½ÇÇà½Ã µÎ°³ÀÇ ÇÁ·Î¼¼¼°¡ ½ÇÇàµÇ¹Ç·Î È®ÀÎÇØ º¸±â ¹Ù¶õ´Ù.
< ½ÇÇàÁßÀÎ µÎ°³ÀÇ ÇÁ·Î¼¼¼ >
/usr/local/bin/safe_mysqld
/usr/local/libexec/mysqld
<< °á·Ð >>
´ÙÀ½ °Á¿¡¼´Â MySQL¿¡ °ü·ÃµÈ ½ÇÇà ÆÄÀÏ°ú ±âº»ÀûÀÎ sql¹®¿¡ ´ëÇÏ¿© °ÀÇ
Çϵµ·Ï ÇÏ°Ú½À´Ï´Ù. ¸¹Àº »ç¶÷µé¿¡°Ô µµ¿òÀÌ µÇ¾úÀ¸¸é ÇÕ´Ï´Ù.
-----------------------------
-----------------------------
------ MySQL °ÁÂ #2 -------
-----------------------------
-----------------------------
-- ÀÛ¼ºÀÚ : ¹Ú¼øÇà
-- ÀÛ¼ºÀÏ : 1998.4.11
-- hitel : soonhg
-- õ¸®¾È : soonhg
-- À¯´ÏÅÚ : soonhg
-- E-mail : soonhg@chollian.net
<< ¼·Ð >>
À̹ø¿¡´Â MySQL ¿¡ °ü·ÃµÈ ÇÁ·Î±×·¥°ú ±âº» ¼³Ä¡½Ã ÇÔ²² ¼³Ä¡µÇ´Â
À¯Æ¿¸®Æ¼¿¡ ´ëÇÏ¿© ¾Ë¾Æº¸µµ·Ï ÇÏ°Ú½À´Ï´Ù. ±âº» µ¿ÀÛ¿¡ ´ëÇÑ ¿¹Á¦µµ
¾à°£ Æ÷ÇÔÇÏ°í ³ªÁß¿¡ Á»´õ ÀÚ¼¼ÇÑ »çÇ×À» ´ã¾Æ¼ ´Ù½Ã ¿Ã¸®Áö¿ä.
¸¹Àº »ç¶÷µé¿¡°Ô µµ¿òÀÌ µÇ¾úÀ¸¸é ÇÕ´Ï´Ù.....
#######################################
# #
# MySQL ¿¡ °ü·ÃµÈ ÇÁ·Î±×·¥ ¹× #
# À¯Æ¿¸®Æ¼ #
# #
#######################################
¡á mysql
sql ¹®ÀåÀ» ¼öÇàÇÏ´Â Å͹̳¯ÀÌ´Ù. ´ëÈ½Ä »ç¿ë°ú ºñ´ëÈ½Ä Áú¹®À» Áö¿øÇÑ´Ù.
sql¹®À» ¶óÀÎ ¿¡µðÅÍ »óÅ¿¡¼ ¹Ù·ÎÀÛ¼ºÇÏ¿© ½ÇÇàÇÏ¸é µÈ´Ù.
»ç¿ë¹ýÀº mysql mysql ÇÏ¸é ¹Ù·Î »ç¿ëÇÒ¼ö ÀÖ´Ù.(root °èÁ¤ÀÏ °æ¿ì)
ÀÏ¹Ý °èÁ¤ »ç¿ëÀÚ´Â mysql -u root mysql ÇϸéµÈ´Ù. (¾ÏÈ£°¡ ¾øÀ»°æ¿ì)
mysql ¿¡ ´ëÇÑ »ç¿ë¹ýÀº mysql ½ÇÇà»óÅ¿¡¼ help ¶ó°í Ä¡¸é Ãâ·ÂµÈ´Ù.
¡á mysqlaccess
È£½ºÆ®¿Í »ç¿ëÀÚ µ¥ÀÌŸº£À̽ºÀÇ ¿¬°á¿¡ ´ëÇÑ Æ¯±ÇÀ» üũÇÏ´Â ½ºÅ©¸³Æ®ÀÌ´Ù.
¡á mysqladmin
MySQL ÀÇ °ü¸®¿ë À¯Æ¿¸®Æ¼ÀÌ´Ù. µ¥ÀÌŸº£À̽ºÀÇ »ý¼º,Á¦°Å, reload, ±×¸®°í
refresh µîÀ» ÇÑ´Ù. ¶ÇÇÑ MySQL¼¹ö·Î ºÎÅÍ »óÅÂÁ¤º¸¿Í ÁøÇà»óÅÂ, Á¤º¸µîÀ» ÁØ´Ù.
¡á mysqld
MySQL ÀÇ ¼¹ö µ¥¸óÀÌ´Ù. ÀÌ°ÍÀÌ Ç×»ó ½ÇÇàµÇ°í ÀÖ¾î¾ß¸¸ MySQL µ¥ÀÌŸº£À̽º¸¦
»ç¿ëÇÒ¼ö ÀÖ´Ù.
¡á mysqldump
MySQL µ¥ÀÌŸºñ¿¡½º¸¦ ÀÐ¾î¼ ÆÄÀÏ·Î ÀúÀåÇÑ´Ù.
SQL ¹®Àå ¶Ç´Â ÅÇÀ¸·Î ºÐ¸®µÈ ÅؽºÆ® ÆÄÀÏ·Î ÀúÀåÇÑ´Ù.
¡á mysqlimport
Çϳª ¶Ç´Â ´õ¸¹Àº ÅؽºÆ® ÆÄÀÏÀ» °³º°ÀûÀÎ Å×À̺í·Î ÀÔ·Â(ÀúÀå)ÇÑ´Ù.
LOAD DATA INFILE ¿¡ ÀÇÇØ Áö¿øµÇ´Â ¸ðµç Çü½ÃÀ» »ç¿ëÇÒ¼ö ÀÖ´Ù.
¡á mysqlshow
µ¥ÀÌŸº£À̽º¿Í, Å×À̺í, column, ±×¸®°í Index ¿¡ ´ëÇÑ Á¤º¸¸¦ º¸¿© ÁØ´Ù.
¡á mysqlbug
ÀÌ°ÍÀº ½ºÅ©¸³Æ®·Î¼ MySQL¹ö±× º¸°í¼¸¦ »ç¿ëÇÒ¶§ Ç×»ó »ç¿ëµÇ¾îÁö´Â °ÍÀÌ´Ù.
¡á mysql_install_db
µðÆúÆ® Ư±ÇÀ» »ç¿ëÇÏ¿© Å×À̺íÀÇ Çã°¡¸¦ »ý¼º½ÃÅ°´Â ½ºÅ©¸³Æ®ÀÌ´Ù.
MySQLÀ» ½Ã½ºÅÛ¿¡ óÀ½ ¼³Ä¡ÇÏ¿´À» °æ¿ì MySQLÀ» ½ÇÇàÇϱâ ÀÌÀü¿¡ ½ÇÇà½ÃÅ°´Â
°ÍÀ¸·Î¼ ÀÌ°ÍÀº ¼³Ä¡ÈÄ µü Çѹø¸¸ ½ÇÇàÇÏ´Â ½ºÅ©¸³Æ®ÀÌ´Ù.
¡á isamchk
MySQL Å×À̺íÀ» üũÇϰųª, optimise, ¶Ç´Â ÀÌ»ó»óŸ¦ ¼öÁ¤ÇÒ¶§ »ç¿ëÇÑ´Ù.
¡á make_binary_release
ÄÄÆÄÀÏµÈ MySQLÀÇ binary ¸±¸®Áî ¹öÀüÀ» ¸¸µç´Ù.
´Ù¸¥ MySQL »ç¿ëÀÚÀÇ ÆíÀ̸¦ À§ÇÏ¿© ÄÄÆÄÀÏµÈ ½ÇÇà¹öÀüÀ» ¸¸µé¶§ »ç¿ëµÈ´Ù.
¡á msql2mysql
shell ½ºÅ©¸³Æ®·Î¼ mSQL ÇÁ·Î±×·¥À» MySQL·Î º¯È¯ÇÑ´Ù.
¸ðµç°ÍÀ» º¯È¯ÇÏÁö´Â ¾ÊÁö¸¸ º¯È¯Çϱ⿡ ÁÁÀº »óÅ·Π¸¸µé¾îÁØ´Ù.
¡á replace
msql2mysql ¿¡ »ç¿ëµÇ´Â ½ÇÇàÆÄÀÏÀÌ´Ù.
¹®ÀÚ¿À» ÆÄÀÏ, Ç¥ÁØÀÔ·Â, ¶Ç´Â ¾î¶² ƯÁ¤ »óÅ·Πº¯È¯ÇÏ´Â ÇÁ·Î±×·¥ÀÌ´Ù.
¹®ÀÚ¿À» ±³È¯ÇÒ¶§µµ »ç¿ëÇÒ¼ö ÀÖ´Ù.
¿¹¸¦µé¸é a b b a (ÆÄÀÏ»óÀÇ a ¿Í b ¸¦ ±³È¯)
¡á safe_mysqld
¾î¶°ÇÑ ¾ÈÁ¤µÈ ÇüÅ·ΠMySQL µ¥¸óÀ» ½ÃÀÛ½ÃŲ´Ù.
¿À·ù½Ã Àç½ÃÀÛ ½ÃÅ°°í, ½ÇÇàÁ¤º¸ log ¸¦ log ÆÄÀÏ¿¡ ±â·ÏÇÑ´Ù.
-----------------------------
-----------------------------
------ MySQL °ÁÂ #3 -------
-----------------------------
-----------------------------
-- ÀÛ¼ºÀÚ : ¹Ú¼øÇà
-- ÀÛ¼ºÀÏ : 1998.4.11
-- hitel : soonhg
-- õ¸®¾È : soonhg
-- À¯´ÏÅÚ : soonhg
-- E-mail : soonhg@chollian.net
<< ¼·Ð >>
sql ¹®Àº µ¥ÀÌŸº£À̽º ÁúÀÇ¿¡ »ç¿ëµÇ´Â ´ëÈÇü ¾ð¾îÀÔ´Ï´Ù.
MySQLµµ ¿ª½Ã ÀÌ Ç¥ÁØ ´ëÈÇü ¾ð¾î¸¦ Áö¿øÇÏ°í ÀÖÀ¸¸ç,
´õ¿í È®ÀåµÈ °¢Á¾ sql¹®À» ³»Æ÷ÇÏ°í ÀÖ½À´Ï´Ù.. °£´ÜÇÏ°Ô ³ª¸¶
Á¦°¡ MySQL¿¡ ´ëÇÏ¿© MySQL¹®»óÀÇ ³»¿ëÀ» ¹ø¿ªÇÏ¿´½À´Ï´Ù.
¸¹Àº »ç¶÷µé¿¡°Ô µµ¿òÀÌ µÇ¾úÀ¸¸é ÇÕ´Ï´Ù.....
#######################################
# #
# MySQL ¿¡¼ »ç¿ëµÇ´Â sql¹® Á¤¸® #
# #
#######################################
¡á CREATE DATABASE database_name (µ¥ÀÌŸº£À̽ºÀ̸§)
µ¥ÀÌŸ º£À̽º À̸§Àº ¹®ÀÚ¿Í ¼ýÀÚ, '_' ¸¦ Æ÷ÇÔÇÏ´Â 32 byte À̳»·Î
ÀÛ¼ºÇÑ´Ù. ÀÌ ¸í·ÉÀº »õ·Î¿î µ¥ÀÌŸº£À̽º °ø°£À» »ý¼º½ÃŲ´Ù. Oracle·Î
¸»ÇÏÀÚ¸é tablespace¿Í °°Àº Å×À̺íÀÌ µé¾î°¡´Â ÀúÀå °ø°£À» ¸»ÇÑ´Ù.
¡á DROP DATABASE database_name
Á¸ÀçÇÏ´Â µ¥ÀÌŸº£À̽º¸¦ Á¦°ÅÇÑ´Ù. µ¥ÀÌŸº£À̽º »ó¿¡ Á¸ÀçÇÏ´Â Å×ÀÌºíµµ
¸ðµÎ »èÁ¦ µÇ¹Ç·Î ¸Å¿ì Á¶½ÉÇÏ¿© ÀÛ¾÷ÇÏ¿©¾ß ÇÑ´Ù. Çѹø »èÁ¦µÇ¸é º¹±¸´Â
ºÒ°¡´É ÇϹǷΠµ¥ÀÌŸ º£À̽º »óÀÇ Å×À̺í°ú µ¥ÀÌŸ°¡ ¸ðµÎ ¹é¾÷ÀÌ µÇ¾ú´Â
Áö È®ÀÎÇÏ°í ÀÛ¾÷ÇÑ´Ù.
¡á CREATE TABLE table_name ( create_definition,... )
µ¥ÀÌŸº£À̽º »ó¿¡ Å×À̺íÀ» »ý¼º½ÃÅ°´Â ¸í·ÉÀÌ´Ù. ÀÚ¼¼ÇÑ ¿É¼ÇÀº ´ÙÀ½°ú
°°´Ù. Oracle ÀÇ table »ý¼º ¸í·É°ú °ÅÀÇ À¯»çÇÏ¸ç ºÎ°¡ÀûÀÎ type ÀÌ Á¸ÀçÇÑ´Ù.
create_definition:
column_name type [NOT NULL | NULL] [DEFAULT default_value] [AUTO_INCREMENT]
[ PRIMARY KEY ] [reference_definition]
or PRIMARY KEY ( index_column_name,... )
or KEY [index_name] KEY( index_column_name,...)
or INDEX [index_name] ( index_column_name,...)
or UNIQUE [index_name] ( index_column_name,...)
or FOREIGN KEY index_name ( index_column_name,...) [reference_definition]
or CHECK (expr)
type:
TINYINT[(length)] [UNSIGNED] [ZEROFILL]
or SMALLINT[(length)] [UNSIGNED] [ZEROFILL]
or MEDIUMINT[(length)] [UNSIGNED] [ZEROFILL]
or INT[(length)] [UNSIGNED] [ZEROFILL]
or INTEGER[(length)] [UNSIGNED] [ZEROFILL]
or BIGINT[(length)] [UNSIGNED] [ZEROFILL]
or REAL[(length,decimals)] [UNSIGNED] [ZEROFILL]
or DOUBLE[(length,decimals)] [UNSIGNED] [ZEROFILL]
or FLOAT[(length,decimals)] [UNSIGNED] [ZEROFILL]
or DECIMAL[(length,decimals)] [UNSIGNED] [ZEROFILL]
or NUMERIC[(length,decimals)] [UNSIGNED] [ZEROFILL]
or CHAR(length) [BINARY],
or VARCHAR(length) [BINARY],
or DATE
or TIME
or TIMESTAMP
or DATETIME
or TINYBLOB
or BLOB
or MEDIUMBLOB
or LONGBLOB
or TINYTEXT
or TEXT
or MEDIUMTEXT
or ENUM(value1,value2,value3...)
or SET(value1,value2,value3...)
index_column_name:
column_name [ (length) ]
reference_definition:
REFERENCES table_name [( index_column_name,...)]
[ MATCH FULL | MATCH PARTIAL]
[ ON DELETE reference_option]
[ ON UPDATE reference_option]
reference_option:
RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT
¡á ALTER [IGNORE] TABLE table_name alter_spec [, alter_spec ...]
Á¸ÀçÇÏ´Â Å×À̺íÀ» º¯°æ ¹× columndÀÇ Ãß°¡ ÀÛ¾÷½Ã »ç¿ëµÈ´Ù.
alter_specification:
ADD [COLUMN] create_definition
or CHANGE [COLUMN] old_column_name create_definition
or ALTER [COLUMN] column_name { SET DEFAULT literal | DROP DEFAULT }
or ADD INDEX [index_name] ( index_column_name,...)
or ADD UNIQUE [index_name] ( index_column_name,...)
or DROP [COLUMN] column_name
or DROP PRIMARY KEY
or DROP INDEX key_name
or RENAME AS new_table_name
¡á DROP TABLE table_name [, table_name...]
Á¸ÀçÇÏ´Â Å×À̺íÀ» Á¦°ÅÇÒ °æ¿ì »ç¿ëµÇ´Â ¸í·ÉÀÌ´Ù.
¡á DELETE FROM table_name WHERE where_definition
Á¸ÀçÇÏ´Â Å×ÀÌºí »óÀÇ µ¥ÀÌŸ¸¦ »èÁ¦ÇÒ¶§ »ç¿ëÇÏ´Â ¸í·ÉÀÌ´Ù.
¡á SELECT ¹®
Á¸ÀçÇÏ´Â Å×ÀÌºí »óÀÇ µ¥ÀÌŸ¸¦ Á¶È¸ÇÒ¶§ »ç¿ëÇÏ´Â ¸í·ÉÀÌ´Ù.
±âº»ÀûÀÎ »ç¿ë¹ýÀº ´ÙÀ½°ú °°´Ù.
SELECT [STRAIGHT_JOIN] [DISTINCT | ALL] select_expression,...
[INTO OUTFILE 'file_name' ...]
[ FROM table_references
[WHERE where_definition ]
[GROUP BY column,...]
[HAVING where_definition]
[ ORDER BY column [ASC | DESC] ,..] [LIMIT [offset,] rows]
[PROCEDURE procedure_name]]
¡á JOIN ¹®
Oracle ¿¡¼ »ç¿ëÇÏ´Â join ¹®º¸´Ù Á»´õ È®ÀåµÈ join ¹®À» Áö¿øÇÑ´Ù.
table_reference, table_reference
table_reference [CROSS] JOIN table_reference
table_reference LEFT [OUTER] JOIN table_reference ON conditional-expr
table_reference LEFT [OUTER] JOIN table_reference USING (column-commalist)
table_reference NATURAL LEFT [OUTER] JOIN table_reference
{ oj table_reference LEFT OUTER JOIN table_reference ON conditional-expr }
¡á INSERT ¹®
Á¸ÀçÇÏ´Â Å×ÀÌºí¿¡ µ¥ÀÌŸ¸¦ ÀÔ·ÂÇÒ¶§ »ç¿ëÇÑ´Ù.
INSERT INTO table [ (column_name,...) ] VALUES (expression,...)
or INSERT INTO table [ (column_name,...) ] SELECT ...
¡á REPLACE ¹®
ÀÌ ¹®ÀåÀº INSERT¹®Àå°ú °ÅÀÇ À¯»çÇÏ°Ô µ¿ÀÛÇÑ´Ù. °°Àº ·¹Äڵ尡 ÀÖÀ»°æ¿ì
ÀÌ ·¹Äڵ带 »èÁ¦ÇÑÈÄ INSERT ÀÛ¾÷À» ÇÑ´Ù. °°Àº ?Äڵ尡 ¾øÀ» °æ¿ì´Â INSERT
¿Í °°ÀÌ µ¿ÀÛÇÑ´Ù.
REPLACE INTO table [ (column_name,...) ] VALUES (expression,...)
or REPLACE INTO table [ (column_name,...) ] SELECT ...
¡á LOAD DATA INFILE ¹®
Server »ó¿¡ À§Ä¡ÇÏ´Â text ÆÄÀÏ·Î ºÎÅÍ µ¥ÀÌŸ¸¦ ÀÐ¾î¼ Å×ÀÌºí¿¡ ÀÔ·ÂÀÛ¾÷À»
ÇÒ °æ¿ì »ç¿ëÇÑ´Ù. ¸Å¿ì ¼Óµµ°¡ ºü¸£´Ù.
LOAD DATA INFILE 'text_file_name.text' [REPLACE | IGNORE]
INTO TABLE table_name
[FIELDS [TERMINATED BY ',' [OPTIONALLY] ENCLOSED BY '"' ESCAPED BY '\\'
]]
[LINES TERMINATED BY '\n']
[(Field1, Field2...)]
Å×À̺í·Î ºÎÅÍ µ¥ÀÌŸ¸¦ ÀÐ¾î¼ text ÆÄÀÏ¿¡ µ¥ÀÌŸ¸¦ ÀúÀåÇÒ°æ¿ì ´ÙÀ½°ú °°ÀÌ
»ç¿ëÇÑ´Ù.
SELECT ...
INTO OUTFILE 'interval.txt' fields terminated by ','
enclosed by '"'
escaped by '\\' lines terminated by '\n'
FROM ...
¡á UPDATE ¹®
Å×ÀÌºí »ó¿¡ Á¸ÀçÇÏ´Â µ¥ÀÌŸ¸¦ º¯°æÇÒ °æ¿ì »ç¿ëÇÑ´Ù.
UPDATE table SET column=expression,... WHERE where_definition
¡á SHOW syntax. Get information about tables, columns...
MySQL »óÀÇ °¢Á¾ Á¤º¸¸¦ º¸¿©ÁØ´Ù. µ¥ÀÌŸ º£À̽º, Å×À̺í, columnµîÀ»
È®ÀÎÇÒ¼ö ÀÖ´Ù.
SHOW DATABASES [LIKE wild]
or SHOW TABLES [FROM database] [LIKE wild]
or SHOW COLUMNS FROM table [FROM database] [LIKE wild]
or SHOW INDEX FROM table [FROM database]
or SHOW STATUS
or SHOW VARIABLES [LIKE wild]
¡á EXPLAIN syntax. Get information about a SELECT.
select ¹®°ú À̶§ ¿ä±¸µÇ´Â Å×ÀÌºí¿¡ ´ëÇÑ Á¤º¸¸¦ ÁØ´Ù. ÀÏ¹Ý select ¹®ÀÇ
óÀ½¿¡ EXPLAIN À» Ãß°¡ÇÏ¸é µ¿ÀÛÇÑ´Ù.
EXPLAIN SELECT select_options
¡á DESCRIBE syntax
Á¸ÀçÇÏ´Â Å×ÀÌºí¿¡¼ column Á¤º¸¸¦ °¡Áö°í ¿Â´Ù.
(DESCRIBE | DESC) table [column]
¡á LOCK TABLES syntax
Å×ÀÌºí¿¡ lock À» ¼³Á¤ÇÏ¿© ŸÀÎÀÌ ÀÐÁö ¸øÇÏ°Ô ÇÒ¶§ »ç¿ëÇÑ´Ù.
ÁÖÀÇÇÒ Á¡Àº ÇÑ»ç¶÷ÀÌ lock À» ½ÇÇàÇϸé ÀÌ »ç¶÷ÀÌ »ç¿ëÇÏ´Â ¸ðµç Å×À̺íÀÌ
lockµÇ¹Ç·Î »ç¿ëÈÄ ²À unlock¸¦ »ç¿ëÇÏ¿© lock¸¦ Ç®µµ·Ï ÇÑ´Ù.
LOCK TABLES table_name [AS alias] READ|WRITE [, table_name READ|WRITE]
...
UNLOCK TABLES
¡á SET OPTION syntax.
ÇöÀç »ç¿ëÁßÀÎ ¼¼¼ÇÀÌ »ç¿ëµÇ´Â µ¿¾È Áö¼ÓÀûÀ¸·Î ¿µÇâÀ» ÁØ´Ù. ¿©·¯ ¿É¼ÇÀÌ
ÀÖÀ¸¹Ç·Î ¿øº» ¸Þ´º¾óÀ» ÂüÁ¶Çϱ⠹ٶõ´Ù.
SET [OPTION] SQL_VALUE_OPTION=value, ...
¡á GRANT ¹® ( ȣȯ¸í·É)
ÀÌ ¸í·ÉÀ» »ç¿ëÇÏÁö´Â ¾Ê°í ´ÜÁö ȣȯ¼º¹®Á¦ ¶§¹®¿¡ MySQL Á¸ÀçÇÑ´Ù.
ÀÌ ¸í·ÉÀº ´Ù¸¥ SQL ¼¹ö·Î ºÎÅÍ MySQL·Î ½±°Ô º¯È¯Çϱâ À§ÇÏ¿© ¸¸µéÁ³´Ù.
MySQL ¿¡¼ÀÇ Æ¯±ÇÀº MySQL Çã°¡ Å×À̺íÀ» ÀÌ¿ëÇÏ¿© ´Ù·ç¾î Áø´Ù.
¼½¼Ç 6.2 ÀÇ Æ¯±Ç ½Ã½ºÅÛ ¾÷¹«¸¦ ÇÏ´Â ¹æ¹ýÀ» Âü°í Ç϶ó.
GRANT (ALL PRIVILEGES | (SELECT, INSERT, UPDATE, DELETE,
REFERENCES (column list), USAGE))
ON table TO user,... [WITH GRANT OPTION]
¡á CREATE INDEX ¹® (ȣȯ¸í·É)
ÀÌ ¸í·ÉÀ» »ç¿ëÇÏÁö´Â ¾Ê°í ´ÜÁö ȣȯ¼º¹®Á¦ ¶§¹®¿¡ MySQL Á¸ÀçÇÑ´Ù.
ALTER TABLE À» »ç¿ëÇÏ¿© »õ·Î¿î index ¸¦ »ý¼ºÇÒ¼ö ÀÖ´Ù.
¼½¼Ç 7.7 ÀÇ ALTER TABLE ÀÇ ¹®¹ýÀ» º¸¾Æ¶ó.
CREATE [UNIQUE] INDEX index_name ON table_name ( column_name,... )
¡á DROP INDEX ¹® (ȣȯ¸í·É)
ÀÌ ¸í·ÉÀº Ç×¼º ¼º°øÇÒ °ÍÀÌ´Ù. ALTER TABLE À» »ç¿ëÇÏ¿© index ¸¦ Á¦°ÅÇÒ¼öÀÖ´Ù.
¼½¼Ç 7.7 ÀÇ ALTER TABLE ÀÇ ¹®¹ýÀ» º¸¾Æ¶ó.
DROP INDEX index_name
¡á Comment ¹®¹ý
ÇÑÁÙÀÇ ÁÖ¼®Àº # ·Î ÇÏ°í ÁÖ¼®ÀÇ ³»¿ëÀÌ ¿©·¯ÁÙÀÏ °æ¿ì´Â /* */ ¸¦ ÀÌ¿ëÇÏ¿©
ÁÖ¼®À» ó¸®ÇÒ¼ö ÀÖ´Ù.
¡á CREATE FUNCTION ¹®¹ý
MySQL ÀÇ ±âº» ÇÔ¼öÀÎ ABS(), constr() ó·³ »õ·Î¿î »ç¿ëÀÚ Á¤ÀÇ ÇÔ¼ö¸¦ »ý¼º
ÇÏ´Â ÇÔ¼öÀÌ´Ù. »ç¿ëÀÚÁ¤ÀÇÇÔ¼öÀÇ ¼Ò½º´Â C, C++·Î ÀÛ¼ºµÇ¾î¾ß ÇÏ°í µ¿ÀûÀ¸·Î
ÀÐÇôÁö´Â°ÍÀÌ ¿ä±¸µÇ¾î Áø´Ù. ¿¹Á¦·Î¼ ¹èÆ÷ÆÇ¿¡ º¸¸é udf_example.cc °¡ ÀÖ
°í 5°³ÀÇ »õ·Î¿î »ç¿ëÀÚÁ¤ÀÇÇÔ¼ö°¡ ÀÛ¼ºµÇ¾î ÀÖ´Ù.
CREATE FUNCTION <function_name> RETURNS [string|real|integer]
SONAME <name_of_shared_library>
DROP FUNCTION <function_name>
-----------------------------
-----------------------------
------ MySQL °ÁÂ #4 -------
-----------------------------
-----------------------------
-- ÀÛ¼ºÀÚ : ¹Ú¼øÇà
-- ÀÛ¼ºÀÏ : 1998.4.11
-- hitel : soonhg
-- õ¸®¾È : soonhg
-- À¯´ÏÅÚ : soonhg
-- E-mail : soonhg@chollian.net
<< ¼·Ð >>
MySQLÀº PHP¿Í ÇÔ²² »ç¿ëµÇ´Â °æ¿ì°¡ ¸Å¿ì ¸¹½À´Ï´Ù.
¶Ç Perl ¾ð¾î¿Í ¸¹ÀÌ »ç¿ëµÇ´õ±º¿ä. ÇÏÁö¸¸ Àú´Â C ¾ð¾î¸¦ ÀÌ¿ëÇÏ¿©
¿¬°áÇÏ·Á°í ÇÕ´Ï´Ù. ±×·¡¼ C¿Í ¿¬°áµÇ´Â API ÂÊÀÇ ÇÔ¼öµéÀ» Á¤¸®ÇØ
º¸¾Ò½À´Ï´Ù. ´ÙÀ½¿¡´Â MySQL °ú C API ¸¦ ÀÌ¿ëÇÑ ÇÁ·Î±×·¥ ¿¹Á¦¸¦
°£´ÜÈ÷ Á¤¸®Çؼ ¿Ã¸®°Ú½À´Ï´Ù.
¸¹Àº »ç¶÷µé¿¡°Ô µµ¿òÀÌ µÇ¾úÀ¸¸é ÇÕ´Ï´Ù.....
#######################################
# #
# MySQL µ¥ÀÌŸ º£À̽º¿Í C ¿ÍÀÇ #
# ¿¬°áÀ» À§ÇÑ API¼³¸í #
# #
#######################################
<ÀбâÀü¿¡ Âü°íÇÒ »çÇ×>
¾Æ·¡ ³»¿ë¿¡¼ 'µ¥ÀÌŸº£À̽º(Å×ÀÌºí½ºÆäÀ̽º)' ¶ó°í ÇÑ °ÍÀº Å×À̺íµéÀÌ
ÀúÀåµÇ´Â °ø°£À» ¸»ÇÑ´Ù. Áï Å×À̺íµéÀÌ ÀúÀåµÇ¾îÁö´Â °ø°£Àº ¿©·¯°³·Î
³ª´©¾îÁ® Àִµ¥, ±× °ø°£À» MySQL¿¡¼´Â µ¥ÀÌŸº£À̽º ¶ó°í ÇÏ°í Oracle
¿¡¼´Â Å×ÀÌºí½ºÆäÀ̽º¶ó°í ÇÑ´Ù. ÀÌÇظ¦ µ½±â À§ÇÏ¿© µÎ°¡Áö Ç¥ÇöÀ» ¸ðµÎ
µÎ¾úÀ½.
int mysql_affected_rows(MYSQL *mysql)
°¡Àå ÃÖ±ÙÀÇ UPDATE, DELETE, INSERT µÇ¾îÁø rowÀÇ ¹øÈ£¸¦ °Ë»öÇÑ´Ù.
void mysql_close(MYSQL *mysql)
MySQL ¼¹ö¿ÍÀÇ ¿¬°áÀ» Á¾·áÇÑ´Ù.
MYSQL *mysql_connect(MYSQL *mysql, const char *host,
const char *user, const char *passwd)
MySQL ¼¹ö·Î ¿¬°á½ÃŲ´Ù.
int mysql_create_db(MYSQL *mysql, const char *db)
µ¥ÀÌŸº£À̽º(Å×ÀÌºí½ºÆäÀ̽º)¸¦ »ý¼º½ÃŲ´Ù.
void mysql_data_seek(MYSQL_RES *res, uint offset)
SQL Äõ¸® °á°ú set ¾È¿¡¼ ÀÓÀÇÀÇ ÇàÀ» ã´Â´Ù.
int mysql_drop_db(MYSQL *mysql, const char *db)
µ¥ÀÌŸº£À̽º(Å×ÀÌºí½ºÆäÀ̽º)¸¦ Á¦°ÅÇÑ´Ù.
int mysql_eof(MYSQL_RES *)
¸¶Áö¸· row¸¦ Àоú´ÂÁö¸¦ üũÇÏ¿© ÁØ´Ù.
char *mysql_error(MYSQL *mysql)
¸¶Áö¸· MySQL µ¿ÀÛÀ¸·ÎºÎÅÍÀÇ ¿¡·¯ ¸Þ½ÃÁö¸¦ °¡Á®¿Â´Ù.
MYSQL_FIELD *mysql_fetch_field(MYSQL_RES *handle)
Å×À̺í Çʵ忡 Á¸ÀçÇÏ´Â type À» ã¾Æ³½´Ù.
°â»ö°á°ú¾øÀÌ BLOB ÀÇ ±æÀ̸¦ Äõ¸®ÇÒ¶§ MySQL Àº µðÆúÆ® BLOB ±æÀ̸¦ µÇµ¹·ÁÁØ´Ù.
ÀÌ ±æÀÌ´Â Å×ÀÌºí »ó¿¡¼ select µ¿À۽à 8192 byte ÀÌ´Ù.
Çѹø °á°ú¸¦ °Ë»öÇÒ¶§, column_object->max_length ´Â ƯÁ¤ÇÑ Äõ¸®¿¡ ´ëÇÑ ½ÇÁ¦
max_length ¸¦ Æ÷ÇÔÇÑ´Ù. 8192 byte ¶ó´Â Å©±â°¡ ¼±ÅõǴ ÀÌÀ¯´Â MySQLÀÌ BLOB¿¡
´ëÇÑ ÃÖ´ë ±æÀ̸¦ ¾ËÁö ¸øÇϱ⠶§¹®ÀÌ´Ù. ÀÌ°ÍÀº ¾ðÁ¨°¡´Â °¡´ÉÇÏ°Ô µÉ°ÍÀÌ´Ù.
unsigned int *mysql_fetch_lengths(MYSQL_RES *mysql)
Äõ¸® °á°ú °ª »óÀÇ ¸ðµç column ÀÇ ±æÀ̸¦ µÇµ¹·Á ÁØ´Ù.
MYSQL_ROW mysql_fetch_row(MYSQL_RES *mysql)
Äõ¸® °á°ú¿¡¼ ´ÙÀ½ row¸¦ fetch ÇÑ´Ù.
void mysql_field_seek(MYSQL_RES *result, int field)
ƯÁ¤ÇÑ column À§Ä¡·Î À̵¿ÇÑ´Ù.(Äõ¸® °á°ú¿¡ ´ëÇÏ¿©)
void mysql_free_result(MYSQL_RES *result)
Äõ¸®°á°ú°¡ ÀúÀåµÇ¾î ÀÖ´ø ¸Þ¸ð¸®¸¦ ÇØÁ¦ÇÑ´Ù.
char *mysql_get_client_info(void)
ÇöÀç client ¶óÀ̺귯¸®¿¡ ´ëÇÑ ¹öÀü Á¤º¸¸¦ ¸®ÅÏÇÑ´Ù.
char *mysql_get_host_info(MYSQL *mysql)
È£½ºÆ®ÀÇ À̸§À» µ¹·ÁÁØ´Ù.
int mysql_get_proto_info(MYSQL *mysql)
¿¬°á¿¡ »ç¿ëµÈ ÇÁ·ÎÅäÄÝ ¹öÀüÀ» ¸®ÅÏÇÑ´Ù.
char *mysql_get_server_info(MYSQL *mysql)
MySQL ¼¹öÀÇ ¹öÀü ¹øÈ£¸¦ ¸®ÅÏÇÑ´Ù.
int mysql_insert_id(MYSQL *mysql)
AUTO_INCREMENT Çʵ忡 ÀÇÇØ ¹ß»ýµÈ ID¸¦ ¸®ÅÏÇÑ´Ù.
MYSQL_RES *mysql_list_dbs(MYSQL *mysql, const char *wild)
ºÎÇյǴ µ¥ÀÌŸº£À̽º À̸§À» ¸®ÅÏÇÑ´Ù.
MYSQL_RES *mysql_list_fields(MYSQL *mysql, const char *table,
const char *wild)
ºÎÇյǴ ÇʵåÀ̸§À» ¸®ÅÏÇÑ´Ù.
MYSQL_RES *mysql_list_processes(MYSQL *mysql)
ÇöÀç ¼¹ö ÇÁ·Î¼¼¼ÀÇ ¸ñ·ÏÀ» °¡Á®¿Â´Ù.
MYSQL_RES *mysql_list_tables(MYSQL *mysql, const char *wild)
ºÎÇյǴ Å×À̺í À̸§À» ¸®ÅÏÇÑ´Ù.
int mysql_num_fields(MYSQL_RES *result)
Á¶È¸°á°ú set ¿¡¼ column ÀÇ ¼ö¸¦ ¸®ÅÏÇÑ´Ù.
int mysql_num_rows(MYSQL_RES *result)
Á¶È¸°á°ú set ¿¡¼ rowÀÇ ¼ö¸¦ ¸®ÅÏÇÑ´Ù.
int mysql_query(MYSQL *mysql, const char *query)
SQL Äõ¸®¸¦ ½ÇÇàÇÑ´Ù.
int mysql_real_query(MYSQL *mysql, const char *query, uint length)
SQL Äõ¸®¸¦ ±æÀÌ Á¤º¸¿Í ÇÔ²² ½ÇÇàÇÑ´Ù.
int mysql_reload(MYSQL *mysql)
MySQL¼¹ö»ó¿¡ »ç¿ëÀÚ Æ¯±Ç Å×À̺íÀ» ´Ù½Ã ÀûÀç ½ÃŲ´Ù.
int mysql_select_db(MYSQL *mysql, const char *db)
ƯÁ¤ µ¥ÀÌŸº£À̽º(Å×ÀÌºí½ºÆäÀ̽º)¿Í ¿¬°áÇÑ´Ù.
int mysql_shutdown(MYSQL *mysql)
MySQL µ¥ÀÌŸ º£À̽º ¼¹ö¸¦ shutdown ÇÑ´Ù.
char *mysql_stat(MYSQL *mysql)
MySQL¼¹öÀÇ »óŸ¦ ¹®ÀÚ¿·Î ¸®ÅÏÇÑ´Ù.
MYSQL_RES *mysql_store_result(MYSQL *mysql)
°á°ú set À» client ·Î º¸³»¾î ÀúÀåÇÑ´Ù.
MYSQL_RES *mysql_use_result(MYSQL *mysql)
°¢°¢ÀÇ row ¿¡ ´ëÇÏ¿© µ¿Àû °á°ú setÀ» ÃʱâÈÇÑ´Ù.
-----------------------------
-----------------------------
------ MySQL °ÁÂ #5 -------
-----------------------------
-----------------------------
-- ÀÛ¼ºÀÚ : ¹Ú¼øÇà
-- ÀÛ¼ºÀÏ : 1998.4.23
-- hitel : soonhg
-- õ¸®¾È : soonhg
-- À¯´ÏÅÚ : soonhg
-- E-mail : soonhg@niceday.co.kr
<< ¼·Ð >>
MySQL ¼³Ä¡¸¦ ÇÑÈÄ »ç¿ë¹æ¹ýÀ» ¸ô¶ó ÇÑÂü ÀڷḦ ã¾ÒÁö¿ä..
ÀÚ·á°¡ ¾ø¾î °í¹ÎÇÏ´Ù°¡ MySQL ¸ÞÀϸµ ¸®½ºÆ®¿¡ ¿Ã¶ó¿À´Â
±ÛµéÀ» Âü°í·Î »ç¿ë¹ýÀ» ¾Ë¾Æ³»¾úÁö¿ä.. ¹°·Ð ¿µ¹® ¸Þ´º¾óµµ ¹«Ã´
µµ¿òÀÌ µÇ¾ú´ä´Ï´Ù. ³»¿ëÀº Ãʱâ ÀνºÅçÈÄ root »ç¿ëÀÚ ¾ÏÈ£
¼³Á¤¹æ¹ý°ú DB»ç¿ëÀÚ µî·Ï¹× ±ÇÇѼ³Á¤, µ¥ÀÌŸº£À̽º »ý¼º ¹æ¹ý,
±âº» »ç¿ë¹ý ÀÔ´Ï´Ù.
¸¹Àº »ç¶÷µé¿¡°Ô µµ¿òÀÌ µÇ¾úÀ¸¸é ÇÕ´Ï´Ù.....
#######################################
# #
# MySQL ¼³Ä¡ÈÄ ±âº»ÀûÀÎ »ç¿ë¹ý°ú #
# rootÀÇ ¾ÏÈ£¼³Á¤ #
# #
#######################################
1. MySQL »ç¿ëÇϱâ
1.1 MySQL ¼¹ö ½ÃÀÛÇϱâ
MySQLÀÌ Á¤»óÀûÀ¸·Î ¼³Ä¡ µÇ¾ú´Ù¸é ±×¸®°í µðÆúÆ® ¿É¼ÇÀ¸·Î ¼³Ä¡
ÇÏ¿´´Ù¸é /usr/local/bin/ µð·ºÅ丮¿¡ °ü·Ã ½ÇÇà ÆÄÀÏÀÌ ¼³Ä¡ µÇ¾ú
À» °ÍÀÌ´Ù. ¸ÕÀú MySQL ¼¹ö¸¦ ½ÇÇàÇÏ´Â ¸í·ÉÀº ´ÙÀ½°ú °°´Ù.
¹°·Ð root ¾ÆÀ̵ð·Î ½ÇÇàÇØ¾ß ÇÑ´Ù.(´Ù¸¥¹æ¹ýÀÌ ÀÖÀ¸¸é ¾Ë·ÁÁÖ¼¼¿ä)
mysql.server start
À§¿Í °°ÀÌ ÀÔ·ÂÇÏ¸é ¼¹ö°¡ ½ÇÇàµÈ´Ù. µÎ°³ÀÇ ÇÁ·Î¼¼¼°¡ µ¥¸ó»óÅ·Î
½ÇÇàµÇ´Âµ¥, safe_mysqld, mysqld ÀÌ·¸°Ô µÎ°³ÀÌ´Ù.
ÀÌ µÎ°³ÀÇ ÇÁ·Î¼¼¼°¡ ½ÇÇàµÇ°í ÀÖ´Ù¸é ÀÌÁ¦ MySQLÀ» »ç¿ëÇÒ¼ö ÀÖ´Ù.
MySQL µÎ¹ø° °Á¿¡¼ º¸¸é À§ÀÇ µÎ ÇÁ·Î±×·¥¿¡ ´ëÇÑ ¼³¸íÀÌ ³ª¿Í ÀÖ´Ù.
ÀÌ »óÅ¿¡¼ ¾Æ·¡¿Í °°ÀÌ MySQLÀ» »ç¿ëÇÒ¼ö ÀÖ´Â °¡»ó Å͹̳¯À» ½ÇÇà½ÃŲ´Ù.
mysql -u root mysql
MySQLÀÌ Ã³À½ ¼³Ä¡µÇ¸é DB admin user ´Â root ÀÌ´Ù. ¸ô·Ð ÀÌ°ÍÀº º¯°æ
ÇÒ¼öµµ ÀÖ´Ù. µðÆúÆ®·Î ¼³Ä¡ÇÑ °æ¿ì ¾ÏÈ£°¡ óÀ½¿¡´Â »ý¼ºµÇ¾î ÀÖÁö ¾ÊÀ¸
¹Ç·Î À§¿Í °°ÀÌ ÇÏ¸é ½ÇÇàÀÌ µÈ´Ù. À§ÀÇ ¸í·É¿¡ ´ëÇÑ ¼³¸íÀº ´ÙÀ½°ú °°´Ù.
mysql -u root mysql
½ÇÇàÆÄÀÏ À¯Àú¼±Åà root db À¯Àú »ç¿ëÇÒµ¥ÀÌŸº£À̽º
±×¿Ü ¸î°¡Áö °£´ÜÇÑ ¿É¼ÇÀÌ ÀÖÀ¸³ª ÇÊ¿äÇϸé mysql -h ÇÏ¿© ³»¿ëÀ» Âü°í
Çϱ⠹ٶõ´Ù. ±×¸®°í, root À¯Àú¿¡ ¾ÏÈ£¸¦ ¼³Á¤ÇÑ ÈÄ ºÎÅÍ´Â -p ¿É¼ÇÀ»
Çϳª´õ Ãß°¡ÇÏ¿© ½ÇÇàÇϱ⠹ٶõ´Ù. ÀÌ ¿É¼ÇÀº Æнº¿öµå¸¦ ÀԷ¹޴ ¿É¼ÇÀÌ´Ù.
1.2 mysql ÇÁ·Î±×·¥ÀÇ »ç¿ë
mysqlÀ» ½ÇÇàÇÏ¿© °£´ÜÇÑ µ¿ÀÛÀ» ÇÏ¿©º¸ÀÚ.
mysqlÀº ÀÏ¹Ý À¯Àú·Î ½ÇÇàÇÏ¿©µµ µÇ´Â ÇÁ·Î±×·¥ÀÌ´Ù.
$ mysql -u root mysql ---> DB »ç¿ëÀ» À§ÇÑ ½ÇÇà
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.21.27-gamma-log
Type 'help' for help.
mysql>
À§¿Í °°ÀÌ ¿¬°áµÈ´Ù. ¿©±â¼ ¸î°¡Áö °£´ÜÇÑ Å×½ºÆ®¿ë ¸í·ÉÀ» Àû´Â´Ù.
mysql> show databases --> µ¥ÀÌŸº£À̽º Á¾·ùº¸±â
-> \g
+----------+
| Database |
+----------+
| mysql |
| test |
+----------+
2 rows in set (0.00 sec)
mysql> show tables from mysql --> mysql»óÀÇ Å×À̺í Á¤º¸ º¸±â
-> \g
+-----------------+
| Tables in mysql |
+-----------------+
| db |
| func |
| host |
| user |
+-----------------+
4 rows in set (0.00 sec)
mysql> show columns from db --> db table Ä®·³Á¤º¸ º¸±â
-> \g
+-------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------------+------+-----+---------+-------+
| Host | char(60) | | PRI | | |
| Db | char(32) | | PRI | | |
| User | char(16) | | PRI | | |
| Select_priv | enum('N','Y') | | | N | |
| Insert_priv | enum('N','Y') | | | N | |
| Update_priv | enum('N','Y') | | | N | |
| Delete_priv | enum('N','Y') | | | N | |
| Create_priv | enum('N','Y') | | | N | |
| Drop_priv | enum('N','Y') | | | N | |
+-------------+---------------+------+-----+---------+-------+
9 rows in set (0.00 sec)
mysql> show index from db --> db tableÀÇ À妽ºÁ¤º¸±â
-> \g
+-------+------------+----------+--------------+-------------+
-----------+-------------+----------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name |
Collation | Cardinality | Sub_part |
+-------+------------+----------+--------------+-------------+
-----------+-------------+----------+
| db | 0 | Host | 1 | Host |
A | 4 | NULL |
| db | 0 | Host | 2 | Db |
A | 4 | NULL |
| db | 0 | Host | 3 | User |
A | 4 | NULL |
| db | 1 | User | 1 | User |
A | NULL | NULL |
+-------+------------+----------+--------------+-------------+
-----------+-------------+----------+
4 rows in set (0.00 sec)
mysql> show status --> MySQLÀÇ »óÅÂÁ¤º¸ º¸±â
-> \g
+--------+-----------------+-----------+---------------+---------
+-------------+
| Uptime | Running_threads | Questions | Opened_tables | Reloads
| Open_tables |
+--------+-----------------+-----------+---------------+---------
+-------------+
| 1493 | 1 | 26 | 4 | 1
| 4 |
+--------+-----------------+-----------+---------------+---------
+-------------+
1 row in set (0.00 sec)
mysql> show variables --> MySQL ȯ°æº¯¼öº¸±â
-> \g
+--------------------+---------------------------------+
| Variable_name | Value |
+--------------------+---------------------------------+
| back_log | 5 |
| basedir | /usr/local/ |
| datadir | . |
| join_buffer | 131072 |
| key_buffer | 1048568 |
| language | /usr/local/share/mysql/english/ |
| max_allowed_packet | 65536 |
| max_connections | 90 |
| max_join_size | 4294967295 |
| max_sort_length | 1024 |
| net_buffer_length | 8192 |
| port | 3306 |
| record_buffer | 131072 |
| skip_locking | 1 |
| socket | /tmp/mysql.sock |
| sort_buffer | 2097144 |
| table_cache | 64 |
| thread_stack | 65536 |
| tmp_table_size | 1048576 |
+--------------------+---------------------------------+
19 rows in set (0.00 sec)
mysql> select * from db --> db Å×À̺íÀÇ µ¥ÀÌŸ °¡Á®¿À±â
-> \g
+-----------+----------+------------+-------------+-------------+
-------------+-------------+-------------+-----------+
| Host | Db | User | Select_priv | Insert_priv |
Update_priv |Delete_priv | Create_priv | Drop_priv |
+-----------+----------+------------+-------------+-------------+
-------------+-------------+-------------+-----------+
| % | test | | Y | Y |
Y |Y | Y | Y |
| % | test\_% | | Y | Y |
Y |Y | Y | Y |
| localhost | binggo | binggo | Y | Y |
Y |Y | Y | Y |
+-----------+----------+------------+-------------+-------------+
-------------+-------------+-------------+-----------+
3 rows in set (0.00 sec)
mysql>
À§ÀÇ ¸í·ÉÀº ±âº»ÀûÀÎ ¸í·ÉÀ¸·Î¼ ½ÇÁ¦ mysql À» »ç¿ëÇÒ¶§
ÀÚÁÖ »ç¿ëµÉ ¸í·ÉÀ̶ó°í »ý°¢µÈ´Ù. ±âŸ sql¹®Àº °Á 3¿¡¼
Á¤¸®ÇÏ¿´À¸¹Ç·Î »ý·«Çϱâ·Î ÇÑ´Ù.
2. MySQL DB admin user ¾ÏÈ£°É±â
MySQL À» ¼³Ä¡ÈÄ °¡Àå ¸ÕÀú ÇØ¾ß ÇÒ ÀÏÀº MySQLÀÇ admin ÀÎ
root (DB user ÀÓ)ÀÇ ¾ÏÈ£¸¦ ¼³Á¤ÇÏ´Â ÀÏÀÌ´Ù. ÀÌ°ÍÀº ¼¹ö°¡
ÀÎÅÍ³Ý»ó¿¡ Á¢¼ÓµÇ¾î ÀÖÀ»°æ¿ì º¸¾ÈÀ» À§ÇÏ¿© °¡Àå ¸ÕÀúÇؾß
ÇÏ´Â ÀÏÀ̶ó°í »ý°¢µÈ´Ù. ¾ÏÈ£¸¦ ¼³Á¤ÇÏ´Â ¹æ¹ýÀº ´ÙÀ½°ú °°´Ù.
¸ÕÀú admin À¯ÀúÀÎ root ¾ÆÀ̵ðÀÇ ¾ÏÈ£¸¦ ¼³Á¤Çϱâ·Î ÇÑ´Ù.
mysql> update user
-> set password = password('testpass')
-> where user = 'root'
-> \g
Query OK, 2 row affected (0.00 sec)
mysql>
À§¸¦ ½ÇÇàÇϸé ÀϹÝÀûÀ¸·Î user Å×À̺í»ó¿¡ root ¾ÆÀ̵𰡠µÎ°³°¡ root
¾ÆÀ̵𰡠µî·Ï µÇ¾î ÀÖÀ¸¹Ç·Î 2 row ÀÇ ºñ¹Ð¹øÈ£°¡ º¯°æÀÌ µÈ´Ù.
¿©±â½Ã È®ÀÎÀ» À§ÇÏ¿© ¾Æ·¡ÀÇ ¸í·ÉÀ» ½ÇÇàÇØ º»´Ù.
mysql> select * from user
-> \g
. . . .
. . . .
Å×À̺í»ó¿¡ ÀúÀåµÈ ³»¿ëÀÌ Ãâ·ÂµÉ °ÍÀÌ´Ù.
ÀÚ ÀÌÁ¦ºÎÅÍ´Â admin À¯ÀúÀÎ root·Î mysql¿¡ Á¢¼ÓÇÒ °æ¿ì ²À password¸¦
ÀÔ·ÂÇØ¾ß ÇÑ´Ù. Áï ¾Æ·¡¿Í °°ÀÌ ½ÇÇàÇÏ¿©¾ß ÇÑ´Ù.
$ mysql -u root -p mysql
Enter password:
¾ÏÈ£¸¦ ¹°À»¶§ ¾ÏÈ£¸¦ ÀÔ·ÂÇϸé mysqlÀ» »ç¿ëÇÒ¼ö ÀÖ´Ù.
3. »õ·Î¿î µ¥ÀÌŸ º£À̽º »ý¼º°ú »ç¿ëÀÚ ¿¬°á
3.1 µ¥ÀÌŸ º£À̽ºÀÇ »ý¼º
µ¥ÀÌŸº£À̽º »ý¼ºÀÇ ¹æ¹ýÀº µÎ°¡Áö°¡ ÀÖ´Ù. mysqladmin ÇÁ·Î±×·¥À»
ÀÌ¿ëÇÏ¿© root ¾ÆÀ̵ð·Î shell »ó¿¡¼ »ý¼ºÇÏ´Â ¹æ¹ý°ú ¶ÇÇϳª mysql
ÇÁ·Î±×·¥ »ó¿¡¼ »ý¼ºÇÏ´Â ¹æ¹ýÀÌ´Ù.
¸ÕÀú mysqladmin ÇÁ·Î±×·¥À» ÀÌ¿ëÇÏ´Â ¹æ¹ýÀÌ´Ù.
mysqladmin create soonhg --> ÀÌ°æ¿ì soonhg ¶ó´Â µ¥ÀÌŸº£À̽º »ý¼º
admin ÀÎ root ¿¡ ¾ÏÈ£¸¦ ¼³Á¤ÇÑ °æ¿ì ´ÙÀ½°ú °°ÀÌ ½ÇÇàÇÑ´Ù.
mysqladmin -u root -p create soonhg
ÀÌ °æ¿ì µðÆúÆ®·Î ¼³Ä¡ÇÑ °æ¿ì /usr/local/var/soonhg ¶ó´Â µð·ºÅ丮°¡ »ý¼º
µÈ´Ù. ÀÌ µð·ºÅ丮°¡ µ¥ÀÌŸ º£À̽º °ø°£À¸·Î ÀÌ¿ëµÉ °÷ÀÌ´Ù. Áï soonhg ¶ó´Â
µ¥ÀÌŸ º£À̽º °ø°£¿¡ Å×À̺íÀ» »ý¼ºÇÒ °æ¿ì soonhg ¶ó´Â µð·ºÅ丮·Î °ü·ÃµÈ
ÆÄÀÏÀÌ »ý¼ºµÇ¸ç µ¥ÀÌŸ°¡ ÀúÀåµÈ´Ù.
*******************************************************************
Áß¿äÇÑ tip......
*******************************************************************
MySQL°ú ÁÖ°í ¹Þ´Â °¢Á¾ ³»¿ëÀº /usr/local/var »óÀÇ fullµµ¸ÞÀθí.log
ÆÄÀÏ»ó¿¡ ¸ðµÎ ÀúÀåµÈ´Ù. ¸¸ÀÏ µ¿ÀÛ »óŸ¦ ¾Ë°í ½Í´Ù¸é Å͹̳¯À» Çϳª ´õ
¿¾î¼ tail -f fullµµ¸ÞÀθí.log ÇÏ¿© MySQL°úÀÇ ÁÖ°í¹Þ´Â ³»¿ëÀ»
¸ð´ÏÅ͸µ ÇÒ ¼ö ÀÖ´Ù.
*******************************************************************
µÎ¹ø° ¹æ¹ýÀ¸·Î mysqlÀ» ÀÌ¿ëÇÏ´Â ¹ýÀÌ´Ù. mysql ½ÇÇà»óÅ¿¡¼ ¾Æ·¡¿Í °°ÀÌ
ÇÑ´Ù. (admin ÀÎ root ¾ÆÀ̵ð·Î mysql ¿¡ Á¢¼Ó)
mysql> create database soonhg
-> \g
Query OK, 1 row affected (0.00 sec)
mysql>
À§ÀÇ µÎ°¡Áö ¹æ¹ýÁß ¾î´À ¹æ¹ýÀ» »ç¿ëÇÏ¿©µµ ¹«°üÇÏ´Ù. °³ÀÎÀûÀ¸·Î´Â mysql
»ó¿¡¼ µ¥ÀÌŸº£À̽º¸¦ »ý¼ºÇϴ°ÍÀ» ±ÇÀåÇÑ´Ù. ¿Ö³ÄÇÏ¸é °è¼ÓÇÏ¿© ÀÛ¾÷À»
ÇؾßÇҰ͵éÀÌ Àֱ⠶§¹®ÀÌ´Ù.
3.2 µ¥ÀÌŸº£À̽º¿Í mysql °ü¸® Å×À̺í°úÀÇ ¿¬°á ¹× »ç¿ëÀÚµî·Ï ¹× Ư±ÇÁ¤ÀÇ
ÀÚ ÀÌÁ¦ »ý¼ºµÈ µ¥ÀÌŸº£À̽º¿Í µ¥ÀÌŸº£À̽º °ü¸®¹× ¿¢¼¼½º ±ÇÇѵîÀ» Á¤ÀÇ
ÇÏ°í ÀÖ´Â mysql »óÀÇ db, user Å×ÀÌºí¿¡ ¹æ±Ý »ý¼ºµÈ soonhg Å×À̺íÀÇ ³»
¿ëÀ» Á¤ÀÇ ÇÏÀÚ.
¸ÕÀú ÀÌ soonhg µ¥ÀÌŸº£À̽º´Â ¸ðµç È£½ºÆ® »ó¿¡¼ Á¢±ÙÀÌ °¡´ÉÇϵµ·Ï ¸¸µé
±â·Î ÇÑ´Ù. ±×¸®°í »ç¿ëÀÚ´Â id ·Î park ¶ó´Â DB user ¸¦ »ý¼ºÇÑ´Ù°í ÇÏÀÚ.
sql ¹®Àº ´ÙÀ½°ú °°´Ù.
mysql> insert into db
-> (host,db,user,select_priv,insert_priv,update_priv,delete_priv,
-> create_priv,drop_priv)
-> values ('%','soonhg','park','Y','Y','Y','Y','Y','Y')
-> \g
Query OK, 1 row affected (0.00 sec)
mysql>
À§ÀÇ sql¹®¿¡¼ º¸¸é park À̶ó´Â »ç¿ëÀÚ´Â soonhg µ¥ÀÌŸº£À̽º¿¡ ´ëÇÏ¿©
select,insert,update,delete,create,drop ±ÇÇÑÀÌ ¸ðµÎ ÁÖ¾îÁ³´Ù. ÀÌ°ÍÀº
ÇϳªÀÇ soonhg µ¥ÀÌŸ º£À̽º¿¡ ´ëÇÏ¿© °¢ sql ¸í·É¿¡ ´ëÇÑ ±ÇÇÑÀ» °³º°Àû
À¸·Î ÁÙ¼ö ÀÖ´Ù´Â °ÍÀ» ÀǹÌÇÑ´Ù.
select * from db ¶ó´Â sql ¹®À» ÀÌ¿ëÇÏ¿© Á¤»óÀûÀ¸·Î insert µÇ¾ú´ÂÁö
È®ÀÎÇØ º¸±â ¹Ù¶õ´Ù.
ÀÚ ÀÌÁ¦ park ¶ó´Â db »ç¿ëÀÚ¿¡ ´ëÇÑ µî·ÏÀ» ÇÒ Â÷·ÊÀÌ´Ù.
´ÙÀ½°ú °°Àº sql ¹®À» ¸¸µé¾î ½ÇÇàÇÑ´Ù.
mysql> insert into user
-> (host,user,password,select_priv,insert_priv,
-> update_priv,delete_priv,create_priv,drop_priv,
-> reload_priv,shutdown_priv,process_priv,file_priv)
-> values ('localhost','park',password('park'),'N',
-> 'N','N','N','N','N','N','N','N','N')
-> \g
Query OK, 1 row affected (0.00 sec)
mysql>
À§¿Í °°ÀÌ ÇÏ¿©µµ µÇ°í °£´ÜÈ÷ ¾Æ·¡¿Í °°ÀÌ ÇÏ¿©µµ ¹«¹æÇÏ´Ù.
mysql> insert into user
-> (host,user,password)
-> values ('localhost','park',password('park'))
-> \g
Query OK, 1 row affected (0.00 sec)
mysql>
host,user,password ÀÌ¿ÜÀÇ Ä®·³µéÀº ¸ðµÎ µðÆúÆ®·Î 'N' À¸·Î ¼³Á¤
µÇ¾î ÀÖÀ¸¹Ç·Î À§¿Í °°ÀÌ ÇϸéµÈ´Ù. ¿©±â¼ db Å×À̺í°ú user Å×À̺íÀº
Ư±Ç»ó¿¡¼ ¾à°£ÀÇ Â÷ÀÌÁ¡ÀÌ ÀÖ´Ù. db Å×ÀÌºí »ó¿¡¼ ¼³Á¤µÇÁö ¾Ê°í
user Å×ÀÌºí »ó¿¡¸¸ ¼³Á¤µÇ¾îÁø DB »ç¿ëÀÚ´Â user Å×ÀÌºí »ó¿¡¼ ¼³Á¤
µÈ ±ÇÇÑÀ» Á¸ÀçÇÏ´Â ¸ðµç µ¥ÀÌŸº£À̽º¿¡ ´ëÇÏ¿© ÀÎÁ¤¹Þ´Â´Ù.
ÀÌ·¯ÇÑ ÀÌÀ¯·Î ÀÏ¹Ý »ç¿ëÀÚÀÎ °æ¿ì´Â user Å×ÀÌºí »ó¿¡´Â ¸ðµç ±ÇÇÑÀ»
'N' ·Î ¼³Á¤ÇÏ¿©¾ß ÇÏ°í °¢ DB user °¡ »ç¿ëÇÒ µ¥ÀÌŸº£À̽º¿¡ ´ëÇÑ
±ÇÇÑÀ» DB Å×ÀÌºí¿¡ ´Ù½Ã Á¤ÇØÁÖ´Â °ÍÀÌ´Ù.
Áï, µ¥ÀÌŸº£À̽º°¡ ¿©·¯°³ Á¸ÀçÇÑ´Ù°í °¡Á¤ÇÏÀÚ. aaa, bbb, ccc ¶ó´Â
¼¼°³ÀÇ µ¥ÀÌŸº£À̽º°¡ Á¸ÀçÇÒ¶§, park À̶ó´Â DB »ç¿ëÀÚ´Â aaa ¶ó´Â
µ¥ÀÌŸº£À̽º¸¸ ÀÌ¿ëÇÏ°Ô ÇÏ·Á°í ¼³Á¤ÇÏ·Á°í ÇÑ´Ù°í ÇÏÀÚ.
ÀÌ°æ¿ì´Â user Å×ÀÌºí¿¡´Â ¸ðµç ±ÇÇÑÀ» 'N' »óÅ·Π¼³Á¤ÇÏ°í db Å×À̺í
¿¡´Â aaa ¶ó´Â Å×ÀÌºí¿¡ ´ëÇÏ¿© ¸ðµç ±ÇÇÑÀ» 'Y' ¶ó°í ¼³Á¤Çϸé ÀÌ park
¶ó´Â db »ç¿ëÀÚ´Â aaa ¶ó´Â µ¥ÀÌŸº£À̽º¿¡ ´ëÇÏ¿© »ç¿ë±ÇÇÑÀÌ ÁÖ¾îÁú
°ÍÀÌ´Ù. Àß ÀÌÇØ°¡ °¡Áö ¾Ê´Â´Ù¸é ¸î¹ø ´õ ÀÚ¼¼È÷ Àо°í test Çغ»´Ù¸é
½±°Ô ÀÌÇØÇÒ ¼ö ÀÖÀ»°ÍÀÌ´Ù.
*******************************************************************
Áß¿äÇÑ tip......
*******************************************************************
user Å×ÀÌºí¿¡ »ç¿ëÀÚ¸¦ insert, update ÇÑ °æ¿ì MySQLÀ» ²À Àç±âµ¿
½ÃÄÑ ÁÖ¾î¾ß¸¸ ÇÑ´Ù. ¸í·ÉÀº ´ÙÀ½°ú °°´Ù.
myaqladmin -u root -p reload
ÀÌ ¸í·ÉÀº user Å×ÀÌºí¿¡¼ »ç¿ëÀÚ Á¤º¸¸¦ ´Ù½Ã ÀÐ¾î¼ MySQL À» ´Ù½Ã
½ÇÇà½ÃÄÑÁØ´Ù.
*******************************************************************
4. Å×À̺íÀÇ »ý¼º
Å×À̺íÀÇ »ý¼ºÀº ÀϹÝÀûÀÎ sql ¹®ÀåÀ̹ǷΠ°£´ÜÈ÷ Å×À̺í Çϳª »ý¼ºÇÏ´Â
¿¹Á¦¸¦ Àû´Â°ÍÀ¸·Î ´ë½ÅÇÏ°Ú´Ù.
À§¿¡¼ »ý¼ºÇÑ »ç¿ëÀÚ¿Í »ç¿ëÀÚ¸¦ À§ÇÑ Å×À̺íÀ» ÀÌ¿ëÇÏ¿© ÀÛ¾÷À» ÇÏ¿©º¸ÀÚ
¸ÕÀú mysqlÀ» ½ÇÇàÇÑ´Ù. ½ÇÇàÀº ±×³É ÀÏ¹Ý °èÁ¤ »ç¿ëÀÚ·Î ÇÑ´Ù.
$ mysql -u park -p soonhg
Enter password: **** <-- ¿©±â¼ password ÀÎ parkÀ» ÀÔ·ÂÇÑ´Ù.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17 to server version: 3.21.27-gamma-log
Type 'help' for help.
mysql>
ÀÚ MySQL¿¡ Á¢¼ÓµÇ¾ú´Ù. ÀÌÁ¦ tableÀ» »ý¼ºÇÏ¿© º¸ÀÚ. ¾Æ·¡´Â individual
Å×ÀÌºí »ý¼ºÀ» À§ÇÑ SQL ¹®ÀåÀÌ´Ù.
create table individual(
empno char(16) primary key,
name char(20) not null,
sex char(2),
addr char(80),
tel char(15)
)
À§ÀÇ Å×À̺íÀº °³ÀÎÁ¤º¸ Å×À̺í·Î °£´ÜÈ÷ ¸¸µç°ÍÀÌ´Ù. empno °¡ Å°°¡ µÇ¾î
ÀúÀåµÈ´Ù. ¹°·Ð index Å×À̺íÀÌ Çϳª »ý¼ºµÇ¸ç empno °¡ Àε¦½Ì µÇ¾îÁø Å×
À̺íÀÌ »ý¼ºµÉ°ÍÀÌ´Ù. not null Àº ¸»±×´ë·Î name Ä®·³Àº null °ªÀº ¹ÞÁö
¾Ê°Ú´Ù´Â °ÍÀÌ°í.....
ÀÚ ±×·³ insert ¹®ÀåÀ» Çϳª ÀÛ¼ºÇØ º¸ÀÚ
insert into individual
values ('1','¹Ú¼øÇà','1','¼¿ï½Ã Á߶û±¸ »óºÀµ¿ LG apt.','02-777-7777')
À§ÀÇ sql¹®À» ½ÇÇàÇϸé ÇÑ rowÀÇ µ¥ÀÌŸ°¡ insert µÈ´Ù. ±×·³ ÀÌÁ¦
select ¹®À» ÀÌ¿ëÇÏ¿© ÀоÀÚ.
mysql> select *
-> from individual
-> \g
+-------+--------+------+------------------------------+-------------+
| empno | name | sex | addr | tel |
+-------+--------+------+------------------------------+-------------+
| 1 | ¹Ú¼øÇà | 1 | ¼¿ï½Ã Á߶û±¸ »óºÀµ¿ LG apt. | 02-777-7777 |
+-------+--------+------+------------------------------+-------------+
1 row in set (0.00 sec)
À§¿Í °°ÀÌ Ãâ·Â µÉ °ÍÀÌ´Ù. ¿©·¯°¡Áö sql¹®ÀåÀ» Å×½ºÆ® Çغ¸¸é µÉ°ÍÀÌ´Ù.
<< °á·Ð >>
¸¹ÀÌ ¾ËÁöµµ ¸øÇÏ¸é¼ ±¦È÷ ½ÃÀÛÇÑ °ÍÀº ¾Æ´Ñ°¡ ÇÕ´Ï´Ù. ÇÏÁö¸¸ msqlº¸´Ù ¸Å¿ì
¶Ù¾î³ ±â´ÉÀ» °¡Áö°í ÀÖ°í ¶Ç mysqlÀ» »ç¿ëÇÏ°íÀÚ ÇÏ´Â ºÐÀÌ Àúó·³ »ç¿ë¿¡ °ü
·ÃµÈ ÀÚ·á°¡ ¾ø¾î¼ °í»ýÇÏÁö ¾Êµµ·Ï Çϱâ À§ÇÏ¿© ªÀº Áö½ÄÀ¸·Î³ª¸¶ ÀÌ·¸°Ô
±ÛÀ» ¿Ã·Á º¾´Ï´Ù.
´ÙÀ½ °Á¿¡¼´Â MySQL °ú C ¾ð¾î¿ÍÀÇ ¿¬°á¹ý¿¡ ´ëÇÏ¿© °ÀÇÇØ º¸µµ·Ï ÇÏ°Ú½À
´Ï´Ù. ÀúÀÇ ÀÛÀº °Á°¡ ¸¹Àº »ç¶÷µé¿¡°Ô µµ¿òÀÌ µÇ¾úÀ¸¸é ÇÕ´Ï´Ù.
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
¿øº»»çÀÌÆ®: http://www.devshed.com/Server_Side/MySQL/Intro/
* Beginning MySQL Tutorial
*(o) By W.J. Gilmore
*(o)| April 03, 1999
(o)| | ¹ø¿ª : ¿øÁÖÈñ(haremoon@won.hongik.ac.kr)
| | | ¹ø¿ªÀÏÀÚ : 1999³â 9¿ù26ÀÏ
==============================================================================
The Database
µ¥ÀÌŸº£À̽º´Â ÀÌÁ¦ ¸ðµç »ç¶÷µéÀÇ »ýÈ°¿¡¼ ¾ø¾î¼´Â ¾ÈµÉ ¸Å¿ì Áß¿äÇÑ ºÎºÐÀÌ µÇ¾îÁ³´Ù.
µ¥ÀÌŸº£À̽º°¡ ¾ø´Ù¸é ¿ì¸®°¡ ÇÏ°í ÀÖ´Â ¸¹Àº ÀϵéÀº ¸Å¿ì Áö·çÇÏ°í, ºÒÆíÇÑ ÀϵéÀÌ µÉ
°ÍÀÌ´Ù. ÀºÇà°ú ´ëÇÐ, µµ¼°üÀº ÀÌ·¯ÇÑ µ¥ÀÌŸº£À̽º ½Ã½ºÅÛ¿¡ Å©°Ô ÀÇÁ¸ÇÏ°í ÀÖ´Â ±â°üÀÇ
¿¹À̸ç, ÀÎÅͳÝÀÇ ¼Ä¡¿£Áø, ¿Â¶óÀÎ ¼îÇθô¶ÇÇÑ µ¥ÀÌŸº£À̽º¸¦ ÀÌ¿ëÇÏ¿© ±¸ÃàµÇ¾îÁö°í ÀÖ´Ù.
µ¥ÀÌŸº£À̽º´Â ÇϳªÀÇ ÄÄÇ»ÅÍ°¡ µ¥ÀÌŸº£À̽º ¼¹ö¿Í °³¹æÀûÀÎ »óÈ£ °ü°è¸¦ ÇÒ ¼ö ÀÖµµ·Ï
µµ¿ÍÁÖ´Â µµ±¸ÀÌÀÚ ÀÎÅÍÆäÀ̽ºÀÇ ¿ªÇÒÀ» ÇÑ´Ù.
T.c.X. DataKonsultAB¿¡ ÀÇÇØ °³¹ßµÈ MySQL ¼¹ö´Â ÇöÀç ½ÃÀå¿¡¼ ±Þ¼ÓÇÏ°Ô ¼ºÀåÇÏ°í ÀÖ´Â
SQL(Structured Query Language) µ¥ÀÌŸº£À̽º ¼¹ö ÁßÀÇ ÇϳªÀÌ´Ù. MySQLÀº
http://www.mysql.com¿¡¼ ´Ù¿î·Îµå ¹ÞÀ» ¼ö ÀÖÀ¸¸ç, ´Ù¸¥ µ¥ÀÌŸº£À̽º ¼¹ö¿¡¼´Â º¸±â
µå¹® ¹è¿µÈ ¿É¼Ç°ú À¯¿ëÇÑ Æ¯¼ºÀ» °¡Áø µ¥ÀÌŸº£À̽º ÇÁ·Î±×·¥À» Á¦°øÇÑ´Ù. ¹«¾ùº¸´Ù
µµ MySQLÀÇ °¡Àå Å« ÀåÁ¡Àº °³ÀÎÀûÀ¸·Î³ª »ó¾÷ÀûÀ¸·Î ±×°ÍÀ» ÀÌ¿ëÇϱ⠹ٶó´Â ¸ðµç »ç¶÷µé
¿¡°Ô ¹«·á·Î Á¦°øµÇ´Â °ø°³¿ë µ¥ÀÌŸº£À̽º¶ó´Â °ÍÀÌ´Ù. MySQLÀ» »ç¿ëÇÏ¿© ¸íÈ®ÇÑ ¾îÇÃ
¸®ÄÉÀ̼ÇÀ» °³¹ßÇÏ°í ½Í´Ù¸é MySQL's licensing ection(http://www.mysql.com/Manual
_chapter/manual_Licensing_and_Support.html)À» Âü°íÇϱ⠹ٶõ´Ù.
MySQL ¼¹ö´Â ´ÙÀ½ÀÇ ³»¿ëÀ» Æ÷ÇÔÇÏ¿© Çì¾Æ¸± ¼ö ¾øÀÌ ¸¹Àº ´É·Â °¡Áö°í ÀÖ´Ù.
¡¤ µ¿½Ã »ç¿ëÀÚÀÇ ¼ö°¡ ¹«Á¦ÇÑÀûÀΠó¸® ´É·Â
¡¤ 50,000,000+ record¸¦ ó¸®ÇÒ ¼ö ÀÖ´Â ¿ë·®
¡¤ ¸Å¿ì ºü¸¥ ¸í·É ¼öÇà ´É·Â(¾Æ¸¶ ½ÃÀå¿¡ ³ª¿Â µ¥ÀÌŸº£À̽º Áß¿¡ °¡Àå ºü¸¦Áöµµ ¸ð¸¥´Ù)
¡¤ ½±°í ´É·üÀûÀÎ »ç¿ëÀÚ Æ¯±Ç ½Ã½ºÅÛ
±×·¯³ª ¾î¼¸é ±× ¼ö¸¹Àº ´É·Â Áß¿¡¼µµ °¡Àå Èï¹Ì·Î¿î »ç½ÇÀº ±×°ÍÀÌ ¹«·á¶ó´Â °ÍÀÌ´Ù.
T.c.X ´Â ÀÏ¹Ý ´ëÁß¿¡°Ô °ø°³¿ë µ¥ÀÌŸº£À̽ºÀÎ MySQLÀ» ¹«·á·Î Á¦°øÇÏ°í ÀÖ´Ù.
´©°¡ MySQL ¼¹ö¸¦ »ç¿ëÇϴ°¡?(So Who's Using MySQL?)
MySQL µ¥ÀÌŸº£À̽º ¼¹ö´Â ´ÙÀ½°ú °°Àº ±â°üµé¿¡¼ ¸·´ëÇÑ ´ëÁß¼ºÀ» ¾ò¾î°¡¸ç »ç¿ëµÇ¾îÁö
°í ÀÖ´Ù.
¡¤ Silicon Graphics (http://www.sgi.com)
¡¤ Siemens (http://www.siemens.com)
¸¸¾à À§ÀÇ ±ÛÀÌ ¼³µæ·Â Àֱ⿡ ÃæºÐÇÏÁö ¾Ê´Ù¸é ´õ ¸¹Àº MySQL »ç¿ëÀÚ ¸ñ·ÏÀ»
MySQL User's List (http://www.mysql.com/users.html)¿¡¼ ã¾Æ º¸±â ¹Ù¶õ´Ù.
ÀÌ ±ÛÀº MySQL ¼¹öÀÇ Çʼö Á¶ÀÛ°ú ±âº»ÀûÀÎ ¸í·ÉÀ» ¼öÇàÇϱâ À§ÇÑ ¼¹öÀÇ ¼Â¾÷, ÀûÀýÇÏ°Ô
¿¬°áÇÏ´Â ¹æ¹ýÀ» Æ÷ÇÔÇÏ¿© MySQL ¼¹öÀÇ ±âº»ÀûÀÎ ¿î¿ëÀ» ¹è¿ì´Â °ÍÀ» µµ¿ï °ÍÀÌ´Ù.
¸¸¾à ÀÌ¹Ì MySQL¿¡ ´ëÇؼ ±âº»ÀûÀÎ ÀÌÇظ¦ ÇÏ°í ÀÖ´Ù¸é ÀÌÀåÀ» ¶Ù¾î ³Ñ°í ´ÙÀ½ ÀåÀ¸·Î
°¡µµ »ó°ü¾ø´Ù. ±×·¯³ª ÀÌ ±Û¿¡ ¾²¿©Áø ¸í·É¾îµéÀº Á» ´õ ¼öÁØ ³ôÀº ¸í·É¾î¸¦ À§
ÇÑ ±âÃʷμ, MySQL ¾ð¾î¿¡ ÀÖ´Â °¡Àå Áß¿äÇÑ ¸í·É¾î ÁßÀÇ Çϳª¶ó´Â Á¡À» ±â¾ïÇϱ⠹ٶõ´Ù.
¡Ü Part 1: ¹Ì¸®»ìÆ캸±â(At First Glance)
=======================================
MySQLÀº ÀϹÝÀûÀ¸·Î telnetÀ» ÅëÇØ µé¾î°£´Ù. (±¦ÂúÀº Telnet ÇÁ·Î±×·¥ÀÎ EasytermÀº
http://www.arachnoid.com¿¡¼ ±¸ÇÒ ¼ö ÀÖ´Ù.) ÇѹøÀÌ¶óµµ À¥¼¹ö¿¡ telnetÀ¸·Î Á¢¼ÓÇÑ
ÀûÀÌ ÀÖ´Ù¸é MySQL ¼¹ö¿¡ Á¢±ÙÇÏ´Â µÎ ¹ø° ¸í·É¾î¸¦ ÁغñÇϱ⠹ٶõ´Ù.
¿¬°áÇϱâ À§ÇÑ ÀýÂ÷´Â ´ÙÀ½°ú °°½À´Ï´Ù.
1. telnet Á¢¼ÓÇϱâ : ISP¿¡¼ Á¦°øµÈ username(ID)°ú password°¡ ÇÊ¿äÇÏ´Ù.
--------------------------------------------------------------------------
login: haremoon
Password: ********
Last login: Sat May 22 12:52:01 from 203.249.84.223
Sun Microsystems Inc. SunOS 5.6 Generic August 1997
You have new mail.
[haremoon@won /user/center/haremoon]#
--------------------------------------------------------------------------
2. MySQL ¿¬°áÇϱâ - MySQL »ç¿ëÀ» À§Çؼ´Â ¸íÈ®ÇÏ°Ô ÁÖ¾îÁø username°ú password°¡ ÇÊ¿ä
ÇÏ´Ù. ÀÌ Á¤º¸´Â ISPÁ¦°øÀÚ¿¡°Ô ¿äûÇϸé Á¦°øµÈ´Ù.
--------------------------------------------------------------------------
[haremoon@won /user/center/haremoon]# mysql -u root -p mysql
--------------------------------------------------------------------------
Syntax : mysql -h hostname -u username -p password database
½ÇÇàÆÄÀÏ | È£½ºÆ® | dbÀ¯Àú | Æнº¿öµå |»ç¿ëÇÒ µ¥ÀÌŸº£À̽ºÀ̸§
¶Ç´Â
mysql -h hostname -u username -password=password database
-p ¿É¼Ç¿¡ ÀÇÇØ Æнº¿öµå¸¦ ÀÔ·ÂÇÏ´Â ÇÁ·ÒÇÁÆ®°¡ ³ª¿À¸é Æнº¿öµå¸¦ ÀÔ·ÂÇÑ´Ù.
Enter password:
¸¸¾à MySQLÀÌ ¿Ã¹Ù¸£°Ô ¼³Ä¡µÇ¾ú°í ½ÇÇàµÇ¾ú´Ù¸é ´ÙÀ½°ú °°Àº ȸéÀ» º¼ ¼ö ÀÖÀ» °ÍÀÌ´Ù.
--------------------------------------------------------------------------
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 267 to server version: 3.22.16a-gamma
Type 'help' for help.
mysql>
--------------------------------------------------------------------------
µ¥ÀÌŸº£À̽º¿¡ ÀÌ¹Ì ¿¬°áµÇ¾î ÀÖ´Ù¸é MySQL ¾ð¾îÀÇ ¿©·¯ °¡Áö ¸í·É¾î¸¦ ½ÇÇà½ÃÄѵµ ÁÁ´Ù.
±×·¯³ª ±×·¸Áö ¾ÊÀ¸¸é ¸ÕÀú µ¥ÀÌŸº£À̽º¿¡ ¿¬°áÇϱâ À§ÇØ ´ÙÀ½ÀÇ ¸í·ÉÀ» ¼öÇàÇÕ´Ï´Ù.
--------------------------------------------------------------------------
mysql> use study --> »ç¿ëÇÒ µ¥ÀÌŸº£À̽º
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql>
--------------------------------------------------------------------------
¿©·¯ºÐÀº Áö±Ý µ¥ÀÌŸº£À̽º¿¡ ¿¬°á µÇ¾îÀÖ´Ù. ÇÑ°¡Áö ÁÖ¸ñÇÒ Á¡Àº MySQL¿¡¼ ´ëºÎºÐÀÇ ¸ðµç
¸í·É¾î´Â ¼¼¹ÌŬ·Ð (;)¿¡ ÀÇÇØ ¼öÇàµÈ´Ù´Â °ÍÀÌ´Ù.
¿ì¼± Ä¿¸Çµå ¶óÀο¡¼ help, \h ¶Ç´Â ? ¶ó°í ÀÔ·ÂÇÏ¸é °£´ÜÇÑ ¸í·É¾î µµ¿ò¸»À» º¼ ¼ö ÀÖ´Ù.
--------------------------------------------------------------------------
mysql> help
MySQL commands:
help (\h) Display this text
? (\h) Synonym for `help'
clear (\c) Clear command
connect (\r) Reconnect to the server. Optional arguments are db and host
edit (\e) Edit command with $EDITOR
exit (\) Exit mysql. Same as quit
go (\g) Send command to mysql server
ego (\G) Send command to mysql server; Display result verically
print (\p) print current command
quit (\q) Quit mysql
rehash (\#) Rebuild completion hash
status (\s) Get status information from the server
use (\u) Use another database. Takes database name as argument
Connection id: 268 (Can be used with mysqladmin kill)
mysql>
--------------------------------------------------------------------------
ÀÌ ¸í·ÉµéÀº Áö±Ý ´çÀå ÇÊ¿ä ¾øÀ»Áöµµ ¸ð¸¥´Ù. ±×·¯³ª ±× ¸í·É¾îµéÀÇ Àǹ̸¦ Á¤È®È÷
¾Ë±â À§Çؼ Çѹø¾¿ Å×½ºÆ®ÇØ º¸´Â °ÍÀÌ ÁÁÀ» °ÍÀÌ´Ù. status, use, print, connect,
clear, ±×¸®°í quit¿Í °°Àº ¸í·É¾îµéÀº ¸Å¿ì À¯¿ëÇÏ°Ô »ç¿ëµÉ °ÍÀÌ´Ù.
¿©·¯ºÐÀº Áö±Ý ¼¹ö¿¡ ¿¬°áÇؼ µ¥ÀÌŸº£À̽º¸¦ ¼±ÅÃÇÏ°í ±âº»ÀûÀÎ ¸í·É¾î¸¦ ¼öÇàÇÏ´Â ¹æ¹ý
¿¡ ´ëÇØ ±âº»ÀûÀ¸·Î ÀÌÇØÇØ¾ß ÇÑ´Ù. ´ÙÀ½ Àå¿¡¼´Â µ¥ÀÌŸº£À̽º¸¦ Á¶ÀÛÇϱâ À§ÇØ ÇÊ¿äÇÑ
°³³ä°ú ±â¼úÀ» ´Ù·ê °ÍÀÌ´Ù.
¡Ü Part 2: µ¥ÀÌŸº£À̽º¿Í Å×À̺í(Datatypes and Tables)
====================================================
µ¥ÀÌŸº£À̽º´Â Á» ´õ º¹ÀâÇÑ µ¥ÀÌŸ ±¸Á¶ÀÇ °èÃþ¿¡ Áö³ªÁö ¾Ê´Â´Ù. MySQL¿¡¼´Â Á¤º¸ÀÇ
¹À½(¶Ç´Â ·¹ÄÚµå)À» Å×À̺íÀ̶ó ºÎ¸¥´Ù.
ÀÌ·¯ÇÑ ·¹ÄÚµåµéÀº µ¥ÀÌŸ ŸÀÔÀ̶ó°í ¾Ë·ÁÁø, »ç¿ëÀÚ¿¡ ÀÇÇØ Á¶ÀÛµÉ ¼ö ÀÖ´Â ¾ÆÁÖ ÀÛÀº Å©
±âÀÇ °³Ã¼µé·Î ±¸¼ºµÈ´Ù. ÀÌ·¯ÇÑ µ¥ÀÌŸŸÀÔµéÀº Çϳª ¶Ç´Â ±× ÀÌ»óÀÌ ¸ð¿© ·¹Äڵ带 ±¸
¼ºÇϸç, µ¥ÀÌŸº£À̽ºÀÇ ºÎºÐÀ» ÀÌ·ç´Â Å×À̺íÀº ·¹ÄÚµåÀÇ ÁýÇÕÀ¸·Î ±¸¼ºµÈ´Ù. ¿ì¸®´Â ´Ù
À½°ú °°ÀÌ µ¥ÀÌŸº£À̽ºÀÇ °èÃþÀ» »ý°¢ ÇÒ ¼ö ÀÖ´Ù.
------------------------------------
Database < Table < Record < Datatype
------------------------------------
µ¥ÀÌŸ ŸÀÔÀº »ç¿ëÀÚ°¡ ¾î¶°ÇÑ ÇÁ·ÎÁ§Æ®¸¦ ¼öÇàÇϱâ À§ÇØ °¡Àå ÀûÇÕÇÑ Å×À̺íÀ» ¸¸µé
¶§ ¿©·¯ °¡ÁöÀÇ Çü½Ä°ú Å©±â·Î ³ªÅ¸³¾ ¼ö ÀÖ´Ù. ÀûÀýÇÑ µ¥ÀÌŸ ŸÀÔÀ» ¼±ÅÃÇÏ°í °áÁ¤ÇÏ
´Â °ÍÀº µ¥ÀÌŸº£À̽ºÀÇ ½ÇÇà¿¡ Å« ¿µÇâÀ» ÁֹǷΠÀÌ °³³ä¿¡ ´ëÇØ ÀÚ¼¼È÷ ÀÌÇØÇØ¾ß ÇÑ´Ù.
2.1 MySQL µ¥ÀÌŸ ŸÀÔ
MySQLÀº °æÇèÀÌ ¾ø´Â »ç¿ëÀÚ¶ó ÇÒ Áö¶óµµ Çѹø¾¿Àº ¸¹Àº Á¾·ùÀÇ µ¥ÀÌŸ ŸÀÔµéÀ» Á¢ÇØ
º» ÀûÀÌ ÀÖÀ» °ÍÀ̸ç, ¶Ç ½±°Ô »ç¿ëÇÒ ¼ö ÀÖ´Ù. °¡Àå ÀϹÝÀûÀ¸·Î »ç¿ëµÇ´Â µ¥ÀÌŸ ŸÀÔ
Àº ´ÙÀ½°ú °°´Ù.
¢Á CHAR (M)
CHAR µ¥ÀÌŸ ŸÀÔÀº °íÁ¤µÈ ±æÀÌÀÇ ¹®ÀÚ¿À» ³ªÅ¸³»´Âµ¥ »ç¿ëµÈ´Ù.
ÇϳªÀÇ CHAR ¹®ÀÚ¿Àº 1-255 ÀÚ ¹üÀ§ÀÇ ¹®ÀÚ¸¦ ÀúÀåÇÒ ¼ö ÀÖ´Ù.
------------------------------------
ex.
car_model CHAR(10);
------------------------------------
¢Á VARCHAR (M)
VARCHAR µ¥ÀÌŸ ŸÀÔÀº °¡º¯ÀûÀÎ ±æÀÌÀÇ ¹®ÀÚ¿À» ÀúÀåÇϹǷΠCHAR º¸´Ù´Â Á»´õ À¶Å뼺 ÀÖ
´Â µ¥ÀÌŸ ŸÀÔÀÌ´Ù.
VARCHAR ¹®ÀÚ¿Àº 1-255 ÀÚ ¹üÀ§ÀÇ ¹®ÀÚ¸¦ ÀúÀåÇÒ ¼ö ÀÖ´Ù.
(CHAR ´Â Æ÷ÇÔµÈ µ¥ÀÌŸÀÇ Å©±â¿¡´Â °ü°è¾øÀÌ ÀÌ¹Ì ÁöÁ¤µÈ °¡º¯ÀûÀÎ ÀüüÀÇ ±æÀ̸¦ ÀúÀåÇÏ
´Â ¹Ý¸é¿¡ VARCHAR ´Â ¿ÀÁ÷ µé¾î°¡´Â µ¥ÀÌŸÀÇ ¾ç¸¸À» ÀúÀåÇϹǷΠµ¥ÀÌŸº£À̽º ÆÄÀÏÀÇ Å©
±â¸¦ ÁÙ Àϼö ÀÖ´Ù.)
------------------------------------
ex.
car_model VARCHAR(10);
------------------------------------
¢Á INT (M) [Unsigned]
INT µ¥ÀÌŸŸÀÔÀº -2147483648 ¿¡¼ 2147483647 »çÀÌÀÇ Á¤¼ö¸¦ ÀúÀåÇÑ´Ù.
"unsigned" ¿É¼Ç°ú ÇÔ²² 0ºÎÅÍ 4294967295 ¹üÀ§ÀÇ Á¤¼ö¸¦ ³ªÅ¸³¾ ¼öµµ ÀÖ´Ù.
-----------------------------------------------------------
ex.
light_years INT;
Valid integer: '-24567'. Invalid integer: '3000000000'.
-----------------------------------------------------------
ex.
light_years INT unsigned;
Valid integer: '3000000000'. Invalid integer: '-24567'.
-----------------------------------------------------------
¢Á FLOAT [(M,D)]
FLOAT´Â ´Ù¼Ò Á¤È®ÇÑ ¼ýÀÚÀÇ Ç¥½Ã°¡ ÇÊ¿äÇÒ ¶§ »ç¿ëµÇ¾îÁö¸ç, ÀÛÀº ¾çÀÇ ¼Ò¼öÁ¡ ¼ýÀÚ¸¦ ³ª
Ÿ³½´Ù.
------------------------------------
ex.
rainfall FLOAT (4,2);
------------------------------------
ÀÌ°ÍÀº ¼Ò¼öÁ¡ °ªÀÌ µÉ ¼ö ÀÖ´Â ÀϳⰣ Æò±Õ°¼ö·®À» ³ªÅ¸³¾ ¼ö ÀÖ´Ù. Á» ´õ ¸íÈ®ÇÏ°Ô
¸»Çϸé FLOAT (4,2) ´Â 4°³ÀÇ ÀúÀåÇÒ ¼ö ÀÖ´Â ÃÖ´ë ÀÚ¸® ¼ö¿Í 2°³ÀÇ ¼Ò¼öÁ¡ ÀÌÇÏÀÇ ÀÚ¸® ¼ö
¸¦ °¡¸®Å²´Ù.
42.35 Àº ¿Ã¹Ù¸¥ °ªÀÌ´Ù.
324.45 Àº Ʋ¸° °ªÀÌ´Ù. 324.5·Î ÇØ¾ß ¸Â´Ù.
2.2 Àº ¿Ã¹Ù¸¥ °ªÀÌ´Ù.
34.542 Àº Ʋ¸° °ªÀÌ´Ù. 34.54·Î ÇØ¾ß ¸Â´Ù.
ÁÖÀÇ) FLOAT ´Â ¾î¸²ÀâÀº ¼öÀ̱⠶§¹®¿¡ MySQL ³»¿¡ Æ÷ÇÔ µÈ Á¤¼öÀÇ °ªÀÌ ¾Æ´Ñ µ¥ÀÌŸ ŸÀÔ
À¸·Î µ·ÀÇ °ªÀ» ³ªÅ¸³¾ ¶§¿¡´Â DECIMALÀ» »ç¿ëÇÏ´Â °ÍÀÌ ´õ Çö¸íÇÑ ¹æ¹ýÀÌ´Ù. ´õ¿í ÀÚ¼¼
ÇÑ ¼³¸íÀ» ¿øÇÏ¸é ¸Å´º¾óÀ» Âü°íÇϱ⠹ٶõ´Ù.
¢Á DATE
³¯Â¥¿Í °ü·ÃµÈ Á¤º¸¸¦ ÀúÀåÇÑ´Ù. µðÆúÆ® Çü½ÄÀº 'YYYY-MM-DD' À̸ç, '0000-00-00' ¿¡¼
'9999-12-31'±îÁöÀÇ ¹üÀ§¸¦ °®´Â´Ù. MySQLÀº ÀÌ ±â»ç¿¡¼´Â ´Ù·ç¾îÁö±â ³Ê¹« ¹æ´ëÇÑ ¸·°
ÇÑ ³¯Â¥Çü½ÄÀÇ Á¶Àý°ú Á¶ÀÛ ¸í·É¾î¸¦ Á¦°øÇÑ´Ù. MySQL ¸Å´º¾ó¿¡ ÀÌ ±â´É¿¡ ´ëÇؼ
ÀÚ¼¼ÇÏ°Ô ´Ù·ç¾îÁ® ÀÖÀ¸¹Ç·Î Âü°íÇϱ⠹ٶõ´Ù.
------------------------------------
ex.
the_date DATE;
------------------------------------
¢Á TEXT / BLOB
text ¿Í blob µ¥ÀÌŸ ŸÀÔÀº 255 - 65535 ÀÚÀÇ ¹®ÀÚ¿À» ÀúÀåÇÒ ¶§ »ç¿ëµÈ´Ù. ÀÌ°ÍÀº ¿©
·¯ºÐÀÌ ÀÐÀº ±â»ç¿Í °°Àº °ÍÀ» ÀúÀåÇϱ⿡ À¯¿ëÇÏ´Ù. ±×·¯³ª VARCHAR ¿Í CHARó·³ µü Àß
¶ó ºñ±³ÇÒ ¼ö´Â ¾ø´Ù. ´ÜÁö BLOB ¿Í TEXT »çÀÌ¿¡ Â÷ÀÌÁ¡ÀÌ ÀÖ´Ù¸é BLOBÀº º¯Çϱ⠽¬¿î
°æ¿ì¿¡ ºñÀ¯ÇÒ ¼ö ÀÖ°í, TEXT´Â ¿µÇâÀ» ¹ÞÁö ¾Ê´Â ¹«°¨°¢ÇÑ °æ¿ì¿¡ ºñÀ¯ÇÒ ¼ö ÀÖ´Ù.
¢Á SET
ÁöÁ¤µÈ °ªÀ¸·ÎºÎÅÍ ¾î¶² ÁÖ¾îÁø °ªÀ» ¼±ÅÃÇÏ´Â, Á¤ÇØÁø ¹®ÀÚ¿ÀÇ µ¥ÀÌŸ ŸÀÔÀ¸·Î ±×°ÍÀº
ÇϳªÀÇ °ªÀÌ µÉ ¼öµµ ÀÖ°í ¿©·¯°³ÀÇ °ªÀ» °¡Áú ¼öµµ ÀÖ´Ù. 64°³ÀÇ °ª±îÁö ÁöÁ¤ÇÒ ¼ö ÀÖ´Ù.
-------------------------------------------
ex.
transport SET ("truck", "wagon") NOT NULL;
-------------------------------------------
À§ÀÇ ¿¹·ÎºÎÅÍ ¼ö¼Û±â°ü(transport)Àº ´ÙÀ½ÀÇ °ªµéÀ» °¡Áú ¼ö ÀÖ´Ù.
------------------------------------
""
"truck"
"wagon"
"truck","wagon"
------------------------------------
¢Á ENUM
SET µ¥ÀÌŸ ŸÀÔ°ú ºñ½ÁÇÑ Æ¯Â¡À» °®´Â Á¤ÇØÁø ¹®ÀÚ¿ÀÇ µ¥ÀÌŸ ŸÀÔÀÌÁö¸¸ ¼±ÅÃÇÒ ¼ö ÀÖ´Â
°ªÀÌ Çϳª·Î¸¸ Á¤ÇØÁ® ÀÖ´Ù´Â Á¡ÀÌ ´Ù¸£´Ù. ÇÑ °ø°£ÀÇ ¹ÙÀÌÆ®¸¸À» °¡Áö¹Ç·Î Å×ÀÌºí³»ÀÇ
½Ã°£°ú °ø°£À» Àý¾àÇÒ ¼ö ÀÖ´Ù.
-------------------------------------------
ex.
transport ENUM ("truck", "wagon") NOT NULL;
-------------------------------------------
À§ÀÇ ¿¹·ÎºÎÅÍ ¼ö¼Û±â°ü(transport)Àº ´ÙÀ½ÀÇ °ªµéÀ» °¡Áú ¼ö ÀÖ´Ù.
------------------------------------
NULL
"truck"
"wagon"
"truck"
------------------------------------
2.2 ·¹ÄÚµå
µ¥ÀÌŸµéÀº °ü·ÃµÈ °Íµé³¢¸® ¹¿©¼ µð½ºÅ©¿¡ ÀúÀåµÇ´Âµ¥ ÀÌ·¯ÇÑ µ¥ÀÌŸÀÇ ¹À½À» ·¹ÄÚµå¶ó
°í ÇÑ´Ù. ·¹ÄÚµå´Â µ¥ÀÌŸÀúÀåÀÇ ±âº»´ÜÀ§À̸ç, ÇϳªÀÇ ·¹ÄÚµå´Â ¼·Î ´Ù¸¥ ÇüÅÂÀÇ °ª(µ¥ÀÌ
ŸŸÀÔ)À» °¡Áú ¼öÀÖ´Ù. ¾Æ·¡¿¡ ³ª¿µÈ À̸§, ÁÖ¼Ò, ÀüȹøÈ£´Â °¢°¢ ¼¼°³ÀÇ ºÎºÐÀ¸·Î ±¸¼º
µÈ ·¹ÄÚµå·Î ÀúÀåÇÒ ¼ö ÀÖÀ¸¸ç ÀÌ·¯ÇÑ ·¹ÄÚµå´Â µ¥ÀÌŸ°¡ ÀúÀåµÇ´Â ±âº»´ÜÀ§·Î¼ ÇϳªÀÇ
Å×À̺íÀ» ±¸¼ºÇÑ´Ù.
À̸§ | ÁÖ¼Ò | ÀüȹøÈ£
--------|-------|---------
¿øÁÖÈñ | Çѱ¹ | 007-0000
È«±æµ¿ | ºÏÇÑ | 008-0909
2.3 Å×À̺í(The Bigger Picture: Tables)
--------------------------------------
¿ì¸®´Â µ¥ÀÌŸº£À̽º »ó¿¡¼ ¾î¶°ÇÑ ¸í·É¾îµéÀ» ¼öÇàÇϱâ Àü¿¡, ¸ÕÀú µ¥ÀÌŸ°¡ ÀúÀåµÉ ¼ö
ÀÖ´Â Å×À̺íÀ» ¸¸µé¾î¾ß ÇÑ´Ù. ÀÌ°ÍÀº ´ÙÀ½°ú °°Àº ¹æ¹ýÀ¸·Î ¸¸µé¾îÁø´Ù.
------------------------------------
mysql> CREATE TABLE test (
> name VARCHAR (15),
> email VARCHAR (25),
> phone_number INT,
> ID INT NOT NULL AUTO_INCREMENT,
> PRIMARY KEY (ID));
------------------------------------
Å×À̺íÀÌ ¼º°øÀûÀ¸·Î ¸¸µé¾îÁö¸é ´ÙÀ½°ú °°Àº ȸéÀÌ Ãâ·ÂµÉ °ÍÀÌ´Ù.
------------------------------------
Query OK, 0 rows affected (0.10 sec)
mysql>
------------------------------------
¿©·¯ºÐÀÇ µ¥ÀÌŸº£À̽º¿¡ ù ¹ø° Å×À̺íÀÌ »ý¼ºµÇ¾ú´Ù.
ÁÖÀÇ(1) : ¼·Î ´Ù¸¥ µÎ °³ÀÇ Å×À̺íÀº °°Àº À̸§À» °¡Áú ¼ö ¾ø´Ù.
ÁÖÀÇ(2) : °¢°¢ÀÇ µ¥ÀÌŸ°ø°£Àº Á¾Á¾ Ä÷³(column)À̶ó´Â °³Ã¼ÀÇ ¼Ó¼ºÀ¸·Î ³ªÅ¸³½´Ù.
Ä÷³(Column)ÀÇ Æ¯Â¡ :
------------------------------------
ÇϳªÀÇ À̸§ÀÌ ¼ýÀڷθ¸ ±¸¼ºµÉ ¼ö ¾ø´Ù.
ÇϳªÀÇ À̸§Àº ¼ýÀÚ·Î ½ÃÀÛÇÒ ¼ö ÀÖ´Ù.
ÇϳªÀÇ À̸§Àº 64ÀÚ±îÁö °¡´ÉÇÏ´Ù.
------------------------------------
2.3.1 Å×À̺íÀÇ ´Ù¸¥ ¿É¼Çµé :
³ªÁß¿¡ ´Ù¸¥ Ư¡µé°ú ¼º´ÉÀÌ µ¥ÀÌŸ ŸÀÔ¿¡ Ãß°¡µÉÁö¶óµµ ´ÙÀ½ÀÇ ¿É¼ÇµéÀº °è¼Ó Á¸ÀçÇÒ °ÍÀÌ´Ù.
±âº» Å°(Primary Key) :
=====================
´Ù¸¥ ¼Ó¼ºµé·ÎºÎÅÍ ÇϳªÀÇ ·¹Äڵ带 À¯ÀÏÇÏ°Ô ½Äº°Çϴµ¥ »ç¿ëµÇ¾îÁö¸ç, µÎ °³ÀÇ ·¹ÄÚµå´Â
¶È°°Àº ±âº» Å°¸¦ °¡Áú ¼ö ¾ø´Ù. ÀÌ°ÍÀº µÎ°³ÀÇ ·¹Äڵ尡 Áߺ¹µÇ¾îÁö´Â ½Ç¼ö¸¦ ¾ø¾Ö·Á
°í ÇÒ ¶§ ¾ÆÁÖ ÀûÇÕÇÏ°Ô »ç¿ëµÈ´Ù.
Auto_Increment :
================
ÀÌ ÇÔ¼ö(function)¸¦ °¡Áø Ä÷³(column)Àº ·¹Äڵ忡 »ðÀ﵃ ¶§ ÀÚµ¿ÀûÀ¸·Î ÇÑ °³¾¿ °ªÀÌ
(previous + 1) Áõ°¡ÇÑ´Ù. data°¡ 'NULL'°ª ÀÏ ¶§µµ Ä÷³(column)¿¡ ÀÚµ¿ÀûÀ¸·Î ÇÑ °³¾¿
°ªÀÌ Áõ°¡ÇÏ¿© »ðÀԵȴÙ.
NOT NULL :
==========
NULL°ª(°ªÀÌ ¾ø´Â)À» Àý´ë·Î Çã¿ëÇÏÁö ¾Ê´Â Ä÷³(column)À» ÀǹÌÇÑ´Ù.
------------------------------------
ex.
soc_sec_number INT PRIMARY KEY;
------------------------------------
µÎ °³ÀÇ soc_sec_number ·¹ÄÚµå´Â °°Àº °ªÀ» °¡Áú ¼ö ¾ø´Ù.
------------------------------------
ex.
ID_NUMBER INT AUTO_INCREMENT;
------------------------------------
1 ¿¡¼ ½ÃÀÛÇÑ ID_NUMBER °ªÀº ´ÙÀ½ °ªÀÌ ÀÔ·ÂµÉ ¶§¸¶´Ù ÀÚµ¿ÀûÀ¸·Î 1¾¿ Áõ°¡ÇÑ´Ù.
2.3.2 Å×À̺í°ú °ü·ÃµÈ ¸í·É¾îµé
¿ì¸®´Â ´ÙÀ½°ú °°ÀÌ Å×ÀÌºí¿¡ °ü·ÃµÈ ¸¹Àº À¯¿ëÇÑ ¸í·É¾îµéÀ» ½ÇÇàÇÒ ¼ö ÀÖ´Ù.
¢Á Show Tables
==============
------------------------------------
mysql> show tables;
------------------------------------
°á°ú : µ¥ÀÌŸº£À̽º¿¡ ÇöÀç Á¸ÀçÇÏ°í ÀÖ´Â ¸ðµç Å×À̺íµéÀ» ³ª¿ÇÑ´Ù.
¢Á Show Columns
===============
------------------------------------
mysql> show columns from test;
------------------------------------
°á°ú : ÁöÁ¤µÈ Å×À̺í°ú °ü·ÃµÈ Ä÷³°ú Ä÷³ÀÇ Á¤º¸¸¦ º¸¿©ÁÙ °ÍÀÔ´Ï´Ù.
Å×½ºÆ®¿ë Å×À̺íÀ» »ý¼ºÇÑ ÈÄ¿¡ À§ÀÇ ¸í·É¾îµéÀ» Çѹø¾¿ ½ÇÇàÇغ¸±â ¹Ù¶õ´Ù.
º¹Àâ ´Ù¾çÇÑ µ¥ÀÌŸº£À̽ºÀÇ ÀÌÇØ¿¡ ¸Å¿ì µµ¿òÀÌ µÉ °ÍÀÌ´Ù.
¿©·¯ºÐÀº ÀÌÁ¦ MySQL ¼¹öÀÇ °¡Àå Áß¿äÇÑ °³³äÀÎ, Å×À̺íÀ» »ý¼ºÇÏ´Â ±âº»ÀûÀÎ °úÁ¤À» ÀÌÇØ
Çß´Ù. ¶ÇÇÑ Å×À̺íÀº ¼·Î´Ù¸¥ ÇüÅÂÀÇ µ¥ÀÌŸŸÀÔÀ¸·Î ÀÌ·ç¾îÁø ·¹Äڵ尡 ¸ð¿© ±¸¼ºµÈ´Ù´Â
°Íµµ ¾Ë¾Ò´Ù. ´ÙÀ½ Àå¿¡¼´Â µ¥ÀÌŸº£À̽º¸¦ Á¶ÀÛÇÏ´Â ¹æ¹ý¿¡ ´ëÇØ ¼³¸íÇÒ °ÍÀÌ´Ù.
¡Ü Part 3: µ¥ÀÌŸº£À̽º ´Ù·ç±â(Manipulating the Database)
========================================================
|