MYSQL ¸¹ÀÌ »ç¿ëÇÏ´Â ¸í·É¾î ÀÛ¼ºÀÚ : ±â¼úÁö¿øºÎ ÃÖº¸±Ù milkissu@nextline.net mysql MYSQL ¼³Ä¡À§Ä¡ : /usr/local/mysql/ MYSQL client mysql À§Ä¡ : /usr/local/mysql/bin/mysql 1. MYSQL µ¥ÀÌÅͺ£À̽ºÀÇ ½ÇÇà, ½ÇÇà È®ÀÎ # /usr/local/mysql/bin/mysqld_safe & (3.* ¹öÀü ÀÌÇÏ¿¡¼´Â /usr/local/mysql/bin/safe_mysqld &)
# netstat -anp | grep LISTEN À¸·Î mysqlÀÌ °¡µ¿ µÈ °ÍÀ» È®ÀÎ ÇÕ´Ï´Ù.
2. MYSQL µ¥ÀÌÅͺ£À̽º Á¢¼ÓÇϱ⠻ç¿ëÇü½Ä : mysql -u MYSQL °èÁ¤¸í -p Á¢¼ÓÇÒ µ¥ÀÌÅͺ£À̽º¸í mysql : MYSQL µ¥ÀÌÅͺ£À̽º·Î Á¢¼ÓÇϱâ À§ÇÑ MYSQL Ŭ¶óÀ̾ðÆ® ÇÁ·Î±×·¥ -u : Á¢¼ÓÇÒ MYSQL °èÁ¤(»ç¿ëÀÚ)¸íÀ» ÁöÁ¤Çϱâ À§ÇÑ ¿É¼Ç MYSQL °èÁ¤¸í : µ¥ÀÌÅͺ£À̽º·Î Á¢¼ÓÇÒ MYSQLÀÇ »ç¿ëÀÚ(°èÁ¤)¸í -p : Æнº¿öµå¸¦ ÀÔ·ÂÇϱâ À§ÇÑ ¿É¼Ç Á¢¼ÓÇÒ µ¥ÀÌÅͺ£À̽º¸í : Á¢¼Ó ÈÄ »ç¿ëÇÒ µ¥ÀÌÅͺ£À̽º¸í # mysql -u root -p
3. ÀÏ¹Ý »ç¿ëÀÚ »ý¼º ¹× µ¥ÀÌÅͺ£À̽º »ý¼º root ±ÇÇÑÀ¸·Î Á¢¼ÓÀ» ÇÕ´Ï´Ù. db¸¦ »ý¼ºÇÕ´Ï´Ù. mysql> create database db¸í;
mysql> grant all privileges on °èÁ¤¸í.* to db¸í@"localhost" identified by 'ºñ¹Ð¹øÈ£';
¹æ±Ý »ý¼ºÇÑ °èÁ¤À¸·Î Á¢¼ÓÇÏ¿© È®ÀÎ ÇÕ´Ï´Ù.
4. ÀÏ¹Ý »ç¿ëÀÚ »èÁ¦ ¹× µ¥ÀÌÅͺ£À̽º »èÁ¦ mysql> use mysql : MYSQLÀÇ Á¤º¸°¡ ÀÖ´Â mysql db¸¦ ¼±Åà mysql> show tables; : °¢ Ç׸ñµéÀ» ³ª¿
mysql> select * from user; : »ç¿ëÀÚ °èÁ¤µéÀ» ³ª¿
Áß·«
»ç¿ëÀÚ »èÁ¦ mysql> delete from user where user='À¯Àú¸í';
db »èÁ¦ mysql> show databases; (DBÁ¤º¸È®ÀÎ) mysql> drop database DB¸í; (DB»èÁ¦)
5. root / »ç¿ëÀÚ°èÁ¤ Æнº¿öµå º¯°æ ¹æ¹ý mysql>use mysql; mysql>update user set password=password('¾ÏÈ£ÁöÁ¤') where user='°èÁ¤¸í'; mysql>flush privileges; mysql>quit
6. mysql root Æнº¿öµå¸¦ ºÐ½ÇÇÏ¿´À» °æ¿ì # killall mysqld # mysqld_safe --skip-grant-tables& # mysql –u root –p mysql (ºñ¹Ð¹øÈ£ ÀԷ¿¡¼ ÀԷ¾ÈÇÏ°í ¿£ÅÍ)
mysql> update user set password=password('¾ÏÈ£ÁöÁ¤') where user = 'root'; mysql> flush privileges; mysql> exit
# killall mysqld # mysqld_safe&
Mysqladmin(MYSQL °ü¸®Àü¿ë ¸í·É¾î) ¸í·É¾îÀ§Ä¡ : /usr/local/mysql/bin/mysqladmin »ç¿ëÇü½Ä : mysqladmin –u root –p ¸í·É¾î 1. mysqladmin À¸·Î MYSQL ¼¹ö Á¾·áÇϱâ. # mysqladmin –u root –p shutdown
2. mysqladmin À¸·Î »ç¿ëÀÚ Æнº¿öµå º¯°æÇϱâ. # mysqladmin –u »ç¿ëÀÚ°èÁ¤ –p password º¯°æÇÒ ºñ¹Ð¹øÈ£
3. too many connection ¿¡·¯ ¹ß»ý½Ã # mysqladmin -u root -p variables | grep max_connections (max_connections °ª È®ÀÎ) # mysqladmin -u root -p variables | grep table_cache (table_cache °ª È®ÀÎ) # mysqladmin -u root -p variables | grep wait_timeout (wait_timeout °ª È®ÀÎ )
# mysqladmin –u root -p shutdown # mysqld_safe -O max_connections=500 -O table_cache=256 -O wait_timeout=57600 &
°è¼Ó Àû¿ë ½ÃÄÑÁÙ °æ¿ì¿¡´Â ntsysv¿¡¼ ÇØ´ç µ¥¸ó »èÁ¦ÈÄ /etc/rc.local ¿¡ ¶óÀÎ Ãß°¡ Mysqldump(MYSQL ¹é¾÷ ¸í·É¾î) 1. # mysqldump -u root -p mysql > mysql.sql -> mysql database¸¦ ¹é¾÷ÇÏ¿© mysql.sql ÆÄÀÏ¿¡ ÀúÀå (º¹±¸) -> mysql -u root -p < mysql.sql 2. # mysqldump -u root -p mysql test > test.sql -> mysql databaseÀÇ test Å×À̺íÀ» ¹é¾÷ÇÏ¿© test.sql ÆÄÀÏ¿¡ ÀúÀå (º¹±¸) -> mysql -u root -p < test.sql 3. # mysqldump -u root -p --databases mysql testdb > dbs.sql -> mysql°ú testdb¸¦ ¹é¾÷ÇÏ¿© dbs.sql ÆÄÀÏ¿¡ ÀúÀå (º¹±¸) -> mysql -u root -p < dbs.sql 4. # mysqldump -u root -p --all--databases > ALLDATA.sql -> Àüü µ¥ÀÌÅͺ£À̽º¸¦ ¹é¾÷ÇÏ¿© ALLDATA.sql ÆÄÀÏ¿¡ ÀúÀå (º¹±¸) -> mysql -u root -p < ALLDATA.sql 5. # mysqldump -u root -p --add-drop-table temp_db2 > temp_db2.sql -> ±âÁ¸ Å×ÀÌºí »èÁ¦ÈÄ ¹é¾÷µÈ ÆÄÀÏ·Î º¹±¸
|
|