Created a user in users.xml, but I cannot login in to the clickhouse-server with that name, says ‘no user in user directories’.
[ec2-user@local ~]$ mysql -utest -hxx.xxx.xx.xx -P9004 -p
Enter password:
ERROR 192 (00000): There is no user `test` in user directories
the user test is correctly created in users.xml, and it’s shown in the system.users
table;
<clickhouse>
<users>
<test>
<profile>readonly</profile>
<networks>
<ip>xxx.x.x.x/32</ip>
</networks>
<password_sha256_hex>sha256sum_string</password_sha256_hex>
<quota>default</quota>
</test>
</users>
</clickhouse>
And I tried to create a user in console, but still not possible to login user mysql protocol, but it works with clickhouse-client.
CREATE USER IF NOT EXISTS demo IDENTIFIED WITH DOUBLE_SHA1_PASSWORD BY 'demo' host any;
GRANT readonly_role TO demo;
2
Answers
It turns out I use the wrong host ip to login. Thus why "no user found". Sorry for the interruptions, this question could consider closed now.
I assume you’re trying to use ClickHouse’s MySQL interface? If so, consider using double sha1 in your config. There are known issues when using = SHA256, especially with mysqljs and old versions of command-line tool MySQL and MariaDB which cant authenticate.
Oh and make sure you’ve actually configured ClickHouse to expose the port: