SQOOP Export: mysql> create a Hive table (????)
Like this:
I have modified it once before, and the method works together. However, when the server is changed and the MySQL library is newly created, method one fails to work, and method two takes effect.
Method one:
Create a new query window, or use the command to enter mysql> , the input
Like this:
I have modified it once before, and the method works together. However, when the server is changed and the MySQL library is newly created, method one fails to work, and method two takes effect.
Method one:
Create a new query window, or use the command to enter mysql> , the input
set character_set_database=utf8;
set character_set_server=utf8;
Show variables like ‘character%’; View the results:
SQOOP script with:?useUnicode=true& characterEncoding=utf-8
Import the data again without scrambling.
Method 2:
Modify the system file: /etc/my.cnf
vim /etc/my.cnf
Text:
init_connect=’SET collation_connection = utf8_unicode_ci’ init_connect=’SET NAMES utf8′ character-set-server=utf8 collation-server=utf8_unicode_ci skip-character-set-client-handshake |
Directing to /bin/systemctl Restart mysqld. Service (1) : Directing to /bin/systemctl Restart mysqld.
Sqoop plus?useUnicode=true& CharacterEncoding = UTF-8, Chinese garbled code problem resolved.
In the first method, the set modifies the configuration and restarts MySQL. This is probably the first reason why the configuration change does not work.