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

  ¸®´ª½ºÆÁ  Go Unix Power Tools Online Book Go Bash Guide
Read No. 3 article 2001-08-04 07:56:24
NickName   Ç®ºñ´©
Subject   mysql user db Ãß°¡Çϱâ
¹®ÅÂÁØ´ÔÀÇ È¨ÇÇ¿¡ ÀÖ´Â °ÍÀ» Á¶±Ý ÆíÁýÀ» ÇßÀ¾´Ï´Ù. 


1. »õ·Î¿î µ¥ÀÌÅͺ£À̽º¸¦ »ý¼ºÇÏÀÚ. 

ÀÌ°ÍÀº mysqlÀÇ root ·Î¼­ ÀÛ¾÷ÇÑ´Ù. 

mysql> create database user1; 
Query OK, 1 row affected (0.01 sec) 

ÀÌ·¯¸é 'user1'À̶ó´Â »õ·Î¿î µ¥ÀÌÅͺ£À̽º°¡ »ý¼ºµÈ´Ù. 
°á°ú¸¦ º¸·Á¸é ´ÙÀ½°ú °°ÀÌ ÇÑ´Ù. 

mysql> show databases; 
+-----------+ 
| Database  | 
+-----------+ 
| mysql     | 
| test      | 
| user1     | 
+-----------+ 
5 rows in set (0.00 sec) 


2. »ç¿ëÀÚ µî·Ï ¹× ±ÇÇÑÁÖ±â. 

À§ÀÇ °úÁ¤Àº ´ÜÁö µ¥ÀÌÅͺ£À̽º¸¦ »ý¼ºÇϱ⸸ ÇßÀ»»ÓÀÌ´Ù. 
±×·¯¹Ç·Î, »ç¿ëÀÚ ¹× ±ÇÇÑ ±×¸®°í mysql°ü¸® Å×À̺í°úÀÇ ¿¬°áÀÌ ÇÊ¿äÇÏ´Ù. 
ÀÌ·¸ÇÑ °ÍÀ» °ü¸®Çϱâ À§ÇÏ db°¡ 'mysql' À̶ó´Â µðºñÀÌ´Ù. 

mysql »óÀÇ db, user Å×ÀÌºí¿¡ ¹æ±Ý »ý¼ºµÈ user1 Database ¿¡´ëÇÑ 
Á¤º¸¸¦ ÀÔ·ÂÇÏÀÚ. 

db´Â µ¥ÀÌÅͺ£À̽ºµéÀÇ Á¤º¸¸¦ °¡Áö°í ÀÖ´Â Å×À̺í, 
user´Â »ç¿ëÀڵ鿡 ´ëÇÑ Á¤º¸¸¦ °¡Áö°í ÀÖ´Â Å×À̺íÀÌ´Ù. 

mysql> insert into db 
    ->  (host,db,user,select_priv,insert_priv,update_priv 
    ->  ,delete_priv,create_priv,drop_priv,grant_priv, 
    ->  references_priv,index_priv,alter_priv) 
    ->  values ('%','user1','user1_name', 
    ->  'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y') 
    -> ; 
Query OK, 1 row affected (0.01 sec) 

mysql> desc db; 

¶ó´Â ¸í·É¾î¸¦ »ç¿ëÇÏ°Ô µÇ¸é, dbÅ×À̺íÀÇ ±¸Á¶°¡ ÀÖÀ¸´Ï ±×°ÍÀ» 
ÂüÁ¶ÇØ¾ß ÇÑ´Ù. 
insert ½Ã¿¡ öÀÚ°¡ Ʋ·Á¼­µµ ¾ÈµÇ¸ç, Çʵå¼ýÀÚ¿¡ ¸Âµµ·Ï °ªÀ» Á¤È®È÷ 
±âÀçÇØ¾ß ÇÑ´Ù. 

ÀÌÁ¦ user1_name À̶ó´Â »ç¿ëÀÚ´Â user1 µ¥ÀÌŸº£À̽º¿¡ ´ëÇÏ¿© 
select, insert, update, delete, create, drop, grant, references, index, alter 
±ÇÇÑÀÌ ¸ðµÎ ÁÖ¾îÁ³´Ù. 
¿©±â¼­ db¶ó´Â Å×À̺íÀ» ÀÌ¿ëÇؼ­ »ç¿ëÀÚÀÇ ±ÇÇÑÀ» Á¦ÇÑÇÒ¼ö ÀÖ´Ù. 
À§¿¡¼­ 'Y'·Î µÇ¾î ÀÖ´Â °ÍÀ» 'N'·Î ¹Ù²Ù¸é ±× ±ÇÇÑÀÌ »èÁ¦ µÇ´Â °ÍÀÌ´Ù. 
¿¹¸¦ µé¾î delete¿¡ ÇØ´çÇÏ´Â °ªÀ» 'N'·Î ÇÏ¿´´Ù¸é, user1_name À̶ó´Â 
»ç¿ëÀÚ´Â user1 À̶ó´Â µ¥ÀÌÅͺ£À̽º¿¡ ÀÖ´Â Å×À̺íÀ» »èÁ¦ÇÒ¼ö ¾ø°ÔµÈ´Ù. 

ÀÚ ÀÌÁ¦ user1 À̶ó´Â »ç¿ëÀÚ¿¡ ´ëÇÑ µî·ÏÀ» ÇÒ Â÷·ÊÀÌ´Ù. 

