CREATE TABLE requires data_dir to be set in the config file

I get this error in the the terminal:

# mysql -P9306 -h0
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 33
Server version: 3.5.4 13f8d08d@201211 release git branch HEAD (no branch)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE TABLE testrt(title text, content text, counter int);
ERROR 1064 (42000): CREATE TABLE requires data_dir to be set in the config file

despite the fact that in /etc/manticoresearch/manticore.conf I have

searchd {
    listen = 9312
    listen = 9306:mysql41
    seamless_rotate = 1
    preopen_indexes = 1
    unlink_old = 1
    log = /var/log/manticore/searchd.log
    query_log = /var/log/manticore/query.log
    pid_file = /var/run/
    binlog_path = /var/lib/manticore/data
    data_dir = /var/manticore

index testrt {
    type = rt
    rt_field = title
    rt_field = content
    rt_attr_uint = counter

And I created created the path like this:

# ls -al /var/manticore
total 8
drwxrwxrwx  2 manticore manticore 4096 Mar 10 08:47 .
drwxr-xr-x 16 root      root      4096 Mar 10 08:47 ..

I tried many variations of the config but none worked.
Appreciate a working example for this because the docs is just confusing about this.

Have you restarted searchd since adding data_dir ?

That seems the most likely issue.

1 Like

Actually such config should not run at all.

You either define indexes in the config, either provide data_dir in daemon’s section, never both.

Daemon should report fatal error “‘data_dir’ cannot be mixed with index declarations in ‘/path/to/config.conf’” if both present.

I don’t understand where he’s declared it in two places. I am running into the same issue after adding a csv source and plain index. I’m using the default config from /etc/manticoresearch without modifying anything in the file other than adding source and index for a csv file.

If you youse plain indexes with sources and running indexer - remove ‘data_dir’ from searchd section. It is not compatible with old way of working with the indexes.

I.e. - config either contains ‘data_dir’ in searchd section, and no sources/indexes.
Either you put indexes into config - but then you have to remove data_dir.

Old way is have indexes in the config, fill them with ‘indexer’ (for plain) or with ‘insert’ (for rt) and manage all these files yourself.

New way is REMOVE all indexes definitions from config and add ‘data_dir’ to searchd section.
Then you can create indexes with ddl statement ‘create table’, fill it with ‘insert’, achieve replication.
Plain indexes ‘as is’ are not available in that mode, tool ‘indexer’ also is not necessary.

That’s making a little more sense to me, thank you!