¸¶½ºÅÍÆ÷À¯(Master4U)
Monday, 17 of January
 

·Î±×ÀÎ Category
[OOPS] Forgotten MySQL Password
±èÀÎÈ£  2008-01-12 17:23:55 Hit:3389
¸µÅ© #1: http://oops.org/?t=lecture&sb=mysql&n=2




°­ÁÂÀÇ ¸ðµç ±Ç¸®´Â º»ÀÎ ±èÁ¤±Õ¿¡°Ô ÀÖÀ¸¸ç ÀÌ °­Á¸¦ »ó¾÷Àû ¸ñÀû À¸·Î ÀÌ¿ë
Çϰųª ´Ù¸¥ °÷À¸·Î ¿Å±æ½Ã¿¡´Â º»ÀÎÀÇ Çã¶ôÀÌ ÀÖ¾î¾ß ÇÑ´Ù. À̱ÛÀÇ °¡Àå ÃֽűÛÀº
http://www.oops.org ¿¡¼­ È®ÀÎÇÒ¼ö ÀÖ´Ù.

WARNNING


Forgotten MySQL Password

À̹ø ÆäÀÌÁö ¿¡¼­´Â MySQL ÀÇ root ¾ÏÈ£¸¦ ÀÒ¾î ¹ö·ÈÀ»¶§¿¡ ´ëóÇÒ ¼ö ÀÖ´Â ¹æ¹ýÀ» ¾Ë¾Æº»´Ù.

¿ì¼± ´ÙÀ½°ú °°ÀÌ MySQL ¼­¹öµ¥¸óÀ» ³»¸°´Ù.

Hanterm - killall mysqld

 [root@bbuwoo mysql]# ps -aux | grep my | grep -v grep

  root 7646 0.0 0.6  1668 808 pts/4 S  09:42 0:00 sh ./bin/safe_mys 
  root 7740 0.0 0.7 10784 980 pts/4 SN 09:45 0:00 /usr/local/mysql/ 
  root 7742 0.0 0.7 10784 980 pts/4 SN 09:45 0:00 /usr/local/mysql/ 
  root 7743 0.0 0.7 10784 980 pts/4 SN 09:45 0:00 /usr/local/mysql/ 

 [root@bbuwoo mysql]# kill -9 7646 7740 7742 7743 

  [1]+ Killed ./bin/safe_mysqld 

 [root@bbuwoo mysql]$

´ÙÀ½ --skip-grant ¿É¼ÇÀ» ÀÌ¿ë ±ÇÇÑÅ×À̺íÀ» »ç¿ëÇÏÁö ¾Ê´Â ¿É¼ÇÀ¸·Î µ¥¸óÀ» ¶ç¿î´Ù. 

Hanterm - killall mysqld

 [root@bbuwoo mysql]# ./bin/safe_mysqld --skip-grant & 

  [1] 7759 

 [root@bbuwoo mysql]# kill 7743: No such process 

  Starting mysqld daemon with databases from /usr/local/mysql/data 

 [root@bbuwoo mysql]#

¿©±â¼­  kill 7743: No such process °ú °°Àº ¸Þ½ÃÁö´Â safe_mysqld ½ºÅ©¸³Æ®°¡ °¡Àå ¸¶Áö¸·¿¡
½ÇÇà ÁßÀÌ´ø µ¥¸óÀÇ ÇÁ·Î¼¼½º¸¦ Á×ÀÌ°í ´Ù½Ã ½ÃÀÛÇÏ·Á´Ù ¸øÃ£¾Æ ³ª¿À´Â ¿¡·¯ ¸Þ½ÃÁö ÀÌÁö¸¸ ±×
³É µ¥¸óÀÌ ¶° ¹ö·ÈÀ¸´Ï ½Å°æ ¾²Áö ¾Ê¾Æµµ µÈ´Ù. 

ÇÁ·Î¼¼½º¸¦ È®ÀÎÇØ º¸¸é.... 

Hanterm - killall mysqld

 [root@bbuwoo mysql]# ps -aux | grep my | grep -v grep

  root 7759 0.0 0.6 1668 812 pts/4 S 09:49 0:00 sh ./bin/safe_mys 
  root 7775 0.0 0.5 2520 696 pts/4 SN 09:49 0:00 /usr/local/mysql/ 
  root 7777 0.0 0.5 2520 696 pts/4 SN 09:49 0:00 /usr/local/mysql/ 
  root 7778 0.0 0.5 2520 696 pts/4 SN 09:49 0:00 /usr/local/mysql/ 

 [root@bbuwoo mysql]#


ÀÌ »óÅ¿¡¼­´Â ±ÇÇÑ Å×À̺íÀ» »ç¿ëÇÏÁö ¾ÊÀ¸¹Ç·Î ¾î¶² È£½ºÆ®¿¡¼­µµ ¾Æ¹« »ç¿ëÀÚ·Î ¸ðµç DB ¿¡
Á¢¼ÓÀÌ °¡´ÉÇÏ´Ù. »¡¸® ÀÛ¾÷À» ³¡³»°í ±ÇÇÑÀ» ¼³Á¤ÇØ DB ¸¦ ´Ù½Ã ¶ç¿ö¾ß ÇÑ´Ù.

