ÀúÀ۱ǰü·Ã
WizMallÁ¤½Äµî·Ï
;
Google
[1589]
 
À§Áµå  
À§Áî¸ô  
À§Áî¸ÞÀÏ  
±âŸ  
 
PHP  
ASP  
SQL  
¸®´ª½º  
À©µµ¿ì½º  
ÀÚ¹Ù½ºÅ©¸³Æ®  
¾×¼Ç½ºÅ©¸³Æ®  
HTML  
½ºÅ¸ÀϽ¬Æ®  
 
°øÁö»çÇ×  
Áú¹®°ú ´äº¯  
À⵿»ç´Ï  
½°ÅÍ  
ÀϹÝÀÚ·á½Ç  
¹ö±×½Å°í°Ô½ÃÆÇ  
 

 

 

MySQL À̾߱â

¿©±â¼­´Â Dos »óÅÂ, phpMyAdminÀ» »ç¿ëÇØ¼­ db ó¸®ÇÏ´Â ¹ý, linux»óÅ¿¡¼­ÀÇ db ó¸®ÇÏ´Â ¹ý µî¿¡ ´ëÇØ¼­ ¼³¸í µå¸®°Ú½À´Ï´Ù.
Dos»óÅ¿¡¼­´Â °£´ÜÈ÷, ±×¸®°í phpMyAdminÀº »ç¿ë¹ý ¹× °³³äÀ» ÁÖ·Î ¼³¸íµå¸®¸ç linuxÇÏ¿¡¼­ÀÇ Ã³¸®¹ýÀ» »ó¼¼ÇÏ°Ô ¼³¸íµå¸®°Ù½À´Ï´Ù.


Dos »óÅ¿¡¼­ MySQL ó¸®Çϱâ

http://www.apmsetup.com ¿¡¼­ "APM_Setup" À¸·Î ¼³Ä¡¸¦ ÇϽŠºÐµéµµ ÀÖ°Ú°í Àú ó·³ "PHP Setup for IIS" À¸·Î ¼³Ä¡ÇϽŠºÐµéµµ ÀÖÀ» °Ì´Ï´Ù. ±×·¯³ª °á·ÐÀº °°À¸´Ï È¥µ¿Àº ¸¶¼¼¿ä.. ÀÏ´Ü MySQLÀÌ ¼³Ä¡µÈ °æ·Î¸¦ ãÀ¸¼¼¿ä.. Àú °°Àº °æ¿ì´Â c:\PHP_Setup_for_IIS\MySQL ÀÔ´Ï´Ù. À̰÷Æú´õ¸¦ º¸½Ã¸é bin, data, shareÆú´õ°¡ °¢°¢ Àִµ¥ bin Àº ½ÇÇà¸í·ÉÀÌ, data´Â µ¥ÀÌŸº£À̽º¹× Å×À̺íµéÀÌ share¿¡´Â ÁÖ·Î language °ü·ÃÇÏ¿© µé¾î°¡ ÀÖ½À´Ï´Ù.


ÀÌÁ¦ ¿ì¸®°¡ ÀÛ¾÷ÇÒ database¸¦ »ý¼ºÇØ º¸°Ú½À´Ï´Ù.

ÀÏ´Ü mysql¿¡ root±ÇÇÑÀ¸·Î ·Î±×ÀÎÀ» ÇϰڽÀ´Ï´Ù.
PHP Setup for IIS ¸¦ óÀ½ ¼¼ÆÃÇÏ¼Ì°í ¾ÆÁ÷ password º¯°æÀ» ÇÏÁö ¾ÊÀ¸¼Ì´Ù¸é ±âº» ÆÐ½º¿öµå´Â '123456' ÀÔ´Ï´Ù.

C:\PHP_Setup_for_IIS\MySQL\bin>mysql.exe -u root -p
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 4.0.21-ntf

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

