Skip to content

importing sql give ERROR 1364 (HY000) at line : Field 'server_host' or 'type' doesn't have a default value #4548

@giostark

Description

@giostark

Before creating a ticket, please consider if this should fit the discussion forum better.

Environment

  • ejabberd version: 23.10
  • Erlang version: erl +V
  • OS: Linux (Arch)
  • Installed from: official binary installer

Configuration (only if needed): grep -Ev '^$|^\s*#' ejabberd.yml

loglevel: 4
...

Errors from error.log/crash.log

No errors

Bug description

I'm stuck still here : #4199

I don't know if is right that is fault of the environment as stated by "mremond" . Now i have a full machine (no virtualization) . I copied the 32.10 installation in the new system and it work fine.
Some day ago I faced the error of conversations that basically claim that the ejabberd version is too old (TLS stuff).
So I keep some courage and tried to export the database Mnesia to a SQL file following this guide:
https://www.process-one.net/blog/install-and-configure-mariadb-with-ejabberd/
Everything go fine till the import of the /tmp/mnesia.sql
To say the true I have to use the option --no-timeout during the exportation of the db otherwise was reported an error of timeout) Then...
When I import the database I receive this error:

[root@arch-nas bin]# mariadb -h localhost -D ejabberd -u ejabberd -p < /tmp/mnesia.sql
Enter password:
--------------
INSERT INTO users(username, password) VALUES ('daniele', 'xxxx')
--------------

ERROR 1364 (HY000) at line 5: Field '**type**' doesn't have a default value
[root@arch-nas bin]#

If I do not import the schema before launching ejabberd , but instead I launch ejabberd with the option "update_sql_schema: true" and "new_sql_schema: true" It create a schema (probably not really updated) and ejabber do start regularly (but empty) and if I try to import the /tmp/mnesia.sql the error is similar :

[root@arch-nas bin]# mariadb -h localhost -D ejabberd -u ejabberd -p < /tmp/mnesia.sql
Enter password: 
--------------
INSERT INTO users(username, password) VALUES ('daniele', 'xxxx')
--------------

ERROR 1364 (HY000) at line 5: Field '**server_host**' doesn't have a default value
[root@arch-nas bin]# 

If I try to update the schema with the command : [root@arch-nas bin]# ./ejabberdctl update_sql /tmp/mnesia.sql
I got his :
Unhandled exception occurred executing the command: ** exception error: bad argument in function lists:member/2 called as lists:member(gen_mod,undefined) *** argument 2: not a list in call from ejabberd_ctl:print_usage_command2/4 (src/ejabberd_ctl.erl, line 882) in call from ejabberd_ctl:process/2 (src/ejabberd_ctl.erl, line 198) in call from ejabberd_ctl:call_command/4 (src/ejabberd_ctl.erl, line 345) in call from ejabberd_ctl:try_call_command/4 (src/ejabberd_ctl.erl, line 295) in call from ejabberd_ctl:process2/4 (src/ejabberd_ctl.erl, line 235) in call from ejabberd_ctl:process/2 (src/ejabberd_ctl.erl, line 213) in call from erpc:execute_call/4 (erpc.erl, line 589)

I read this : https://docs.ejabberd.im/admin/configuration/database/#database-schema
And also this : https://docs.ejabberd.im/developer/sql-schema/

I'm trapped in the fact that I cannot upgrade the sql schema exported from the mnesia db and consequently I cannot import the sql file in the mysql database (MariaDB).
There is a way to upgrade this sql ?
I don't know how to manually modify the /tmp/mnesia.sql file to match the new requirements.
(ps: now I'm using the Mnesia db. Any attempt to install any newer release make ejabberd stuck at launch without errors , as in the past , see old post) . So i cannot update ejabberd , nor the database.
Any help will be really appreciated :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions