728x90

-- 버전 확인
rpm -qa | grep -i mysql

-- 디비 프로세스 이력 확인
ps -ef | grep mysqld

-- start한 history 명령어 확인
history | egrep 'service|start'
 
-- MYSQL 중지 명령어

1. 패스워드 확인 가능 경우
mysqladmin -uroot -p shutdown


2. 패스워드 확인되지 않은 경우
mysqld_safe, mysqld 프로세스 kill
kill [mysqld_safe PID] [mysqld PID]

-- MYSQL 기동 명령어

1. 기동 파일 및 이력 확인되지 않는 경우, OS Service 등록이 안 되어 있는 경우 - 기존 safe 프로세스 이력으로 기동
nohup $basedir/bin/mysqld_safe —datadir=$datadir —pid=[PID] &

2. 기동 파일 확인 또는 생성한 경우, OS Service 등록되어 있는 경우
service mysql status
service mysql start

 

3. 패스워드 분실 시 skip-grant-tables 옵션 추가
nohup $basedir/bin/mysqld_safe —datadir=[DATA_DIR] —pid=[PID] —skip-grant-tables &
nohup $basedir/bin/mysqld —basedir=[BASE_DIR] —datadir=[DATA_DIR] ... —skip-grant-tables &


-- OS Service 등록 (systemctl)
1. 기동 파일 생성  
cp $basedir/support-files/mysql.server /etc/init.d/mysql

 

2. 기동 파일 내용 변경
vi /etc/init.d/mysql
basedir=$basedir
datadir=$datadir

 

3. MYSQL  서비스 기동 
service mysql status
service mysql stop

4. 기동 프로세스 확인
ps -ef | grep mysqld

5. 디비 기동 간 에러로그 특이사항 여부 확인
ps -ef | grep mysqld의 에러로그 경로에서 확인

-- ROOT 패스워드 변경
1. DB 접속 확인
mysql -uroot 
select user,host,password from mysql.user;

2. 계정 이력 확인
show grants for ‘root’@localhost;

3.  패스워드 변경
update mysql.user set password=password(‘[NEW_PASS]’) where user=‘root’ and host=‘localhost’;
flush privileges;

4. DB 재기동

728x90

'MYSQL' 카테고리의 다른 글

REPLICATION ERROR 1062  (0) 2024.02.21
TABLE, INDEX, 권한 조회  (0) 2024.02.21
[MYSQL] 비밀번호 복잡도 정책 설정 미흡 - 보안 조치  (0) 2024.01.02
TABLE COLUMN 조회  (0) 2023.01.30
TABLE SCHEMA 조회  (0) 2023.01.12

+ Recent posts