Á¤»óÀûÀ¸·Î ·Î±×ÀÎ µÇ¾ú³×¿ä..^^
ÀÌÁ¨ ¿ì¸®°¡ ÀÛ¾÷ÇÒ Å×À̺íÀ» ¸¸µé°í ±× Å×À̺íÀÇ »ç¿ëÀÚ ¹× ÆÐ½º¿öµå¸¦ ÀÔ·ÂÇϰڽÀ´Ï´Ù.

mysql> create database test_db;
Query OK, 1 row affected <0.08 sec>

mysql> grant all privileges on test_db.* to userid@localhost identified by ' testpwd';
Query OK, 0 rows affected <0.11 sec>


¿©±â¼­´Â ¾à°£ ¼³¸íÀ» µå·Á¾ß°Ú½À´Ï´Ù.

mysql> create database test_db;//»ý¼ºÇÒ Å×À̺í¸í ÀÔ·Â
Query OK, 1 row affected <0.08 sec>

mysql> grant all privileges on test_db.* to userid@localhost identified by ' testpwd';
Query OK, 0 rows affected <0.11 sec>

±»ÀÌ ÇØ¼®À» ÇÏÀÚ¸é testpwd ¶ó´Â ÆÐ½º¿öµå·Î localhost¿¡ ÀÖ´Â userid¿¡°Ô test_dbÀÇ ¸ðµç ±ÇÇÑÀ» Áشٴ ¶æÀÔ´Ï´Ù. ¿©±â¼­ localhost¸¦ ƯÁ¤ ¾ÆÀÌÇÇ·Î ÁöÁ¤Çصµ µË´Ï´Ù. °¡·É shop-wizÀÇ 211.239.155.89·Î Á¢¼ÓÇÏ´Â »ç¶÷¿¡°Ô¸¸ Á¢¼Ó ±ÇÇÑÀ» ÁÖ°Ú´Ù°í Çϸé
mysql> grant all privileges on test_db.* to userid@211.239.155.89 identified by ' testpwd';
ó·³ »ç¿ëÇÏ¸é µË´Ï´Ù.


ÀÏ´Ü À̰÷¿¡¼­´Â dos ȯ°æÇÏ¿¡¼­ÀÇ ¸À¸¸ º¸¾Ò½À´Ï´Ù. ±×·±µ¥ ÀϺΠºÐµéÀº ¾î¶»°Ô À©µµ¿ì¿¡¼­ µµ½º·Î µé¾î°¡´ÂÁö ±Ã±ÝÇØ ÇÏ½Ç °Ì´Ï´Ù.
"½ÃÀÛ -> ½ÇÇà" ÀÌ Ã¢¿¡¼­ cmd ¶ó°í Ä¡½Ã¸é µË´Ï´Ù. cmd commander ÀÇ ¾à¾î °°Àºµ¥..

ÀÌÁ¨ µ¥ÀÌŸ º£À̽ºµµ »ý¼ºÇß°í »ç¿ëÀÚ ¹× ¾ÆÀ̵ð, »ç¿ëÇÒ È£½ºÆ®µµ ÁöÁ¤Çß½À´Ï´Ù. ÀÌÁ¦ ºÎÅÍ´Â phpMyAdmin¿¡¼­ Å×À̺í ó¸®ÇÏ´Â ¹æ¹ýÀ» ¹è¿ìµµ·Ï ÇϰڽÀ´Ï´Ù. http://www.apmsetup.com ¿¡ °¡½Ã¸é À̰Ϳ¡ ´ëÇÑ »ç¿ë¹ýµµ ÀÚ¼¼È÷ ³ª¿Í Àִµ¥ À̰÷¿¡¼­ ´Ù½Ã Çѹø Á¤¸®ÇØ µå¸®°Ú½À´Ï´Ù.


phpMyAdmin »ç¿ëÇϱâ

¼³Ä¡°æ·Î¿¡¼­ mysqladminÀ» ½ÇÇàÇÕ´Ï´Ù.
url ÀÔ·Ââ : http://localhost/phpMyAdmin/



