서버 & 시스템/Linux

MySQL root 비밀번호 초기화

잇츠유- 2017. 10. 5. 02:03
반응형


1. mysqld_safe 를 통한 초기화


1) 실행중인 MySQL 서비스 중지

# /etc/init.d/mysqld stop



2) 설정 (패스워드를 검사하지 않음)

 # /usr/local/mysql/bin/mysqld_safe --skip-grant 



3) 새로운 패스워드 지정

mysql> update user set password=password('변경할 패스워드') where user='root';

mysql> flush privileges;.


# /etc/init.d/mysqld restart


# mysql -u root -p

Enter password:


 




2. my.cnf 수정을 통한 초기화


1) 실행중인 MySQL 서비스 중지

 # /etc/init.d/mysqld stop



2) my.cnf 설정

# vi /etc/my.cnf \\ 아랫줄 넣기

 skip-grant-tables



# /etc/init.d/mysqld restart


# mysql -u root -p

Enter password:



 




반응형