사이트 내 전체검색
검색목록
Dumping and importing from/to MySQL in an UTF-8 safe way
로빈아빠
https://cmd.kr/server/680 URL이 복사되었습니다.

본문

Do not do this, since it might screw up encoding:

mysqldump -uroot -p database > utf8.dump # this is bad

Better do:

mysqldump -uroot -p database -r utf8.dump

Note that when your MySQL server is not set to UTF-8 you need to do mysqldump --default-character-set=latin (!) to get a correctly encoded dump.

If you only want to dump the structure without data, use

mysqldump -uroot -p --no-data database -r utf8.dump

Importing a dump safely

Do not do this, since it might screw up encoding:

mysql -u username -p database < dump_file # this is bad

Better do:

mysql -uroot -p --default-character-set=utf8 database mysql> SOURCE utf8.dump

댓글목록

등록된 댓글이 없습니다.

114 (1/3P)

Search

Copyright © Cmd 명령어 18.119.142.210