Sunday, 15 March 2015

sql - Importing CSV to mysql database losing content -


I have an Excel file (.xlsx format) and I want to import it into my database.

I have it before. Was saved in CCV format and I checked the spelling because I have some fields that are formatted for the Romanian language with DirectX and it's okay.

Then I made a table with column names and imported the table, using the phpMyAdmin set the file's letter: utf-8 and using the format Tax Format: Load data using CSV .

I lose Romanian directives and I have a column with text, which does not import all text, except it loads properly, if it finds the prefix of Romanian So it stops: (Ä ??, à ¢, ®, è ??, e ??) What formatting should I use? Recommended for Romanian language utf-8 1 Edit: OK, Wilk helped me with the solution and I think it is like this:

  SET NAMES utf8; Load data INFILE '/home/public_html/db/test_db.csv' ';' as determined by test_db field in Tumble '' Avoid '\\' lines determined by \ '\ r \ n';   

But now I have a new error # 1045 - Access denied for the user 'user' using 'localhost' (password: yes).):

Try:

SET NAMES utf8

Keep this in line before LOAD DATA


. Your entire SQL should look like this:

Remember, that <<> SET NAMES utf8 LOAD DATA INFILE 'file.csv' code> defined by the field operator is your field separator < / Div>

No comments:

Post a Comment