mirror of
https://github.com/saltstack-formulas/mysql-formula.git
synced 2025-04-16 17:50:27 +00:00
Merge pull request #1 from Routhinator/initialize_57_before_start
Initialize 57 before start
This commit is contained in:
commit
3b5ef19c34
1 changed files with 19 additions and 1 deletions
|
@ -64,13 +64,17 @@ mysql_delete_anonymous_user_{{ host }}:
|
|||
# on arch linux: inital mysql datadirectory is not created
|
||||
mysql_install_datadir:
|
||||
cmd.run:
|
||||
{% if mysql.version >= 5.7 %}
|
||||
- name: mysqld --initialize-insecure --user=mysql --basedir=/usr --datadir=/var/lib/mysql
|
||||
{% else %}
|
||||
- name: mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
|
||||
{% endif %}
|
||||
- user: root
|
||||
- creates: /var/lib/mysql/mysql/user.frm
|
||||
- env:
|
||||
- TMPDIR: '/tmp'
|
||||
- require:
|
||||
- pkg: {{ mysql.server }}
|
||||
- pkg: {{ mysql.server }}
|
||||
- file: mysql_config
|
||||
- require_in:
|
||||
- service: mysqld
|
||||
|
@ -84,12 +88,26 @@ mysqld-packages:
|
|||
- debconf: mysql_debconf
|
||||
{% endif %}
|
||||
|
||||
{% if os_family == 'RedHat' or 'Suse' and mysql.version >= 5.7 %}
|
||||
# Initialize mysql database with --initialize-insecure option before starting service so we don't get locked out.
|
||||
mysql_initialize:
|
||||
cmd.run:
|
||||
- name: mysqld --initialize-insecure --user=mysql --basedir=/usr --datadir=/var/lib/mysql
|
||||
- user: root
|
||||
- creates: /var/lib/mysql/mysql/
|
||||
- require:
|
||||
- pkg: {{ mysql.server }}
|
||||
{% endif %}
|
||||
|
||||
mysqld:
|
||||
service.running:
|
||||
- name: {{ mysql.service }}
|
||||
- enable: True
|
||||
- require:
|
||||
- pkg: {{ mysql.server }}
|
||||
{% if os_family == 'RedHat' or 'Suse' and mysql.version >= 5.7 %}
|
||||
- cmd: mysql_initialize
|
||||
{% endif %}
|
||||
- watch:
|
||||
- pkg: {{ mysql.server }}
|
||||
- file: mysql_config
|
||||
|
|
Loading…
Add table
Reference in a new issue