·Î±×ÀÎÈ­¸éÀÔ´Ï´Ù. »ç¿ëÀÚ¸í°ú ¾ÏÈ£¸¦ ÀÔ·ÂÇϼ¼¿ä.^^
½ÇÁ¦ phpMyAdmin ¿¡¼­ ´Ù·ç´Â db, »ç¿ëÀÚ, ÆÐ½º¿öµå °ü·Ã Á¤º¸´Â phMyAdmin/config.inc.php ÆÄÀÏ¿¡¼­ °üÀåÇÕ´Ï´Ù.
¾Æ·¡´Â pl¹öÀüÀÇ ¿¹½Ã ºÎºÐÀÔ´Ï´Ù.

$i++;
$cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname or IP address
$cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port
$cfg['Servers'][$i]['socket'] = ''; // Path to the socket - leave blank for default socket
$cfg['Servers'][$i]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket')
$cfg['Servers'][$i]['extension'] = 'mysql'; // The php MySQL extension to use ('mysql' or 'mysqli')
$cfg['Servers'][$i]['compress'] = FALSE; // Use compressed protocol for the MySQL connection
// (requires PHP >= 4.3.0)
$cfg['Servers'][$i]['controluser'] = 'root'; // MySQL control user settings
// (this user must have read-only
$cfg['Servers'][$i]['controlpass'] = '123456'; // access to the "mysql/user"






ÁÂÃø¿¡ º¸½Ã¸é µµ½ºÃ¢¿¡¼­ »ý¼ºÇÑ test_db °¡ º¸ÀÌÁ®... table»ý¼ºÇϱ⸦ ÅëÇØ¼­ Çϳª Çϳª ±¸¼ºÇÏ´Â °Íµµ ÁÁÁö¸¸ ¿©±â¼­´Â "SQL"À» ÀÌ¿ëÇÏ¿© ¹Ù·Î Å×À̺íÀ» »ý¼ºÇÏ´Â ¹æ¹ýÀ» »ç¿ëÇϰڽÀ´Ï´Ù.





»ý¼ºÇÒ tableÀº testtableÀÔ´Ï´Ù. ¾Æ·¡ ºÎºÐÀ» Ä«ÇÇÇÏ¿© SQL QUERY¹® ÀԷ´ܿ¡ ³Ö¾î½Ã°í ´ÙÀ½À» Ŭ¸¯Çϼ¼¿ä

CREATE TABLE testtable (
uid int(11) NOT NULL auto_increment,
id varchar(20) NOT NULL default '',
passwd varchar(10) NOT NULL default '',
name varchar(20) NOT NULL default '',
email varchar(20) NOT NULL default '',
wdate int(13) NOT NULL default '0',
PRIMARY KEY (uid)
)





ÀÚÃøÀ» º¸½Ã¸é Áö±Ý¸· »ý¼ºÇϽŠtesttableÀ̶ó´Â °ÍÀÌ º¸ÀÔ´Ï´Ù.


CMD ¸ðµå¿¡¼­ ÀÌ ºÎºÐÀ» ÀÔ·ÂÇÏ´Â ¹æ¹ýÀ» ÃÖÁ¾ÀûÀ¸·Î º¸¿© µå¸®°Ú½À´Ï´Ù.

C:\PHP_Setup_for_IIS\MySQL\bin>mysql - u userid -p test_db
Enter password: *******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 58 to server version: 4.0.21-nt

Type 'help;' or '\h' for help. Type ]\c' to clear the buffer.

mysql> CREATE TABLE testtable (
          -> uid int(11) NOT NULL auto_increment,
          -> id varchar(20) NOT NULL default '',
          -> passwd varchar(10) NOT NULL default '',
          -> name varchar(20) NOT NULL default '',
          -> email varchar(20) NOT NULL default '',
          -> wdate int(13) NOT NULL default '0',
          -> PRIMARY KEY (uid)
          -> );
