diff --git a/ci/build_unix.sh b/ci/build_unix.sh index b23532fe..ed0e72c5 100644 --- a/ci/build_unix.sh +++ b/ci/build_unix.sh @@ -8,6 +8,7 @@ if [ $TRAVIS_OS_NAME == "osx" ]; then brew update brew install $DATABASE cp ci/unix-ci.cnf ~/.my.cnf # This location is checked by both MySQL and MariaDB + sudo mkdir -p /var/run/mysqld/ mysql.server start # Note that running this with sudo fails if [ $DATABASE == "mariadb" ]; then sudo mysql -u root < ci/root_user_setup.sql @@ -15,10 +16,7 @@ if [ $TRAVIS_OS_NAME == "osx" ]; then export MYSQL_HAS_SHA256=1 fi else - # Inclusion order in config files is undefined, so we append to the main config file - PRINTF_STRING="\n!include $(pwd)/ci/unix-ci.cnf\n\n" - sudo bash -c "printf \"$PRINTF_STRING\" >> /etc/mysql/my.cnf" - find /etc/mysql/ -type f | xargs -I {} sudo bash -c "echo ---Printing {} && cat {}" + sudo cp ci/unix-ci.cnf /etc/mysql/conf.d/ sudo service mysql restart wget https://github.com/Kitware/CMake/releases/download/v3.17.0/cmake-3.17.0-Linux-x86_64.sh -q -O cmake-latest.sh mkdir -p /tmp/cmake-latest diff --git a/ci/unix-ci.cnf b/ci/unix-ci.cnf index 4a4142fa..eb43b661 100644 --- a/ci/unix-ci.cnf +++ b/ci/unix-ci.cnf @@ -3,7 +3,7 @@ ssl-ca=/tmp/ca-cert.pem ssl-cert=/tmp/server-cert.pem ssl-key=/tmp/server-key.pem log_error=/tmp/mysql-log.txt -socket=/tmp/mysql.sock +socket=/var/run/mysqld/mysqld.sock [client] -socket=/tmp/mysql.sock \ No newline at end of file +socket=/var/run/mysqld/mysqld.sock \ No newline at end of file diff --git a/example/unix_socket.cpp b/example/unix_socket.cpp index 3868af01..a7068ead 100644 --- a/example/unix_socket.cpp +++ b/example/unix_socket.cpp @@ -9,7 +9,7 @@ * You can get this database by running db_setup.sql. * This example assumes you are connecting to MySQL server using * a UNIX socket. The socket path can be configured using command line - * arguments, and defaults to /tmp/mysql.sock + * arguments, and defaults to /var/run/mysqld/mysqld.sock * * This example uses synchronous functions and handles errors using exceptions. */ @@ -37,7 +37,7 @@ void main_impl(int argc, char** argv) exit(1); } - const char* socket_path = "/tmp/mysql.sock"; + const char* socket_path = "/var/run/mysqld/mysqld.sock"; if (argc == 4) { socket_path = argv[3]; diff --git a/test/integration/integration_test_common.hpp b/test/integration/integration_test_common.hpp index 2a36897e..972a3601 100644 --- a/test/integration/integration_test_common.hpp +++ b/test/integration/integration_test_common.hpp @@ -26,7 +26,7 @@ inline void physical_connect(tcp_connection& conn) #ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS inline void physical_connect(unix_connection& conn) { - boost::asio::local::stream_protocol::endpoint endpoint ("/tmp/mysql.sock"); + boost::asio::local::stream_protocol::endpoint endpoint ("/var/run/mysqld/mysqld.sock"); conn.next_layer().connect(endpoint); } #endif