```
Caught exception while loading metadata: Code: 501, e.displayText() = DB::Exception: Cannot create MySQL database, because Code: 393, e.displayText() 
= DB::Exception: There is no query, Stack trace (when copying this message, always include the lines below):

0. /home/milovidov/ClickHouse/build_gcc9/../contrib/poco/Foundation/src/Exception.cpp:27: Poco::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, 
int) @ 0x1074687c in /usr/bin/clickhouse
1. /home/milovidov/ClickHouse/build_gcc9/../src/Common/Exception.cpp:37: DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x7867c29 in
 /usr/bin/clickhouse
2. /home/milovidov/ClickHouse/build_gcc9/../contrib/libcxx/include/string:2134: DB::Context::getQueryContext() const (.cold) @ 0xd202416 in /usr/bin/clickhouse
3. /home/milovidov/ClickHouse/build_gcc9/../src/Interpreters/Context.h:457: DB::DatabaseConnectionMySQL::DatabaseConnectionMySQL(DB::Context const&, std::__1::basic_string<char, std::__1::char_traits<char>, std:
:__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::ASTStorage const*, std::__1::basic_string<char, std::__1::char_traits<char>, std:
:__1::allocator<char> > const&, mysqlxx::Pool&&) @ 0xd408d7c in /usr/bin/clickhouse
```

```
ATTACH DATABASE conv_main
ENGINE = MySQL('hostname:3306', 'db', 'metrika', 'password')
```
void attachTable(const String & table_name, const StoragePtr & storage, const String & relative_table_path) override;
protected:
    ASTPtr getCreateTableQueryImpl(const String & name, const Context & context, bool throw_on_error) const override;
private:
    const Context & global_context;
    String metadata_path;
    ASTPtr database_engine_define;
    String database_name_in_mysql;
    
    
    MultiEnum<MySQLDataTypesSupport> mysql_datatypes_support_level;
    std::atomic<bool> quit{false};
    std::condition_variable cond;
    using MySQLPool = mysqlxx::Pool;
    using ModifyTimeAndStorage = std::pair<UInt64, StoragePtr>;
    mutable MySQLPool mysql_pool;
    mutable std::vector<StoragePtr> outdated_tables;
    mutable std::map<String, ModifyTimeAndStorage> local_tables_cache;
    std::unordered_set<String> remove_or_detach_tables;
    void cleanOutdatedTables();
    void fetchTablesIntoLocalCache(const Context & context) const;
    std::map<String, UInt64> fetchTablesWithModificationTime() const;
    std::map<String, NamesAndTypesList> fetchTablesColumnsList(const std::vector<String> & tables_name, const Context & context) const;
    void destroyLocalCacheExtraTables(const std::map<String, UInt64> & tables_with_modification_time) const;
    void fetchLatestTablesStructureIntoCache(const std::map<String, UInt64> & tables_modification_time, const Context & context) const;
    ThreadFromGlobalPool thread;
};
}
#endif