-1

I am migrating a wordpress site from one server to another. I exported an sql dump from the old server and imported it into the new server database through phpmyadmin. But certain characters are not displayed correctly like the apostrophe and hyphen.

I figure this is because of the different database encoding present in the 2 servers. The old server has the character set encoding as utf8mb4_unicode_520_ci while the new server has the encoding latin1_swedish_ci.

I tried changing the "Character set of the file:" of the export dump by setting it to iso-8859-1 so that it would then get imported correctly into the latin1_swedish_ci but it gives an error during import of the SQL syntax.

How can I migrate the data here correctly?

Saeesh Tendulkar
  • 638
  • 12
  • 30

1 Answers1

1

Unless you have a specific reason to be using "latin1_swedish_ci" (and I can't imagine you do - it was the MySQL default at some point), you should not be using that at all. Change the character set encoding on the new server to match the former.

Daydream Nation
  • 326
  • 3
  • 7
  • I dont have superadmin access to change the encoding on the new server. I have changed the encoding of the tables so it works fine now for future data. But how do I correct the old data? – Saeesh Tendulkar Dec 11 '20 at 04:20
  • Data should never be 'changed' or 'corrected'; the database is the only source of truth. You should not be altering the data whatsoever. Find out who has proper access to change the character set encoding, and get them to do so. "latin1_swedish_ci" is a generally useless encoding, and you should be doing things the proper way. – Daydream Nation Dec 11 '20 at 17:08
  • Lol. Well said. Did exactly the way you said – Saeesh Tendulkar Dec 13 '20 at 15:09