7. MySQL root 패스워드 변경
mysql을 설치하고 나면 root 패스워드를 변경해줘야 한다.
1) --initialize-insecure 를 이용해서 데이타 디렉토리를 초기화 했다면 root 패스워드는 설정되어 있지 않다.
[Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2) --initialize 를 이용해서 데이타 디렉토리를 초기화 했다면 root 패스워드는 데이타 디렉토리를 초기화 할 때
아래와 같이 출력이 되었을 것이다.
[Warning] A temporary password is generated for root@localhost: iTag*AfrH5ej
3) root password 변경
#cd /usr/local/mysql/bin
#./mysql -uroot -p
Enter password:
mysql > alter user 'root'@'localhost' identified by 'password' ;
다시 로그인해보면 변경된 패스워드로 로그인 할 수 있다.
https://dev.mysql.com/doc/refman/8.0/en/data-directory-initialization.html
MySQL :: MySQL 8.0 Reference Manual :: 2.10.1 Initializing the Data Directory
2.10.1 Initializing the Data Directory After MySQL is installed, the data directory must be initialized, including the tables in the mysql system schema: For some MySQL installation methods, data directory initialization is automatic, as described in Secti
dev.mysql.com