[root@191 mysql]# service mysqld stop
mysqld 를 정지 중: [ OK ]
👆 인증 생략 옵션 + 안전모드로 데몬 실행
[root@191 mysql]# /usr/bin/mysqld_safe --skip-grant-tables &
[1] 32063
[root@191 mysql]# 2022-04-22T00:46:09.882232Z mysqld_safe Logging to '/var/log/mysqld.log'.
2022-04-22T00:46:09.911146Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
✌ 계정 접속 및 grant reload ( FLUSH PRIVILEGES
)
[root@191 mysql]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.28 MySQL Community Server - GPL
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> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
grant reload 생략되면 에러 발생
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Study3306!';
Query OK, 0 rows affected (0.01 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
[root@191 mysql]# service mysqld restart
2022-04-22T01:01:34.743090Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
mysqld 를 정지 중: [ OK ]
mysqld (을)를 시작 중: [ OK ]
[1]+ Done /usr/bin/mysqld_safe --skip-grant-tables