B / Y / U / S
HOME À¥ È£½ºÆà µµ¸ÞÀÎ ¸Å´º¾ó °í°´Áö¿ø ¼³Á¤Á¤º¸ °èÁ¤½Åû 2024-12-24 Tuesday 
À¥ È£½ºÆÃ
# °øÁö »çÇ×
# ÀÚÁÖ ¹¯´Â Áú¹®
# Áú¹®°ú ´äº¯
# °¡ÀÔ ¹®ÀÇ
Ä¿¹Â´ÏƼ
# ÀÚÀ¯°Ô½ÃÆÇ
# ¸®´ª½ºÆÁ
# ¾ÆÀÌÅ¥ Å×½ºÆ®
# ³»È¨ ¼Ò°³
# °Ö·¯¸®
# ÀÚ·á½Ç

  ¸®´ª½ºÆÁ  Go Unix Power Tools Online Book Go Bash Guide
Read No. 112 article 2002-02-23 01:13:56
NickName   Ç®ºñ´©
Subject   [mysql] MySQL °èÁ¤ »èÁ¦. ¿¹Á¦ Æ÷ÇÔ.
Ãâó : http://lse.pe.kr/board/read.php?table=tip&no=142

mysql ¿¡ ´ëÇÑ °èÁ¤ Ãß°¡ ¹æ¹ýÀº ¸¹ÀÌ »ç¿ëÇÏ¸ç ¸¹ÀÌ ¾Ë·ÁÁø ÆíÀÔ´Ï´Ù.
±×·¯³ª °èÁ¤ Á¦°Å¿¡ ´ëÇÑ ³»¿ëÀº ã±â ¾î·Æ´õ±º¿ä.

½ÇÁ¦ Ãß°¡º¸´Ù´Â Á¦°Å°¡ ´õ Áß¿äÇÒ¼öµµ Àִµ¥ ¸»ÀÌÁÒ.

1. mysql¿¡ root ·Î Á¢¼ÓÇÕ´Ï´Ù.

[root@linuxse root]# mysql -u root -p mysql

2. »ç¿ëÇÒ DB¸¦ ¼±ÅÃÇÕ´Ï´Ù.

mysql>use mysql

3. ÇØ´ç DB¿Í °èÁ¤¿¡ ´ëÇÑ ¸ñ·ÏÀ» È®ÀÎÇÕ´Ï´Ù.

mysql> select host,db,user from db;
+-----------+-----------+-----------+
| host      | db        | user      |
+-----------+-----------+-----------+
| %         | test      |           |
| %         | test\_%   |           |
| localhost | alavu5    | alavu5    |
| localhost | korweblog | korweblog |
| localhost | snort     | korweblog |
| localhost | snort     | snort     |
+-----------+-----------+-----------+
6 rows in set (0.00 sec)

ÀúÀÇ °æ¿ì ¾Æ·¡ ³»¿ëÀ» Áö¿ì°íÀÚ ÇÕ´Ï´Ù.

localhost | korweblog | korweblog
localhost | snort     | korweblog
localhost | snort     | snort

4. ´õÀÌ»ó ÇÊ¿ä¾ø´Â ³»¿ëÀº Áö¿ó´Ï´Ù.

mysql> delete FROM db where db = 'snort' and user = 'korweblog';
Query OK, 1 row affected (0.02 sec)

mysql> delete FROM db where db = 'snort' and user = 'snort';
Query OK, 1 row affected (0.00 sec)

mysql> delete FROM db where db = 'korweblog' and user = 'korweblog';
Query OK, 1 row affected (0.00 sec)

5. ´Ù½Ã È®ÀÎÇÕ´Ï´Ù.

mysql> select host,db,user from db;
+-----------+---------+--------+
| host      | db      | user   |
+-----------+---------+--------+
| %         | test    |        |
| %         | test\_% |        |
| localhost | alavu5  | alavu5 |
+-----------+---------+--------+
3 rows in set (0.00 sec)

Áö¿ï°ÍÀÌ ´õ ÀÖÁÒ?
¹Ù·Î test ¿¡ ´ëÇÑ ³»¿ëÀÔ´Ï´Ù. mysqlÀ» ¼³Ä¡ÇÏ¸é ±âº»ÀûÀ¸·Î ¼³Ä¡°¡ µÇ´Âµ¥ 
db ´Â °ÅÀÇ 
Áö¿ì½Ç °Ì´Ï´Ù. ±×·±µ¥ ¾ÆÁ÷ ³²¾ÆÀÖ±º¿ä. Àú¿ª½Ã db ÀÚü´Â Áö¿ü´ø°Å °°Àº
µ¥... ¾Ë°íº¸
´Ï host ÂÊ¿¡ %·Î µÇ¾î ÀÖ½À´Ï´Ù. Áï, ¾î´À°÷¿¡¼­³ª Á¢¼ÓÀÌ °¡´ÉÇÏ´Ù´Â °ÍÀÔ´Ï
´Ù.

¹Ýµå½Ã Áö¿ì½Ê½Ã¿À.

mysql> delete FROM db where db = 'test';
Query OK, 1 row affected (0.00 sec)

mysql> delete FROM db where db = 'test\_%';
Query OK, 1 row affected (0.00 sec)

mysql> select host,db,user from db;
+-----------+--------+--------+
| host      | db     | user   |
+-----------+--------+--------+
| localhost | alavu5 | alavu5 |
+-----------+--------+--------+
1 row in set (0.00 sec)

±ò²ûÇÏÁÒ? ^^*

À§ÀÇ ³»¿ëÀº ´Ü¼øÈ÷ ¿¹Á¦ÀÔ´Ï´Ù. À̼­¹öÀÇ ³»¿ë°ú ¹«°üÇÕ´Ï´Ù. ^^;
Regist Addr [ 192.168.0.2 ] ¸ñ·Ïº¸±â À­±Û ¾Æ·§±Û
Á¤±ÔÇ¥Çö½Ä [ »ó¼¼ °Ë»ö ]
Page Loading [ 0.03 Sec ] SQL Time [ 0 Sec ]

Copyleft 1999-2024 by JSBoard Open Project
Theme Designed by IDOO And follow GPL2

°³ÀÎÁ¤º¸ Ãë±Þ¹æħ ÀÌ¿ë ¾à°ü »çÀÌÆ® ¸Ê ¾îµå¹Î °ü¸®