diff --git a/.travis.yml b/.travis.yml index 99aabf2..f794fb4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,14 @@ script: - "sudo ls -lah /var/log" - "sudo cat /var/log/mysql/error.log" - # Check to make sure we can connect to MySQL. + # Check to make sure we can connect to MySQL via Unix socket. + - > + mysql -u root -proot -e 'show databases;' + | grep -q 'performance_schema' + && (echo 'MySQL running normally' && exit 0) + || (echo 'MySQL not running' && exit 1) + + # Check to make sure we can connect to MySQL via TCP. - > mysql -u root -proot -h 127.0.0.1 -e 'show databases;' | grep -q 'performance_schema' diff --git a/tasks/configure.yml b/tasks/configure.yml index a0e8b18..ac7ca70 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -10,3 +10,12 @@ - name: Ensure MySQL is started and enabled on boot. service: "name={{ mysql_daemon }} state=started enabled={{ mysql_enabled_on_startup }}" + +- name: Ensure MySQL socket file has correct permissions. + file: + path: "{{ item }}" + mode: 0755 + notify: restart mysql + with_items: + - "{{ mysql_datadir }}" + - "{{ mysql_socket }}"