본문 바로가기
인터넷/모바일

mysql 암호 잊어버렸을 때

by blade. 2020. 2. 8.

mysql 암호를 잊어버렸다. 인터넷을 뒤져보니, 아래처럼 하면 된다고 했는데...

1
2
mysql> update user set password=password('1111') where user='root';
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
cs

 

실제로 해보니 에러가....

그래서 좀 더 찾아봤더니 다른 해결책이 있었다.

1
2
3
4
5
6
7
bash~$ sudo service mysql stop
bash~$ sudo mysqld_safe --skip-grant-tables &
bash~$ mysql 
mysql> update user set authentication_string=password('암호') where user='root';
mysql> flush privileges;
mysql> exit
bash~$ sudo service mysql start
cs

잘 된다.