Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-18394

DELIMITER not working in mysqld init-file

Details

    Description

      mysqld.init

      DELIMITER //
      select 1//
      DELIMITER ;
      

      When I run

      mysqld --init-file="/tmp/mysqld.init"
      

      I get a syntax error but the same init file doesn't give any error while run as

      mysql < /tmp/mysqld.init
      

      Here is an exact issue of mysql https://bugs.mysql.com/bug.php?id=17843

      +---------------------------------+------------------------------------------+
      | Variable_name                   | Value                                    |
      +---------------------------------+------------------------------------------+
      | innodb_version                  | 10.3.12                                  |
      | protocol_version                | 10                                       |
      | slave_type_conversions          |                                          |
      | system_versioning_alter_history | ERROR                                    |
      | system_versioning_asof          | DEFAULT                                  |
      | version                         | 10.3.12-MariaDB-log                      |
      | version_comment                 | MariaDB Server                           |
      | version_compile_machine         | x86_64                                   |
      | version_compile_os              | Linux                                    |
      | version_malloc_library          | system                                   |
      | version_source_revision         | faf206a848684bc0f87c93a2b47a55063bbccc6c |
      | version_ssl_library             | OpenSSL 1.1.1a  20 Nov 2018              |
      | wsrep_patch_version             | wsrep_25.23                              |
      +---------------------------------+------------------------------------------+
      

      Attachments

        Issue Links

          Activity

            alice Alice Sherepa added a comment -

            KB says about init_file: "a file containing SQL statements that will be executed by the server on startup. Each statement should be on a new line, and end with a semicolon."
            DELIMITER is not a SQL command, it's a command of mysql client, so there are no errors here: mysql < /tmp/mysqld.init

            alice Alice Sherepa added a comment - KB says about init_file: "a file containing SQL statements that will be executed by the server on startup. Each statement should be on a new line, and end with a semicolon." DELIMITER is not a SQL command, it's a command of mysql client, so there are no errors here: mysql < /tmp/mysqld.init

            So isn't it possible to execute an procedure inside init-file. Seems like mysql provides it here https://bugs.mysql.com/bug.php?id=17843. Can we take it as a feature request ?

            dbjpanda Dibyajyoti Panda added a comment - So isn't it possible to execute an procedure inside init-file. Seems like mysql provides it here https://bugs.mysql.com/bug.php?id=17843 . Can we take it as a feature request ?
            alice Alice Sherepa added a comment -

            The fix there suggests that the procedure already was defined in a database and in init-file there is only call for that procedure. The same works in mariadb, I just checked.

            alice Alice Sherepa added a comment - The fix there suggests that the procedure already was defined in a database and in init-file there is only call for that procedure. The same works in mariadb, I just checked.

            Converted it into a task (a.k.a feature request)

            elenst Elena Stepanova added a comment - Converted it into a task (a.k.a feature request)
            danblack Daniel Black added a comment -

            retested still here

            MariaDB 10.4.33-MariaDB source revision 73a38b68dc2a117642e3bddff086d075326cace6

            mariadbd --init-file=/tmp/x.init
            ...
            2023-11-15 11:44:52 0 [Note] Added new Master_info '' to hash table
            ERROR: 1064  You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DELIMITER //
            select 1//
            DELIMITER ;' at line 1
            2023-11-15 11:44:52 0 [Note] sql/mariadbd: ready for connections.
            Version: '10.4.33-MariaDB'  socket: '/tmp/build-mariadb-server-10.4.sock'  port: 0  Source distribution
            

            danblack Daniel Black added a comment - retested still here MariaDB 10.4.33-MariaDB source revision 73a38b68dc2a117642e3bddff086d075326cace6 mariadbd --init-file=/tmp/x.init ... 2023-11-15 11:44:52 0 [Note] Added new Master_info '' to hash table ERROR: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DELIMITER // select 1// DELIMITER ;' at line 1 2023-11-15 11:44:52 0 [Note] sql/mariadbd: ready for connections. Version: '10.4.33-MariaDB' socket: '/tmp/build-mariadb-server-10.4.sock' port: 0 Source distribution

            People

              Unassigned Unassigned
              dbjpanda Dibyajyoti Panda
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.