SimonDowdles
SimonDowdles

Reputation: 2046

MySQL getting unknown characters in data between Linux & Windows hosted databases

I am lost on this. I have a web site that I work on offline, then I upload to live server, import MySQL database to live server, and make live in general. Problem is that when I export database from LIVE server and import back into LOCAL server, I get unknown characters in my XHTML output, the black diamond with the white question mark in the middle, you know the one.

The command I used to export my database from LOCAL MySQL installation is as follows:

mysqldump --verbose -hlocalhost -uxxx -pxxx --databases xxx --add-drop-table --default-character-set UTF8 > somedir/xxx.sql

Then, when importing that data to the LIVE database I used a simple command as follows:

mysql -hlocalhost -uxxx -pxxx somedatabase < xxx.sql

Great, all is well, data is imported and there are NO unknown characters on site. However, when I do the same in reverse (dump on live server using same command as in windows, import in windows using same mysql command) that is when all the unknown characters appear.

Is it a collation issue? Am I using the incorrect --default-character-set ?

I have never had this happen before, and I would love some feedback or a nudge in the right direction.


UPDATE: I have completely dropped my local one, exported the ENTIRE live db and imported. Still the same error :/ This is driving me mad!


Many thanks, Simon

Upvotes: 2

Views: 1150

Answers (2)

vbence
vbence

Reputation: 20333

Try on both sides:

SET names UTF-8

Probably the defaults differ.

Upvotes: 1

Gary Green
Gary Green

Reputation: 22395

I suspect your live site has a different database schema, could it be latin1?

Upvotes: 0

Related Questions