±ÇÇÑ ¼³Á¤ Á¦ÇÑÀÌ ¾øÀ¸´Ï °£´ÜÇÏ°Ô root ·Î ·Î±×ÀÎÀ» Çϵµ·Ï ÇÑ´Ù. ±ÇÇÑÀ» ¼³Á¤ÇÏ´Â µ¥ÀÌŸ º£
À̽º mysql À» ÀÌ¿ëÇÑ´Ù.

Hanterm - mysql -uroot mysql


 [root@bbuwoo mysql]# ./bin/mysql -u root mysql 

  Reading table information for completion of table and column names 
  You can turn off this feature to get a quicker startup with -A 

  Welcome to the MySQL monitor. Commands end with ; or \\g. 
  Your MySQL connection id is 1 to server version: 3.23.42 

  Type 'help' for help. 

  mysql> 
  mysql> UPDATE user SET Password=PASSWORD('newpasswd') WHERE user='root'; 

  À§¿Í °°ÀÌ ÆÐ½º¿öµå¸¦ ¼öÁ¤ÇÑ´Ù.

  Query OK, 1 row affected (0.02 sec) 
  Rows matched: 2 Changed: 1 Warnings: 0 

  mysql> FLUSH PRIVILEGES; 
  Query OK, 0 rows affected (0.00 sec) 

  ±ÇÇÑ Å×À̺íÀ» ´Ù½Ã ÀÐ¾î µéÀδÙ.

  mysql> quit
  Bye 

 [root@bbuwoo mysql]#


À§ÀÇ ¼³Á¤ÀÌ ¿Ï·á µÇ¾úÀ¸¸é ´Ù½Ã MySQL ¼­¹ö µ¥¸óÀ» Àç ½ÃÀÛ Çϵµ·Ï ÇÑ´Ù. ÀÌ¹Ì ±ÇÇÑÀÌ Àç¼³Á¤
µÇµµ·Ï FLUSH PRIVILEGES ¿É¼ÇÀ» ½ÇÇàÇÑ »óÅ À̹ǷΠº¯°æÇÑ ÆÐ½º¿öµå¸¦ ÀÌ¿ëÇØ¾ß ÇÑ´Ù.

Hanterm - mysqladmin -uroot -p shutdown


 [root@bbuwoo mysql]# ./bin/mysqladmin -uroot -p shutdown 

  Enter password: *******
  mysqld daemon ended 

  [1]+ Done ./bin/safe_mysqld --skip-grant 

 [root@bbuwoo mysql]#


À§ÀÇ °úÁ¤À» ÅëÇÏ¿© MySQL À» Á×ÀδÙÀ½, ´Ù½Ã ±ÇÇÑ Å×À̺íÀ» ÀÌ¿ëÇÑ ¿ø·¡ÀÇ ½ºÅ©¸³Æ®¸¦ ÀÌ¿ëÇÏ
¿© µ¥¸óÀ» ´Ù½Ã ¶ç¿ìµµ·Ï ÇÑ´Ù.

Hanterm - ./bin/safe_mysqld


 [root@bbuwoo mysql]# ./bin/safe_mysqld & 

  [1] 7859 

 [root@bbuwoo mysql]# Starting mysqld daemon with databases from

  /usr/local/mysql/data 

 [root@bbuwoo mysql]#


ÀÌÁ¦ À§¿¡¼­ º¯°æÇÑ ÆÐ½º¿öµå·Î µé¾î°¥ ¼ö ÀÖ´ÂÁö ´Ù½Ã Å×½ºÆ®¸¦ ÇØ º»´Ù. ´ÙÀ½ÀÇ ¹æ¹ýÀ¸·Î Å×
½ºÆ®¸¦ ÇØ º»´Ù.


# ./bin/mysql -uroot -p**** mysql
¶Ç´Â
# ./bin/mysql -uroot -p mysql


º¸¾È»ó b ¹æ¹ýÀ» ±ÇÀåÇÑ´Ù. (´©°¡ µÚ¿¡¼­ º¸¸é ¾ÈµÇ´Ï±î!) 

Hanterm - mysql -uroot -p mysql


 [root@bbuwoo mysql]# ./bin/mysql -uroot -p mysql 

  Enter password: *****
  Reading table information for completion of table and column names 
  You can turn off this feature to get a quicker startup with -A 

  Welcome to the MySQL monitor. Commands end with ; or \\g. 
  Your MySQL connection id is 1 to server version: 3.22.22 

  Type 'help' for help. 

  mysql> select Host ,User from user ; 
  +-------------------+-------+ 
  | Host              | User  | 
  +-------------------+-------+ 
  | localhost         | root  | 
  | 210.xxx.xx.xxx    | root  | 
  | localhost         | mysql | 
  +-------------------+-------+ 
  5 rows in set (0.00 sec) 

  mysql> quit

 [root@bbuwoo mysql]#



>> ÀÌÀü : MySQL Replication
>> ´ÙÀ½ : MySQL For over 500 Connections


    


º»¹®Àμ⺻¹®¸ÞÀϹ߼Û
¡â MySQL For over 500 Connections [1]
¡ä [OOPS] MySQL Replication
Copyright 1999-2025 Zeroboard / skin by ChanBi