Query OK, 0 rows affected (0.01 sec)




Linux ¿¡¼­ MySQL ó¸®Çϱâ

¸®´ª½º »ó¿¡¼­ÀÇ Ã³¸®µµ CMD »ó¿¡¼­¿Í º° Å« Â÷ÀÌ´Â ¾ø½À´Ï´Ù. ±×·¯³ª ÀÌÈÄ °­Á¿¡¼­ º°µµÀÇ °­Á¸¦ ±¸¼ºÇÏ¿© ¸®´ª½º»ó¿¡¼­ÀÇ db󸮿¡ °üÇÑ ±âº» ¹®¹ýÀ» ¼³¸íµå¸®µµ·Ï ÇϰڽÀ´Ï´Ù. ¿À´ÃÀº CMD¿¡¼­ ÇÑ °Í(°èÁ¤»ý¼º, db»ý¼º, Å×À̺í»ý¼º)À» telnet »óÅ¿¡¼­ ±¸ÇöÇÏ´Â °Í¸¸ º¸°Ú½À´Ï´Ù.

[root@shop-wiz gpggi]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 28547 to server version: 4.0.22-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database test_db;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on test_db.* to userid@localhost identified by 'testpwd';
Query OK, 0 rows affected (0.08 sec)


mysql> \q
Bye
[root@shop-wiz gpggi]# mysql -u useridi -p test_db;
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 28594 to server version: 4.0.22-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE TABLE testtable (
-> uid int(11) NOT NULL auto_increment,
-> id varchar(20) NOT NULL default '',
-> passwd varchar(10) NOT NULL default '',
-> name varchar(20) NOT NULL default '',
-> email varchar(20) NOT NULL default '',
-> wdate int(13) NOT NULL default '0',
-> PRIMARY KEY (uid)
-> )
-> ;
Query OK, 0 rows affected (0.03 sec)

mysql>




[¼³¸í]
mysqlÀ» Á¤»óÀûÀ¸·Î »ç¿ëÇÏ·Á°í ÇØµµ ¸î ÆäÀÌÁö·Î´Â ¼³¸íÀÌ Èûµê´Ï´Ù. ¸¹Àº ³»¿ëµéÀº http://www.mysql.com/ »çÀÌÆ® API Document¸¦ ÂüÁ¶ÇϽñ⠹ٶø´Ï´Ù. ¿©±â¼­´Â ´Ü¼øÇÏ°Ô µû¶ó¼­ ¼Ò±âÀÇ ¸ñÀû¸¸À» ´Þ¼ºÇϴµ¥ ÁßÁ¡ÀûÀ¸·Î ´Ù·ì´Ï´Ù. ±×¸®°í ¾ÕÀ¸·ÎÀÇ ¼³¸íÀº linux basicÀ¸·Î ¼³¸íµå¸®°ÚÀ¸¹Ç·Î windows os »ç¿ëÀÚ¿Í´Â ¾à°£ ÀÎÅÍÆäÀ̽º°¡ ´Ù¸¦ ¼ö ÀÖ½À´Ï´Ù.

À̹øÀå¿¡¼­´Â mysql¿¡¼­ db »ý¼º(¿©±â¼­´Â test_db)¸¸ Çϼŵµ ¼º°øÇÑ °ÍÀÔ´Ï´Ù. ´ÙÀ½Àå¿¡¼­´Â php¿Í mysqlÀÇ °áÇÕÀ» º¸½Ã°Ô µÉ °ÍÀ̸ç php¿¡¼­ table»ý¼º, »èÁ¦, insert, update, delete¿Í °°Àº ¾ÕÀ¸·Î ¿ì¸®°¡ ¿¬µ¿ÇؾßÇÒ °¡Àå ÇʼöÀûÀÎ °Í¸¸ ´Ù·ç°Ú½À´Ï´Ù.