일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- framework
- Analysis
- Linux
- error
- SSH
- Server
- Deep
- Github
- LIST
- ai
- DeepLearning
- 인공지능
- 자바
- Security
- db
- centos
- javascript
- mariaDB
- java
- interface
- Pattern
- Numpy
- Spring
- data
- 함수
- mysql
- git
- learning
- Web
- Python
- Today
- Total
PostIT
[DB/MariaDB/Mysql] Mysql 언어설정으로 인한 문제, 그리고 해결 본문
# [DB/MariaDB/Mysql] Mysql 언어설정으로 인한 문제, 그리고 해결
1. 오류 사항
1) mysql insert query 실행시 오류 메시지
mysql> ERROR 1366 (HY000) : incorrect string value : ''\xED\x95\x9C\xEC\x9A\xB0...' for column 'itemName' at row 1
2) application 내에서 insert query 실행시 오류 메시지
org.springframework.jdbc.UncategorizedSQLException:
### Error updating database. Cause: java.sql.SQLException: Incorrect string value: '\xED\x95\x9C\xEC\x9A\xB0...' for column 'itemName' at row 1
### The error may involve com.jworks.grevu.mapper.ItemMapper.addItem-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO item (itemName, itemPrice, itemDesc, shopId) VALUES (?,?,?,?)
### Cause: java.sql.SQLException: Incorrect string value: '\xED\x95\x9C\xEC\x9A\xB0...' for column 'itemName' at row 1
; uncategorized SQLException for SQL []; SQL state [HY000]; error code [1366]; Incorrect string value: '\xED\x95\x9C\xEC\x9A\xB0...' for column 'itemName' at row 1; nested exception is java.sql.SQLException: Incorrect string value: '\xED\x95\x9C\xEC\x9A\xB0...' for column 'itemName' at row 1
2. 수정방법
1) my.cnf 파일 설정 변경
$ whereis my.cnf
$ sudo vi /usr/local/mysql/my.cnf
[mysqld]
...
default-character-set=utf8
default-collation=utf8_general_ci
...
2) database, table character set 설정
mysql> ALTER TABLE table_name convert to charset utf8;
3. 완료 후 mysql 재시작
$ systemctl restart mysql
'DB > MariaDB' 카테고리의 다른 글
[MariaDB] MariaDB Ubuntu16.04에서 root로그인이 되지 않을 때, (0) | 2017.08.24 |
---|---|
[DB/MariaDB] SQL 예제를 통한 JOIN의 종류 파악 (2) | 2017.04.13 |
[MariaDB/Mysql] 분실한 Mysql root Password 재설정하기. (0) | 2017.01.19 |
[MySql] Mariadb, MYsql 사용자 권한주기 및 확인 (0) | 2016.12.02 |
[MariaDB] MariaDB에서 날짜에 맞는 값을 가져오기 위한 함수와 SQL (0) | 2016.11.16 |