Struggling to load Arabic text into MySql 5.6

If you are struggling to load Arabic text or Emojis into your MySql 5.6 table then:

  1. Ensure your database, table, and column use uft8mb4 character set.
    create database XXXX character set 'utf8mb4' collate 'utf8mb4_unicode_ci';
    create table ( ... ) ... character set 'utf8mb4' collate 'utf8mb4_unicode_ci';
  2. Ensure that the data file you are loading is UTF-8 encoded.
  3. Run the mysql client with the binary character set.
    mysql ... --default-character-set=binary ...
  4. Load the data with the binary character set.
    loading load data local infile 'XXXX.DAT' into table XXXX character set binary ( ... );