os환경: centos 7
1. 설정변경
/etc/my.cnf
skip-grant-tables 주석해제
2. mysql 시작
systemctl start mysqld
3. mysql 접속
mysql -u roo -p
패스워드 없이 그냥 엔터
4. user table 변경
>use mysql
>select user, authentication_string from user;
root 상황보기
>update user set authentication_string = "" where user='root';
> exit
5. mysql 중지
6. 설정변경
/etc/my.cnf
skip-grant-tables 다시 주석처리
7. mysql 재시작
8. mysql -u root -p (패스워드 그냥 엔터)
9. 패스워드 설정
>alter user 'root'@'localhost' identified by '패스워드'; <-- 패스워드는 대소문자특수문자포함
>flush privileges;
10. 사용자 생성
>create user '사용자'@'%'(원격사용시) identified by '패스워드';
>grant all privileges on *.* (또는 DB명.*) to '사용자'@'%'(또는 localhost);
>flush privileges;
> exit;
'IT > MySql' 카테고리의 다른 글
Mysql 테이블 조인 쿼리 (0) | 2022.08.31 |
---|---|
Mysql UTF8 설정 (0) | 2022.08.31 |
Mysql 테이블내 중목데이터 삭제 (0) | 2022.08.31 |
Mysql utf8 collation 문제 (0) | 2022.08.29 |
Mysql 데이터 원격 복제(replication) (0) | 2022.08.29 |