I follow official guide  use mysql database engine to  exchange data between ClickHouse and MySQL
`insert into mysql_database.testUser
 select * from clickHouse_database.testUser`

But it throw a exception : Poco::Exception. Code: 1000, e.code() = 1366, e.displayText() = mysqlxx::BadQuery: Incorrect string value: '\xF0\x9F\xA6\x84\xE2\x98...' for column 'person_name' at row 1 (*****:3306) (version 20.8.4.11)

The column value in clickhouse is：小野马-🦄☁️ ,while remote  mysql CHARSET is utf8mb4; It seems that the exception  because of the emoji value. How can I fix this problem?


if (mysql_options(driver.get(), MYSQL_OPT_READ_TIMEOUT, &rw_timeout))
        throw ConnectionFailed(errorMessage(driver.get()), mysql_errno(driver.get()));
    if (mysql_options(driver.get(), MYSQL_OPT_WRITE_TIMEOUT, &rw_timeout))
        throw ConnectionFailed(errorMessage(driver.get()), mysql_errno(driver.get()));
    
    unsigned enable_local_infile_arg = static_cast<unsigned>(enable_local_infile);
    if (mysql_options(driver.get(), MYSQL_OPT_LOCAL_INFILE, &enable_local_infile_arg))
        throw ConnectionFailed(errorMessage(driver.get()), mysql_errno(driver.get()));
    
    bool reconnect = true;
    if (mysql_options(driver.get(), MYSQL_OPT_RECONNECT, reinterpret_cast<const char *>(&reconnect)))
        throw ConnectionFailed(errorMessage(driver.get()), mysql_errno(driver.get()));
    
    if (mysql_ssl_set(driver.get(), ifNotEmpty(ssl_key), ifNotEmpty(ssl_cert), ifNotEmpty(ssl_ca), nullptr, nullptr))
        throw ConnectionFailed(errorMessage(driver.get()), mysql_errno(driver.get()));
    if (!mysql_real_connect(driver.get(), server, user, password, db, port, ifNotEmpty(socket), driver->client_flag))
        throw ConnectionFailed(errorMessage(driver.get()), mysql_errno(driver.get()));
    
    if (mysql_set_character_set(driver.get(), "UTF8"))
        throw ConnectionFailed(errorMessage(driver.get()), mysql_errno(driver.get()));
    is_connected = true;
}
bool Connection::connected() const
{
    return is_connected;
}
void Connection::disconnect()
{
    if (!is_initialized)
        return;
    mysql_close(driver.get());
    memset(driver.get(), 0, sizeof(*driver));
    is_initialized = false;
    is_connected = false;
}
bool Connection::ping()
{
    return is_connected && !mysql_ping(driver.get());
}
Query Connection::query(const std::string & str)
{
    return Query(this, str);
}
MYSQL * Connection::getDriver()
{
    return driver.get();
}
}
