In my local machine(Mac OS) iTerm2 terminal, I could login remote mysql server and input Chinese
character successfully
➜ ~ mysql -h remote_ip -u username -p foo --safe-updates
mysql> select '你好';
+--------+
| 你好 |
+--------+
| 你好 |
+--------+
1 row in set (0.01 sec)
then I login a remote server by ssh
➜ ~ ssh root@remote_ip
and login the same mysql server
root@qa-web:~# mysql -h remote_ip -u username -p foo --safe-updates
mysql> select '
but this time I cannot input Chinese character in command line, after inputting they are disappeared immediately.
Why is so?
Additional information
In above second case
mysql> status
...
Server characterset: utf8mb4
Db characterset: utf8
Client characterset: utf8mb4
Conn. characterset: utf8mb4
My machine Mac OS
➜ ~ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
Remote Server
root@hg:~# locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
root@hg:~# locale -a
C
C.UTF-8
en_US.utf8
POSIX
Copy this sql(select 'hello','你好';
) from Atom to Mysql command line, and the effect is
mysql> select 'hello','';
+-------+--+
| hello | |
+-------+--+
| hello | |
+-------+--+
1 row in set (0.00 sec)
Locale
➜ ~ 你好
zsh: command not found: 你好
Remote
root@hg:~# 你好
-bash: $'\344\275\240\345\245\275': command not found