douqiao2471 2015-09-01 11:34
浏览 265

如何让mysql忽略名称中的特殊字符

I am trying to do a CSV bulk import of names into MYSQL, but during the process there is a special characters that halts the operation.

The character over the name - Pérez

Is there a way to have MYSQL to ignore this on upload? My next step is to automate the upload via a web page where a customer can just upload the CSV file and hit submit, therefore hoping to work out these glitches.

I took the suggestion of the panel and recreated my table as UTF8-Default.

ERROR 1366: Incorrect string value: '\xE9rez' for column 'acct_owner' at row 1 SQL Statement:

I tried this and I still get the same error on that special character, plus now for some reason my auto-increment column does not increment, it just captures the data from the last_update column, therefore everything shifts left.

  • 写回答

2条回答 默认 最新

  • dongqiao9583 2015-09-01 12:02
    关注

    Well in case you want to insert/load csv data with special character you can try like this

    LOAD DATA INFILE 'file.csv'
    IGNORE INTO TABLE table
    CHARACTER SET UTF8
    FIELDS TERMINATED BY ';'
    OPTIONALLY ENCLOSED BY '"'
    LINES TERMINATED BY '
    '
    
    评论

报告相同问题?

悬赏问题

  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数