Daily Archives: September 9, 2013

Home »  2013 »  September »  9th (Monday)

mysql 락걸린 DB 덤프뜰때~

mysqldump -u root -p –lock-tables=0 mysql > mysql.sql

mysql root 패스워드 초기화

>> safe 모드로 mysql 실행
설치경로/mysqld_safe –skip-grant &

update user set password=password(‘패스워드’) where user=’root’;
flush privileges;
quit

mysql 사용자 추가 ( 특정IP접속허용)

>>사용자 확인
SELECT user,Host FROM mysql.user;
 
>> 권한설정
grant all privileges on *.* to ‘root’@’%’ identified by ‘root의 패스워드’;
*.* = DB.Table
‘root’@’%’ = 사용자@접속허용IP
 
>> 모든IP허용
INSERT INTO mysql.user (host,user,password) VALUES (‘%’,’root’,password(‘패스워드’));
GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’;
FLUSH PRIVILEGES;
 
>> IP대역 허용
INSERT INTO mysql.user (host,user,password) VALUES (‘111.222.%’,’root’,password(‘패스워드’));
GRANT ALL PRIVILEGES ON *.* TO ‘root’@’111.222.%’;
FLUSH PRIVILEGES;
>> 특정 IP 허용
INSERT INTO mysql.user (host,user,password) VALUES (‘111.222.33.44′,’root’,password(‘패스워드’));
GRANT ALL PRIVILEGES ON *.* TO ‘root’@’111.222.33.44′;
FLUSH PRIVILEGES;
>> 원복
DELETE FROM mysql.user WHERE Host=’%’ AND User=’root’;
FLUSH PRIVILEGES;