I have searched online for a solution and none of the solutions that I found online seems to work here.
My problem is that I have a MySQL dump (SQL file) containing hebrew text values that is saved in UTF8 encoding, and when I import it using "source [file]
" it saves the hebrew characters as question marks (???).
Now, when I look at the SQL file (cat [file]) I can see the hebrew characters properly.
Even when I try to copy & paste the SQL commands from the output that "cat
" gave directly into the MySQL command line, it works as well.
It only fails when I use "SOURCE [file]
" (which I need, because it is a HUGE file).
I have also tried the following:
mysql -uroot -p[pass] --default-character-set=utf8
, and then "SET NAMES utf8" and then "SOURCE [file]" - Gives question marks.- Login to mysql client, then do "
SET NAMES utf8
", "SET COLLATE utf8_bin
" (this is the settings for all the tables in the DB) - Gives question marks. CREATE DATABASE [db_name] DEFAULT CHARACTER SET UTF8
with the previous setting (section 2 above) - Gives question marks.mysql -uroot -p[pass] --default-character-set=utf8 [db_name] < [file.sql]
- Gives question marks.set character_set_filesystem utf8
and then runningsource [file]
- Gives question marks.
None of these works properly, the ONLY thing that works is if I do copy+paste directly from cat's output to mysql command line, which is not an option because of the length of the file (several hundreds of MB).
Please help, thanks!
Will be problem reading the file as
< file.sql
.As documented about using MySQL in batch mode If you are running mysql under Windows and have some special characters in the file
< file.sql
might cause problems, use this instead: