1

Well I'm migrating a database to another with a different structure so I have made big files with queries like

'Insert into comment values (1,'comment','user');

by taking the info from first database through a php file.

I cannot import them with phpmyadmin because they are too big, so I'm trying to use the shell and the command

source path-to-file.sql

And everything works fine but as some data is in spanish I need to keeps special characters like ó or ñ, but it converts them into "??"

Does anybody know how can I fix it? Thank you.

  • You have to make sure you are using the same charset. Since you created your file yourself, you might have used some spanish charset, and mysql might load it as `latin1` or `utf8`. You can set the encoding before using `source` by e.g. `SET NAMES 'utf8' COLLATE 'utf8_general_ci';`, but you will have to know how you saved the file (or just test different values until it works; your php default charset might be "iso-8859-1"). – Solarflare Jul 12 '17 at 12:13
  • See "question marks" in [_here_](http://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored) – Rick James Jul 12 '17 at 15:18

0 Answers0