Linux/Tip&Tech2008. 10. 9. 07:35



mysql 4.0 이하 버전에서는 password() 가 20 bits 의 암호화된 부호를 생성하는데 mysql 4.1 이상 부터는

41bits의 암호를 생성하므로 기존의 데이터 베이스에 들어있는 암호와 비교될 때 당연히 입력된 암호가 같아도

비교되는 암호가 틀리므로 비밀번호 에러가 발생합니다.


그러면 해결방법은?

제로보드 디렉토리(저는 /zboard) 밑에 보시면 login_check.php 파일이 있습니다.

이 파일을 열어보시면 아래와 같은 부분이 있습니다.

// 회원 로그인 체크
$result = mysql_query("select * from $member_table where user_id=
            '$user_id' and password= password('$password')") or error(mysql_error());
$member_data = mysql_fetch_array($result);

이부분을 다음과 같이 substr()를 써서 다음과 같이 고쳐주세요.( substr(password,1,20) 함수는 password를 앞에서 20자 추출하는 것)

$result = mysql_query("select * from $member_table where user_id=
            '$user_id' and password=substr(password('$password'),1,20)") or error(mysql_error());

이렇게 함으로써 로그인 문제는 해결됩니다.

로그인 문제는 해결됐으나 또다른 문제 발생.

바로 테이블 생성 에러 였습니다.

원인은 제로보드 디렉토리 아래의 schema.sql 파일 입니다.

마찬가지로 msql4.1.7 에서 부터 auto_increment 변수에 대해서 default 값을 적용하면 에러가 발생하기 때문에 테이블이 생성되지 못합니다.

no int(10) default '0' not null auto_increment primary key => no int(10) not null auto_increment primary key  과 같이 default 항목을 삭제해 줍니다.

default 삭제 항목한 schema.sql 파일을 첨부합니다.

위의 내용을 간단히 정리하게 된다면

1. mysql 4.1.x 이상으로 database install 시
   첨부의 schema.sql 파일로 대체한 후 zero board install 하면 이상무

2. mysql 4.1.x 이상으로 upgrade 시
   i) login_check.php 파일 수정
   ii) schema.sql 파일을 첨부의 schema.sql 파일로 대체

그럼, mysql 4.1.x 이상 버전에서의 install 및 upgrade 시 어려움을 겪으시는 분에게 꼭 도움이 되길 바랍니다.

첨부 파일은 schema.sql.zip 로 되어 있는데 그냥 schema.sql 로 파일명만 변경하여 사용하세요.

제로보드 유용한 팁 공유 게시판에서 김광수님의 글임
http://www.nzeo.com/bbs/zboard.php?id=cgi_tip&no=6589
Posted by 이름따위사치다 Grub

댓글을 달아 주세요