Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql_user command fail with dots in database names #3767

Closed
vdboor opened this issue Aug 6, 2013 · 7 comments
Closed

mysql_user command fail with dots in database names #3767

vdboor opened this issue Aug 6, 2013 · 7 comments
Labels
bug This issue/PR relates to a bug. mysql

Comments

@vdboor
Copy link

vdboor commented Aug 6, 2013

As I use the domainname of a site as database name, ansible fails on these values.

_mysql_exceptions.ProgrammingError: (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 '.nl.* TO 'www.mysite.nl'@'localhost'' at line 1")

MySQL server version: 5.5

I'm using the action:

mysql_user name=$mysql_user host=localhost password=$mysql_password state=present priv=$mysql_db.*:ALL

The grant statement needs to have the database name quoted:

grant all privileges on www.mysite.nl.* to 'gtd.edoburu.nl'@localhost;

I've did some digging through the ansible source code, but couldn't really find how to change that.

@johnhamelink
Copy link
Contributor

I'm also experiencing this, but with the following database name: "glasgow-locum-group_production" (minus quotes). I'm using mariaDB 5.5.32.

I'm going to have a dig and see if I can cook up a pull request.

@sevein
Copy link
Contributor

sevein commented Oct 9, 2013

@johnhamelink - I forgot to say: thank you for taking care of this! 👍

@johnhamelink
Copy link
Contributor

No problem @sevein!

@echo-devnull
Copy link
Contributor

Could it be that this error is back again?

_mysql_exceptions.ProgrammingError: (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 'ON . TO 'replication'@'localhost'' at line 1")

With this ansible setup:

  • name: create replication user
    mysql_user: name=replication password=************ priv=.:REPLICATION state=present

(This comment is removing the stars, please also see here: http://pastebin.com/iBWHZfZM )

ansible version: 1.6.2

@kilex
Copy link

kilex commented Jul 4, 2014

@markmaas +1

ansible --version
ansible 1.7

in role task:
mysql_user: name=kilex.ru password=****** priv=kilex.ru.*:ALL state=present
error in result:

invalid output was: Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1404502036.04-132588940619042/mysql_user", line 1774, in <module>
    main()
  File "/root/.ansible/tmp/ansible-tmp-1404502036.04-132588940619042/mysql_user", line 462, in main
    changed = user_add(cursor, user, host, password, priv)
  File "/root/.ansible/tmp/ansible-tmp-1404502036.04-132588940619042/mysql_user", line 164, in user_add
    privileges_grant(cursor, user,host,db_table,priv)
  File "/root/.ansible/tmp/ansible-tmp-1404502036.04-132588940619042/mysql_user", line 292, in privileges_grant
    cursor.execute(query)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1103, "Incorrect table name ''")

@Jmainguy
Copy link
Contributor

#7769 reports this same issue. #7804 is believed to fix this issue.

@ziras
Copy link

ziras commented Dec 9, 2014

#7804 fixes this issue but the issue is closed without any commit merged into the core repo.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue/PR relates to a bug. mysql
Projects
None yet
Development

No branches or pull requests

9 participants