0

I have a database in MS access with cyrillic letters. I have to export it to Mysql.

However, when I export to CSV and then try to export to Mysql, the Workbench says that the data is not in UTF-8, as my Mysql database.

If I decode the CSV to UTF-8 first, the cyrillic letters are shown incorrectly.

I can't make Access to encode to utf-8 itself, probably it can't do it.

Ideas?

  • You may need to write a PHP (or other server language) that connects to both databases using ODBC to copy the data. You might see if Access (or a 3rd party add-on) can export the data as SQL. If you can do that, you should be able to import using phpMyAdmin or similar. – Sloan Thrasher May 16 '17 at 12:23
  • The fastest way (with hopefully the least chances for conversion problems) would be to **link** the MySQL table into Access, then run an INSERT query from the Access table into it. – Andre May 16 '17 at 12:53
  • @Andre Running İnsert from Access, which is not utf-8 would cause issues – Tarlan Mamedzadeh May 16 '17 at 14:30
  • @SloanThrasher Solution through php would work, however I hope there is another solution via CSV import – Tarlan Mamedzadeh May 16 '17 at 14:31
  • Have you tried it? The ODBC driver should take care of the conversion. – Andre May 16 '17 at 14:36
  • @Andre Could you please answer in more detail in Answer form? Describe your method or give appropriate link – Tarlan Mamedzadeh May 16 '17 at 14:37
  • The problem you will (and are) run into is that most text files do not have any character set info in the file itself (as meta-data). So a program reading the file has to make assumptions or be told what character set is being used. So the sticking point isn't the source or destination, it's the middle (and most basic) part of the chain. @Andre has the best idea about linking a tool such as phpAdmin to your Access DB, and then just using SQL statements to copy the data. – Sloan Thrasher May 16 '17 at 14:38
  • https://dev.mysql.com/doc/connector-odbc/en/connector-odbc-installation-binary-windows-installer.html and then https://dev.mysql.com/doc/connector-odbc/en/connector-odbc-examples-tools-with-access-linked-tables.html – Andre May 16 '17 at 14:41
  • Check the HEX of the data coming from MS Access. Cyrillic, if encoded as UTF-8, should be mostly 2-byte hex Dxyy. Then verify that you are following the "Best Practice" for MySQL given in http://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored – Rick James May 16 '17 at 15:58
  • If the text is encoded some other way, I should be able to help you if you can provide the hex and what character(s) it is supposed to represent. – Rick James May 16 '17 at 16:00
  • @RickJames Ok. I'm writing the letter 'ф' (HEX 444a) to MS access. When exporting it to text file in utf8, it shows me '?'. – Tarlan Mamedzadeh May 17 '17 at 05:32
  • $mysqli->set_charset("utf8") helped! – Tarlan Mamedzadeh May 17 '17 at 05:54

0 Answers0