mysql> insert into user 
    -> (host,user,password) 
    -> values ('localhost','user1_name',password('user1_password')) 
    -> ; 
Query OK, 1 row affected (0.00 sec) 

¿©±â¼­ Æнº¿öµå ºÎºÐÀ» Á» »ìÆì º¸ÀÚ. 
Å×ÀÌºí¿¡ Æнº¿öµå¸¦ ÀÔ·ÂÇÒ¶§ 
password('user1_password') 
À§¿Í °°ÀÌ Çß´Ù. password()´Â mysql ³»Àå ÇÔ¼ö·Î ¸Å°³ º¯¼ö¸¦ ¾ÏȣȭÇÑ´Ù 
ÀÌ·¸°Ô ÇÏÁö ¾Ê´Â´Ù¸é mysqlÀº ¿¡·¯´Â ³»°Ô µÈ´Ù. 

Âü°í. 
¿©±â¼­ »ý·«ÇÑ Ç׸ñ(Çʵå)¿Í °ªÀº ±âº»°ªÀÎ 'N'·Î ÀԷµȴÙ. 
»ý·«ÇÑ Ç׸ñÀº »ç¿ëÀÚÀÇ ±ÇÇÑÀ» ¼³Á¤ÇÏ´Â ºÎºÐÀε¥.. 
¿©±â user ¶ó´Â Å×ÀÌºí¿¡¼­ »ç¿ë ±ÇÇÑÀ» ÁְԵǸé.. 
±× »ç¿ëÀÚ´Â mysqlÀÇ ¸ðµç µ¥ÀÌÅͺ£À̽º¿¡ ´ëÇؼ­ ±ÇÇÑÀ» °¡Áö°Ô µÈ´Ù. 
´Ù½Ã ¸»Çؼ­ ÀÚ½ÅÀÇ µ¥ÀÌÅÍ º£À̽º°¡ ¾Æ´Ñ ´Ù¸¥ µ¥ÀÌÅͺ£À̽º¿¡¼­µµ 
Á¶ÀÛÇÒ¼ö ÀְԵȴٴ °ÍÀ» ¶æÇÕ´Ï´Ù. 

±×·¡¼­ »ç¿ëÀÚ¸¦ µî·Ï ÇÒ¶§´Â ¾Æ¹«·± ±ÇÇÑÀ» ÁÖÁö ¾Ê°í, 
µ¥ÀÌÅͺ£À̽º¸¦ µî·ÏÇÒ¶§ »ç¿ëÀÚ¸¦ ÁöÁ¤ÇÏ°í ±ÇÇÑÀ» ºÎ¿©ÇÏ´Â °ÍÀÌ´Ù. 

******************************************************************* 
Áß¿äÇÑ tip...... 
******************************************************************* 
user Å×ÀÌºí¿¡ »ç¿ëÀÚ¸¦ insert, update  ÇÑ °æ¿ì MySQLÀ» ²À Àç±âµ¿½ÃÄÑ ÁÖ¾î¾ß¸¸ 
ÇÑ´Ù. ¸í·ÉÀº ´ÙÀ½°ú °°´Ù. 
     myaqladmin -u root -p reload 
ÀÌ ¸í·ÉÀº user Å×ÀÌºí¿¡¼­ »ç¿ëÀÚ Á¤º¸¸¦ ´Ù½Ã Àо MySQL À» ´Ù½Ã ½ÇÇà½ÃÄÑÁØ´Ù. 
---- ¹Ú¼øÇà(soonhg)´ÔÀÇ °­ÀÇ·ÏÁß¿¡¼­ 
******************************************************************* 

ÃÖÁ¾Á¤¸®. 
µ¥ÀÌÅͺ£À̽º »ý¼º°ú À¯Àúµî·Ï. 
¼ø¼­´Â »ó°ü ¾øÁö¸¸ ÀϹÝÀûÀ¸·Î ´ÙÀ½°ú °°ÀÌ ÇÑ´Ù.(À§¿¹Á¦¿Í´Â Á¶±×´Ù¸£´Ù) 

1. µ¥ÀÌÅͺ£À̽º¸¦ »ý¼ºÇÑ´Ù. 
mysql>create database database_name; 

2. À¯Àú¸¦ µî·ÏÇÑ´Ù. À̶§ ¾Æ¹«·± ±ÇÇÑÀ» ÁÖÁö ¾Ê´Â´Ù. 
mysql>insert into user; (ÀÚ¼¼ÇÑ °ÍÀº À§¸¦ ÂüÁ¶ ) 

3. µ¥ÀÌÅͺ£À̽º¸¦ µî·ÏÇÑ´Ù. 
   ¿©±â¼­ µ¥ÀÌÅͺ£À̽º¸¦ »ç¿ëÇÒ¼ö ÀÖ´Â ±ÇÇÑÀ» À¯Àú¿¡°Ô ºÎ¿©ÇÑ´Ù. 
mysql>insert into db; (¿ª½Ã ÀÚ¼¼ÇÑ °ÍÀº À§¸¦ ÂüÁ¶.) 

4. mysqlÀ» Àç½ÃÀÛ ÇÑ´Ù.
Regist Addr [ 210.221.19.151 ] ¸ñ·Ïº¸±â À­±Û ¾Æ·§±Û
Á¤±ÔÇ¥Çö½Ä [ »ó¼¼ °Ë»ö ]
Page Loading [ 0.03 Sec ] SQL Time [ 0 Sec ]

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

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