Open lburinov73 opened 3 years ago
It should be mydb
instead of mydb.*
?
mysql_grants.present:
- grant: all privileges
- database: mydb
- user: myuser
- host: localhost
# salt-call --log-level=debug state.sls test
...
[DEBUG ] Grant Query generated: GRANT ALL PRIVILEGES ON ``.`mydb` TO %(user)s@%(host)s args {'user': 'myuser', 'host': 'localhost'}
[DEBUG ] Doing query: GRANT ALL PRIVILEGES ON ``.`mydb` TO %(user)s@%(host)s args: {'user': 'myuser', 'host': 'localhost'}
[ERROR ] MySQL Error 1102: Incorrect database name ''
[ERROR ] Failed to execute: "GRANT all privileges ON mydb TO myuser@localhost" (MySQL Error 1102: Incorrect database name '')
[INFO ] Completed state [grants] at time 08:57:30.667889 (duration_in_ms=10.707)
[DEBUG ] File /var/cache/salt/minion/accumulator/139801511717520 does not exist, no need to cleanup
[DEBUG ] LazyLoaded state.check_result
[DEBUG ] Using pkg_resources to load entry points
[DEBUG ] LazyLoaded highstate.output
local:
----------
ID: grants
Function: mysql_grants.present
Result: False
Comment: Failed to execute: "GRANT all privileges ON mydb TO myuser@localhost" (MySQL Error 1102: Incorrect database name '')
Started: 08:57:30.657182
Duration: 10.707 ms
My mistake. Is certainly a bug.
I think I have a similar problem.
My State:
mailman3_db:
mysql_database.present:
- name: {{ pillar['SQL']['DATABASE'] }}
- connection_host: {{ pillar['SQL']['HOST'] }}
- connection_user: {{ pillar['SQL']['ROOT_USER'] }}
- connection_pass: {{ pillar['SQL']['ROOT_PASSWORD'] }}
- require:
- pip: mysql
- service: mariadb
mailman3_app_user:
mysql_user.present:
- name: {{ pillar['SQL']['APP_USER'] }}
- password: {{ pillar['SQL']['APP_PASSWORD'] }}
- host: '%'
- use:
- mysql_database: mailman3
- require:
- service: mariadb
user_mailman3:
mysql_grants.present:
- grant: all privileges
- database: mailman3.*
- user: {{ pillar['SQL']['APP_USER'] }}
- require:
- service: mariadb
- mysql_database: {{ pillar['SQL']['DATABASE'] }}
- mysql_user: {{ pillar['SQL']['APP_USER'] }}
user_mailman3web:
mysql_grants.present:
- grant: all privileges
- database: mailman3web.*
- user: {{ pillar['SQL']['APP_USER'] }}
- require:
- service: mariadb
- mysql_database: {{ pillar['SQL']['DATABASE'] }}
- mysql_user: {{ pillar['SQL']['APP_USER'] }}
My Error:
----------
ID: user_mailman3
Function: mysql_grants.present
Result: False
Comment: Failed to execute: "GRANT all privileges ON mailman3.* TO mailman3web@localhost" (MySQL Error 1133: Can't find any matching row in the user table)
Started: 14:13:23.999764
Duration: 5.069 ms
Changes:
----------
ID: user_mailman3web
Function: mysql_grants.present
Result: False
Comment: Failed to execute: "GRANT all privileges ON mailman3web.* TO mailman3web@localhost" (MySQL Error 1133: Can't find any matching row in the user table)
Started: 14:13:24.004971
Duration: 4.152 ms
Changes:
After the second attempt, the error is gone. It says that the user already exists.
----------
ID: mailman3_db
Function: mysql_database.present
Name: mailman3web
Result: True
Comment: The database mailman3web has been created
Started: 10:06:17.674944
Duration: 3.913 ms
Changes:
----------
mailman3web:
Present
----------
ID: mailman3_app_user
Function: mysql_user.present
Name: mailman3web
Result: True
Comment: The user mailman3web@% has been added
Started: 10:06:17.679785
Duration: 8.927 ms
Changes:
----------
mailman3web:
Present
----------
Description I am getting the following error when applying a mysql state:
OS Centos 8, Mysql server 8.0.25, Salt 3003.1
Setup
Steps to Reproduce the behavior
Versions Report