블로그 이미지
Rootrator
1개를 알면 모르는 10개가 튀어나온다..!

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

Notice

2016. 2. 19. 15:50 Linux

OS : CentOS 6.7 32bit

Mysql 5.1.63


mysql function 생성시 아래와 같은 에러 발생

This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)



mysql 에서 아래와 같이 확인해 보면 값이 Off로 설정이 되어있다.

mysql> show global variables like 'log_bin_trust_function_creators';

+---------------------------------+-------+

| Variable_name                       | Value |

+---------------------------------+-------+

| log_bin_trust_function_creators     | OFF  |

+---------------------------------+-------+

1 row in set (0.00 sec)


mysql>SET GLOBAL log_bin_trust_function_creators = 1; 

 

쿼리를 실행시켜주거나 my.cnf 설정 시키거나 실행시에 추가하여 서비스를 올리면 된다.



기존의 서버에서 dump로 function을 가져올땐 --routines 

trigger를 가져올땐 --trigger 옵션으로 포함시킬수 있다.





반응형
posted by Rootrator
2013. 11. 11. 16:41 Mysql

mysql 5.5 이전버전에서 5.5버전으로 넘어오기 위해 dump로 옮겨올 경우 한글이 깨지거나


정렬이 틀어지는 경우가 있다.


mysql 5.5 설치후 캐릭터셋을 맞춰주지 않으면 latin1으로 자동설정이 되기 때문


mysql> show variables like 'c%';


위 명령어로 현재 서버상의 캐릭터셋을 확인 할수 있다.


캐릭터셋 설정을 위해 my.cnf 파일을 열어 아래와 같이 추가해주자. 여기서는 euckr을 기본으로 사용했다.

utf-8을 사용하려면 euckr대신 utf8을 넣어 추가.


[client]

default-character-set = euckr


[mysqld]

character-set-client-handshake=FALSE

init_connect=SET collation_connection = euckr

init_connect=SET NAMES EUCKR

character-set-server = euckr


[mysqldump]

default-character-set = euckr



UTF-8을 사용하려면 [mysqld] 섹션에 아래줄을 하나더 추가해 준다.

init_connect=SET character_set_system = utf8


마치고나서 mysql 재시작을 하면 정상적으로 반영되어 있다.


정렬이 틀어진 경우는 dump을 다시 떠서 복원을 하거나


phpmyadmin을 통해서 데이터정렬방식을 맞춰주면 정상적으로 정렬이 된다.


phpmyadmin 4.0.x 버전이상은


curl과 mysqli 라이브러리가 필요하다.


php 재컴파일시 아래 옵션을 추가

--with-openssl=/usr/local/openssl 

--with-curl=/usr/bin/curl 

--with-mysqli=/usr/local/mysql/bin/mysql_config


반응형

'Mysql' 카테고리의 다른 글

시간 변환 함수  (0) 2015.04.15
Mysql 튜닝  (0) 2014.07.03
Mysql에서 too many connection에러  (0) 2011.10.11
1017 : Can't find file: '테이블명.frm' (errno: 13)  (0) 2011.09.22
MySql 설치에러 : checking "LinuxThreads"... "Not found"  (0) 2011.07.28
posted by Rootrator
2011. 10. 11. 16:36 Mysql

위에 에러를 뱉으면서 서버가 DB가 뻗는 경우가 있다.

Mysql에 접속하여 show variables;로 환경변수를 확인할 수 있다.

mysql> show variables;
 +---------------------------------+----------------------------------------+
| Variable_name                   | Value                                  |
+---------------------------------+----------------------------------------+
| max_connections                 | 100                                    |
| table_cache                     | 64                                     |
| wait_timeout                    | 28800                                  |
+---------------------------------+----------------------------------------+

참고해야할 것만 뽑아놨다.

위의 Max_Connection값이 꽉차면 오류가 뜨게 된다.

보통 mysql_close()함수가 제대로 안먹히게 되면 프로세스가 계속 DB를 물고 늘어지는데

show processlist;로 확인이 가능하다.


환경변수 설정을 해보자.
[root@localhost ~]# vi /etc/my.cnf
 
[mysqld]
 max_connections = 
 wait_timeout =
 table_cache = 128

 
공란은 적정값을 넣으면 되겠다.

혹은 실행 명령에서

[root@localhost bin]# ./safe_mysqld -O max_connection= -O wait_timeout=  table_cache=128 &

 
  
반응형

'Mysql' 카테고리의 다른 글

