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

Host '127.0.0.1' is not allowed to connect to this MySQL server #178

Open
waynegemmell opened this issue Mar 14, 2018 · 4 comments
Open

Comments

@waynegemmell
Copy link
Contributor

Hi

My system is Ubuntu Xenial, formula git is up to date and salt version is 2017.7.4+ds-1

I'm really battling with this formula. When I run the mysql state, or the indivitual states in a single state file, it fails, but when I run mysql.server followed by mysql.salt-user, then mysql.user in sequence manually it works fine.

Here is a stack trace of the failure. I have edited the server.sls file and added a 90s delay on service.running but had no luck.

ID: mysql_user_root_10.%
Function: mysql_user.present
Name: root
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1744, in call **cdata['kwargs'])
File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1702, in wrapper return f(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/states/mysql_user.py", line 142, in present *connection_args):
File "/usr/lib/python2.7/dist-packages/salt/modules/mysql.py", line 1128, in user_exists dbc = _connect(**connection_args)
File "/usr/lib/python2.7/dist-packages/salt/modules/mysql.py", line 330, in _connect dbc = MySQLdb.connect(**connargs)
File "/usr/lib/python2.7/dist-packages/pymysql/init.py", line 88, in Connect
return Connection(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/pymysql/connections.py", line 679, in init
self.connect()
File "/usr/lib/python2.7/dist-packages/pymysql/connections.py", line 890, in connect
self._get_server_information()
File "/usr/lib/python2.7/dist-packages/pymysql/connections.py", line 1190, in _get_server_information
packet = self._read_packet()
File "/usr/lib/python2.7/dist-packages/pymysql/connections.py", line 966, in _read_packet
packet.check_error()
File "/usr/lib/python2.7/dist-packages/pymysql/connections.py", line 394, in check_error
err.raise_mysql_exception(self._data)
File "/usr/lib/python2.7/dist-packages/pymysql/err.py", line 120, in raise_mysql_exception
_check_mysql_exception(errinfo)
File "/usr/lib/python2.7/dist-packages/pymysql/err.py", line 115, in _check_mysql_exception
raise InternalError(errno, errorvalue)
InternalError: (1130, u"Host '127.0.0.1' is not allowed to connect to this MySQL server")
Started: 09:23:24.727920
Duration: 1.167 ms
Changes:

Here is a gist with my relevant config. It's about as simplistic as it gets.

https://gist.github.com/waynegemmell/f7fda05b54e81b463234a1ba704a4633

@wwentland
Copy link
Contributor

This might be due to the fact that you are including these states individually, without implementing similar logic akin to what is found in mysql/init.sls:

{% if (db_states|length() + user_states|length()) > 0 %}
extend:
  mysqld:
    service:
      - require_in:
        {{ requisites('mysql_database', db_states) }}
        {{ requisites('mysql_user', user_states) }}
{% endif %}

Could you try reproducing this with a simple:

base:
  'waspslave*':
    - mysql

@waynegemmell
Copy link
Contributor Author

I tried that again, just to be thorough. No luck

@wwentland
Copy link
Contributor

What's the actual state run output?

@waynegemmell
Copy link
Contributor Author

I still have some more testing to do, but it seems like applying the same formula to a new container does the job. There must be something wrong with the original template container I was using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants