티스토리 뷰

에러내용 : mysql error 1045 access denied for user 'root'@'localhost'

내용 : root 계정에 대한 localhost 접근이 거부되었다.

원인 : mysql 설치 후 root 계정에 대한 비밀번호가 설정되지 않았기 때문이다.

해결방법 : root@localhost에 대한 비밀번호 설정

root@DESKTOP-8UHKC1S:/home/cms# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 26
Server version: 8.0.28-0ubuntu0.20.04.3 (Ubuntu)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> alter user root@localhost identified by '새로운 비밀번호';

 

댓글