Á¦ 7°­ root ¾ÏÈ£¸¦ ÀÒ¾î¹ö·ÈÀ» ¶©

  Ãâó : http://gwangcom.co.kr

 
 Á¦ 7°­ root ¾ÏÈ£¸¦ ÀÒ¾î¹ö·ÈÀ» ¶©

¾ÏÈ£¸¦ ÀÒ¾î¹ö·ÈÀ» °æ¿ì Áï My-SQL¿¡¼­ »ç¿ëÇÏ´Â root¾ÏÈ£°¡ ¹ºÁö ¸ð¸¥´Ù¸é ´ÙÀ½°ú °°Àº ¹æ¹ýÀ¸·Î ¹Ù²Ü ¼ö ÀÖ ´Ù.

1.¸ÕÀú My-SQL µ¥¸óÀ» ¸ðµÎ Á×ÀδÙ.
[root@kebidido mysql] #  killall mysqld

2.-- skip-grant ¿É¼ÇÀ» ÀÌ¿ëÇؼ­ ±ÇÇÑÅ×À̺íÀ» »ç¿ëÇÏÁö ¾Ê´Â ¿É¼ÇÀ¸·Î µ¥¸óÀ» ¶ç¿î´Ù.
 [root@kebidido mysql] #  ./bin/safe_mysqld --skip-grant &
Starting mysqld daemon with databases from /usr/local/mysql/data

¿©±â¼­ My-SQLµ¥¸óÀÇ ÇÁ·Î¼¼ ¼­¸¦ È®ÀÎÇØ º¸¸é
[root@kebidido mysql] # ps  -aux | grep mysqld
root 4343 0.0  0.3  1330  626 pts/4  S  03:23 0:00 sh ./bin/safe_mysqld
root 4353 0.0  0.2  2330  626 pts/4  SN  03:23 0:00  /usr/local/mysql
root 4355 0.0  0.2  2330  626 pts/4  SN 03:23 0:00  /usr/local/mysql
root 4356 0.0  0.3  2330  626 pts/4  SN  03:23 0:00  /usr/local/mysql 

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

3.±×·³, ÀÌÁ¦´Â root±ÇÇÑÀ¸·Î DB mysqlÀ» ÀÌ¿ëÇÑ´Ù.
  [root@kebidido 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 970 to server version: 3.22.32

 Type 'help' for help.

 mysql>

4.´ÙÀ½Ã³·³ »õ·Î¿î rootÀÇ ¾ÏÈ£·Î ¹Ù²Û´Ù.
 mysql> UPDATE user SET Password=PASSWORD('newpasswd') WHERE user='root';
 Query OK,  1  row affected (0.01 sec)
 Row matched:2   Changed:  1  Warnungs:  0

5.±×·¯¸é ÀÌÁ¦ ±ÇÇÑ Å×À̺íÀ» ´Ù½Ã Àд´Ù.
 mysql> FLUSH PRIVILEGES;
 Query OK, 0 rows affected (0.05 sec)

mysql À» ºüÁ®³ª°£´Ù.

mysql> \q
Bye

[root@kebido /root] #

 6.MySQL ¼­¹ö µ¥¸óÀ» Á׿©º»´Ù.
  ±×·±µ¥ Á» Àü¿¡ FLUSH PRIVILEGES; ¿É¼ÇÀ¸·Î ±ÇÇÑÀÌ Àç ¼³Á¤ µÈ »óÅÂÀ̹ǷΠÁ¶±Ý Àü ÀÛ¾÷¿¡¼­ ¹Ù²Û ¾ÏÈ£¸¦ ÀÔ·ÂÇØ ¾ß ÇÑ´Ù.
  [root@kebido /root] #  ./bin/mysqladmin -u root -p******  shutdown
  [root@kebido /root] #  mysqld daemon ended

  [1] + Done            &nb sp;         ./bin/safe_m ysqld  --skip-grant

7.ÀÌÁ¦´Â ±ÇÇÑ Å×À̺í À» ÀÌ¿ëÇÑ ¿ø·¡ÀÇ ½ºÅ©¸³Æ®¸¦ ÀÌ¿ë µ¥¸óÀ» ´Ù½Ã ¶ç¿î´Ù.
[root@kebido mysql] # ./bin/safe_mysqld &
[1] 22341
[root@kebido mysql] # Starting mysqld daemon with databases from /usr/local/mysql/data

[root@kebido mysql] #  

8.ÀÚ ÀÌÁ¦´Â ¹Ù²Û ¾Ï È£¸¦ ÀÌ¿ëÇؼ­ mysql ¸¦ »ç¿ëÇÒ ¼ö ÀÖ´Ù.
¾Æ·¡ÀÇ ¹æ¹ýÀ» ±×´ë ·Î µû¶óÇغ¸ÀÚ.
 Ã¹¹ø° ¹æ¹ý # ./bin/mysql -u root -p****** mysql À» »ç¿ëÇصµ µÇ°í
 µÎ¹ø° ¹æ¹ý # ./bin/mysql -u root -p msyql¸¦ ¾²¸é ¾ÏÈ£¸¦ ¹°¾î º» ´Ù.

º¸¾È»ó µÎ¹ø° ¹æ¹ýÀÌ ±Ç ÀåµÇ°í ÀÖ´Ù.
 [root@kebido mysql]# ./bin/mysql -u root -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.32

Type 'help' for help.

mysql> select host,user from user;

+-----------+---------- +
| host            | user         |
+-----------+--- -------+
| localhost    | root           |
| kebido        | root           |
| localhost    |            &nb sp;     |
| kebido        |            &nb sp;     |
| localhost    | kebido       |
| localhost    | superpan |
| localhost    | kingstar     |
| localhost    | angel         |
+-----------+--- -------+
8 rows in set (0.00 sec)

mysql> \q

ÀÚ ÀÌÁ¦ Æнº¿öµå Àç¼³Á¤ÇÏ ´Â ¸ðµç °úÁ¤ÀÌ ¸¶¹«¸® µÇ¾ú´Ù.
¾î¶°ÇÑ ½Ã½ºÅÛÀ̵ç Æнº¿öµå °ü¸®´Â Áß¿ä ÇÏ´Ù.
À¯´Ð½º,¸®´ª½º,NT,Window ¼­¹ö µî ÀÚ½ÅÀÌ ¼­¹ö°ü¸®ÀÚ¶ó¸é À§¿Í °°ÀÌ Æнº¿öµå¸¦ ÀÒ¾î¹ö ¸®´Â »óȲÀÌ ¹ß»ýÇؼ­´Â ¾ÈµÈ´Ù.
¸¸ÀÏ ¼­¹ö°ü¸®ÀÚ°¡ µÇ±â À§Çؼ­ °øºÎ ÁßÀ̶ó¸é Æнº¿öµå °ü¸®ÇÏ´Â ÀÚ¼¼ºÎÅÍ ¹è¿ö¾ß ÇÒ °ÍÀÌ´Ù.