Clickhouse: How to drop database based on MySQL Engine

Created on 19 Jul 2019  Β·  8Comments  Β·  Source: ClickHouse/ClickHouse

This problem occurs when I delete the database based on the MySQL storage engine.

This is My Create database stament:
SHOW CREATE DATABASE mydb; CREATE DATABASE mydb ENGINE = MySQL('localhost:3306', 'docker', 'docker', 'docker')

This is Exception when I try to drop database:
Code: 48. DB::Exception: Received from localhost:9000. DB::Exception: MySQL database engine does not support remove table..

question unfinished code

Most helpful comment

I'll try to fix it. you can currently drop the database using the following command:

clickhouse :) DETACH DATABASE {need drop database name}
clickhouse :) exit
~ cd {clickhouse data path}
~ rm -rf metadata/{need drop database name}

All 8 comments

CC @zhang2014

I'll try to fix it. you can currently drop the database using the following command:

clickhouse :) DETACH DATABASE {need drop database name}
clickhouse :) exit
~ cd {clickhouse data path}
~ rm -rf metadata/{need drop database name}

thank you very much @zhang2014

Also mysql db don`t drop if not connect to it:

host2 :) CREATE DATABASE mysql_db ENGINE = MySQL('yandex.ru:3306', 'test_db', 'yandex_admin', '1234');

CREATE DATABASE mysql_db
ENGINE = MySQL('yandex.ru:3306', 'test_db', 'yandex_admin', '1234')

Ok
0 rows in set. Elapsed: 0.064 sec. 

host2 :) show databases;

SHOW DATABASES

β”Œβ”€name─────┐
β”‚ default  β”‚
β”‚ mysql_db β”‚
β”‚ system   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

4 rows in set. Elapsed: 0.001 sec. 

host2 :) drop database mysql_db;

DROP DATABASE mysql_db

Received exception from server (version 19.13.3):
Code: 48. DB::Exception: Received from localhost:9000. DB::Exception: MySQL database engine does not support remove table.. 

0 rows in set. Elapsed: 0.313 sec. 

This is a feature that hasn't been implemented for some reason, and I will implement them as soon as possible : )

detach database test-db

I have to mention that silly automatic comments from "robot-clickhouse" and from "blinkov" is just a personal idea of one of our friends and we strongly discourage this idea.

maybe we can close this issue ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fizerkhan picture fizerkhan  Β·  3Comments

innerr picture innerr  Β·  3Comments

vvp83 picture vvp83  Β·  3Comments

derekperkins picture derekperkins  Β·  3Comments

jimmykuo picture jimmykuo  Β·  3Comments