[debian-mysql] Bug#708176: mysql-server-5.5 postinst SQL error 1064 syntax error

Bob Proulx bob at proulx.com
Mon May 13 19:34:02 UTC 2013


The postinst script appears to be trying to add columns to the mysql
table in the "fix_privs" section.  It is doing this by the
non-interactive method of piping SQL input into the client.  All
fine.  However the method used really "works" only once.

A smaller test case than the entire postinst script is:

  # printf "USE mysql;\n ALTER TABLE user ADD column Create_view_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N';  ALTER TABLE user ADD column Show_view_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N';\n" | /usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables
  ...
  ERROR: 1064  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ALTER TABLE user ADD column Show_view_priv enum('N','Y') CHARACTER SET utf8 NOT ' at line 1
  ...

Changing that slightly to add a newline at the semicolon between the
SQL statements:

  # printf "USE mysql;\n ALTER TABLE user ADD column Create_view_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N';\n  ALTER TABLE user ADD column Show_view_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N';\n" | /usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables
  ...
  ERROR: 1060  Duplicate column name 'Create_view_priv'
  ...

Therefore the problem seems to stem from trying to do this fixup when
the fixup has already been done.  Unfortunately it produces the scary
syntax error message that needs to be tracked down and understood.

Bob



More information about the pkg-mysql-maint mailing list