반응형

Ubuntu에 깔려있는 MySQL을 업그레이드했는데, 뭔가 잘못됐는지 다음과 같은 메시지와 함께 실행이 안되었다.

error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'


데비안이나 우분투에서 MySQL을 관리하다보면 debian-sys-maint계정이 접근권한이 없어서 mysql데몬을 관리하는 것이 안되는 경우가 발생한다. 이것은 /etc/init.d/mysql스크립트를 start,stop,restart등등을 할때 /etc/mysql/debian.cnf의 debian-sys-maint게정과 암호를 사용하기 때문이다. 
그런데 debian.cnf파일의 password부분이 encryption이 된것으로 알았는데 그냥 clear-text라고 한다... 
따라서, debian-sys-maint계정의 암호를 잃어버렸을 경우에는 이 파일의 password부분에 임의의 랜덤 문자열로 암호를 넣어주고 아래와 같이 mysql에서 debian-sys-maint에 대한 암호를 변경한다.


mysql> update user set password = password('랜덤스트링') where user = 'debian-sys-maint' and host = 'localhost'; 
mysql> flush privileges;

[출처] 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'|작성자 미친푸우

 

 

 

****************************************************************************************

다른 방법

 

error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'
http://mirzmaster.wordpress.com/2009/01/16/mysql-access-denied-for-user-debian-sys-maintlocalhost/

So, what is this “debian-sys-maint” user? Well, this MySQL user is created for the Ubuntu to be able to start/stop the database and to carry out other maintenance operations.

Sounds well enough, but then why do I keep running into the “access denied” problem for this user? Well, the issue is that with each update to MySQL, the user’s password in the database is overwritten. Ubuntu seems to go to the file /etc/mysql/debian.cnf in order to find this user’s password, but obviously the password is out of sync after the update has been applied.

As a result of this behaviour, I’ll run into the “access denied”problem every so often. Thankfully, the solution to this issue is fairly simple.



cat /etc/mysql/debian.cnf
password = 값

mysql> GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '값';


댓글에 달린 내용---------

You do NOT need to grant all permissions, this is a bad habit to get into from a security standpoint.

All you need to grant is this (as root or whoever):

GRANT SHUTDOWN ON *.* TO ‘debian-sys-maint’@'localhost’;
GRANT SELECT ON `mysql`.`user` TO ‘debian-sys-maint’@'localhost’;

Because it needs to shutdown/startup, and does a test select from the users table as a sanity check to ensure the root user exists. This select is usually done by /usr/share/mysql/debian-start.inc.sh which is loaded by /etc/mysql/debian-start


반응형

+ Recent posts