I have a clickhouse database someone else has installed. I am able to connect to it via the
clickhouse-client
or the
clickhouse-client -u default
command and that connects the default user to Clickhouse. However, I would like to change the way we connect to Clickhouse and apply a password. Since I'm not confident yet, I intend to create a super user with a username and a pasword (I want to keep default temporarily and only remove/change it when I'm confident with this new user). However,
CREATE USER IF NOT EXISTS someuser
IDENTIFIED WITH sha256_password BY 'somepassword';
fails because default does not have the necessary privileges:
DB::Exception: default: Not enough privileges. To execute this query it's necessary to have grant CREATE USER ON .. (ACCESS_DENIED)
Not even
SHOW USERS;
works. How can I make sure that we secure clickhouse connection with a password?
Your
defaultuser just doesn't have permission to create users using SQL. Create a new XML file (name it something like my_users.xml) and place it in yourconfig.dfolder, and grant thedefaultuser permission to create new users using SQL (instead of XML configs) by enabling theaccess_managementproperty:You can also give your new user
access_managementpermission. And you can remove thedefaultuser with the following in your config: