diff options
Diffstat (limited to 'src/sql.c')
-rw-r--r-- | src/sql.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -10,10 +10,16 @@ MYSQL_RES *result; void sql_connect() { + char *socket_path = NULL; + + if (sql_host[0] == '/') { + socket_path = sql_host; + sql_host = "localhost"; + } if (!mysql_real_connect(&mysql, sql_host, sql_user, sql_password, sql_database, sql_port, - NULL, 0)) { + socket_path, 0)) { fprintf(stderr, "cannot connect to MySQL server: %s\n", mysql_error(&mysql)); |