Mysql 튜닝  (0) 2014.07.03
Mysql 5.5 한글설정  (0) 2013.11.11
1017 : Can't find file: '테이블명.frm' (errno: 13)  (0) 2011.09.22
MySql 설치에러 : checking "LinuxThreads"... "Not found"  (0) 2011.07.28
Got error 127 from storage engine  (0) 2011.07.06
posted by Rootrator
2011. 9. 22. 15:53 Mysql

가끔 DB복원 중에 이런 에러가 발생한다.

Mysql DB복원 방법 중에는 mysqldump도 있지만 간단히

var 디렉토리 밑의 파일을 교체하는 것으로 복원이 가능하다.

(innoDB가 기본 스토리지 일때는 서비스를 완전히 내리고 작업을 해줘야 한다)

이때 복원 할때 cp 명령어를 옵션없이 썼다면 소유자가 바뀌어 위와 같은 에러가 발생한다.

해당 디렉토리 및 db파일의 소유자를 확인해서 맞춰주면 된다. 
반응형
posted by Rootrator
2011. 3. 24. 12:11 Mysql

어느날 홈페이지상에서 테이블이 깨져 복구를 해야 한다는 메세지가 뜬적이 있었다.

myisamchk로 체크 후 복구를 해보자.

[root@localhost bin]# ./myisamchk ../var/깨진DB.MYI
Checking MyISAM file: ../깨진DB.MYI
Data records:     886   Deleted blocks:       0
myisamchk: warning: Table is marked as crashed
myisamchk: warning: 27 clients are using or haven't closed the table properly
- check file-size
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1
- check data record references index: 2
- check data record references index: 3
- check data record references index: 4
- check data record references index: 5
- check data record references index: 6
- check data record references index: 7
- check data record references index: 8
- check data record references index: 9
- check data record references index: 10
- check data record references index: 11
- check record links
myisamchk: error: Checksum for key:  8 doesn't match checksum for records
MyISAM-table '../var/깨진DB.MYI' is corrupted
Fix it using switch "-r" or "-o"

-r이나 -o 옵션을 주어 복구 하란다.

[root@localhost bin]# ./myisamchk -r ../var/깨진DB.MYI
- recovering (with sort) MyISAM-table '../var/깨진DB.MYI'
Data records: 886
- Fixing index 1
- Fixing index 2
- Fixing index 3
- Fixing index 4
- Fixing index 5
- Fixing index 6
- Fixing index 7
- Fixing index 8
- Fixing index 9
- Fixing index 10
- Fixing index 11

이제 정상적으로 복구가 되었다

반응형
posted by Rootrator
2011. 2. 28. 15:06 Mysql

Client does not support authentication protocol requested by server; consider upgrading MySQL client

 

에러가 뜬다. 뭐지..짜증난다

 

mysql 4.0 이하와 4.1이상버전은 암호화방식 차이로 인해 4.0버전에서 password테이블을 가져와도 인식하지 못한다.

 

상위버전 DB서버에 INSERT TABLE USER에서 old_password()해 비밀번호를 넣거나

/etc/my.cnf에서 [mysqld] 구문 밑에 old_passwords=1 추가해주면 된다.

아니면 아예 구동할때 --old-passwords 옵션을 넣어버려도 된다.

4.X버전을 쓰던 홈페이지를 5.X버전을 쓰는 서버 이전할 경우 홈페이지 소스에서

로그인 쿼리를 변경해줘야 한다.

 $result = mysql_query("select * from $member_table where $id_name='$user_id' and $password_name=password('$password')") or error_msg(mysql_error());

이 줄을 다음과 같이 변경 

 $result = mysql_query("select * from $member_table where $id_name='$user_id' and $password_name=old_password('$password')") or error_msg(mysql_error());

반응형
posted by Rootrator
2011. 2. 25. 14:04 Mysql

mysql에 root로 로그인이 되어 있을때

>use mysql;

>update user set password=password('새로운 패스워드') where User = "root";

>flush privileges;

>exit

# /usr/local/mysql/bin/mysqladmin -u root -p shutdown

# /usr/local/mysql/bin/mysqladmin -u root -p reload



긴급 시에 적용 방법

# ps -ef | grep mysqld

# killall mysqld

# /usr/local/mysql/bin/safe_mysql --skip-grant-tables &

# /usr/local/mysql/bin/mysql -u root mysql

>use mysql;

>update user set password=password('새로운 패스워드') where User = "root";

>flush privileges;

>exit

# killall mysqld

# /usr/local/mysql/bin/safe_mysql
반응형
posted by Rootrator
prev 1 next