주변기기/우분투(서버)

mysql root 비번 설정 방법

다차원입체세상 2011. 6. 6. 03:37


처음 설치후 비밀번호 설정하기(굵은 글씨부분을 입력)

# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 5.0.24a-Debian_3.infrant1

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

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

Database changed
mysql> update user set password=password('설정할 비밀번호') where user='root';
Query OK, 1 row affected (0.48 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges; //------------------>반드시 해줄 것!!
Query OK, 0 rows affected (0.01 sec)

mysql> select host, user, password from user;//---------------->확인해보자
+-----------+------------+-------------------------------------------+
| host      | user       | password                                  |
+-----------+------------+-------------------------------------------+
| localhost | root       | 암호화된 비밀번호가 뜬다!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
+-----------+------------+-------------------------------------------+
1 rows in set (0.00 sec)

mysql> \q
Bye

# mysql -u root -p
Enter password:

비밀번호 설정후에는 -u 옵션으로 root 넣어주고 -p옵션으로 비밀번호 쳐 줘야한다.

비번 변경은 위와 같이 들어가서 처음 하듯이 하면 된다.