Skip to content

[BUG] MySQL comments cause mysql_query.run_file to fail #59336

@lburinov73

Description

@lburinov73

Description
mysql_query.run_file cannot import dump with many mysql comments
example file: https://github.com/phpmyadmin/phpmyadmin/blob/master/sql/create_tables.sql

Setup

phpmyadmin-db:
  mysql_query.run_file:
    - query_file: /usr/share/phpMyAdmin/sql/create_tables.sql
    - database: 'phpmyadmin'

Steps to Reproduce the behavior

[DEBUG   ] Doing query: SHOW DATABASES LIKE %(dbname)s; args: {'dbname': 'phpmyadmin'} 
[DEBUG   ] Using db: phpmyadmin to run query --CREATE DATABASE IF NOT EXISTS `phpmyadmin`DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
[DEBUG   ] Doing query: --CREATE DATABASE IF NOT EXISTS `phpmyadmin`DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
[DEBUG   ] An exception occurred in this state: (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 '--CREATE DATABASE IF NOT EXISTS `phpmyadmin`DEFAULT CHARACTER SET utf8 COLLATE u' at line 1")

Expected behavior
dump is imported successfully

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3002.2
 
Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: 2.4.2
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.11.1
       libgit2: Not Installed
      M2Crypto: 0.35.2
          Mako: Not Installed
       msgpack: 0.6.2
  msgpack-pure: Not Installed
  mysql-python: 1.3.12
     pycparser: Not Installed
      pycrypto: Not Installed
  pycryptodome: Not Installed
        pygit2: Not Installed
        Python: 3.6.8 (default, Nov 16 2020, 16:55:22)
  python-gnupg: Not Installed
        PyYAML: 3.13
         PyZMQ: 17.0.0
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.1.4
 
System Versions:
          dist: centos 7 Core
        locale: UTF-8
       machine: x86_64
       release: 3.10.0-1160.11.1.el7.x86_64
        system: Linux
       version: CentOS Linux 7 Core

Additional context
Presumably the problem appeared after PR #54371

Metadata

Metadata

Assignees

Labels

bugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions