0

System: Mac OS X Server 10.6.latest

I just switched from the ancient MySQL (<5?) that came with Mac OS X Server to MariaDB 10.1, installed via MacPorts. (That was a whole 'nuther barrel of fun...)

Now I'm having trouble accessing the database via localhost, but only in some situations. PhpMyAdmin works with only "localhost" in the config.inc.php, but several MediaWiki instances I have running require the whole socket name in LocalSettings.php, such as "localhost:/opt/local/var/run/mariadb-10.1/mysqld.sock".

I have the socket named in my.cnf, and in three places in php.ini for the three different MySQL glue libraries available. I restarted Apache and mysqld to get them to read the changes. So I'm thinking localhost should be ubiquitous now.

I've patched around the problem by putting the socket name after "localhost" on the MediaWiki sites, but I know this is going to come back to bite me in the butt someday if I don't fix it properly.

Any thoughts on what's going on here?

  • 1
    I took the coward's way out and changed the mysqld startup script to put the socket in /var/mysql/mysql.sock, and everything works with unadorned "localhost." It appears to me that at least one of the three PHP-MySQL interface libraries is behaving badly, but I don't have time to dig through it. So it's working properly now, with the socket in the default location. (I only put it elsewhere because that's where MacPorts puts it when you build from source.) – Jan Steinman Feb 17 '15 at 3:19
-1

Presumably both PhpMyAdmin and MediaWiki are on the same machine and that's the same machine as the MariaDB server? If so, there's no reason why one should work and not the other if they have the same settings.

  • Ensure you are using the same port when both are specified as just localhost?

  • If you are not using the same mysql user for the login in both applications, please ensure that the host values for those users are the same.

  • Why the downvote? – Luke Cousins Feb 14 '15 at 14:34
  • Thanks for your suggestions, Luke. (I did not down-vote you.) The port should be irrelevant when using "localhost," as it uses a socket instead. The MySQL user/pass has not changed from what it was when it was working before. The host value ("localhost") has not changed either, which still works in phpMyAdmin, but not in MediaWiki nor in two cases of custom php code I've written in php. – Jan Steinman Feb 16 '15 at 20:08
  • Hi Jan. I may be wrong, but I'm pretty certain that using localhost is not the same as specifying a socket. If you specify a socket then certainly the port is irrelevant, but if you specify localhost then it is still a network connection on the loopback interface and therefore port is applicable. I would suggest looking at firewall settings but if it works for one then I don't see how this can be the problem. Trying entering the host in Mediawiki as localhost:3306 (format of host:port) rather than just localhost (or your correct port). – Luke Cousins Feb 16 '15 at 20:42
  • Also, if you could post the relevant bit of your MediaWiki and PMA config files that might help. Obviously swap the password for something else. – Luke Cousins Feb 16 '15 at 20:43
  • Luke: the MySQL manual says that "localhost" assumes a socket. I think this is generally true of Unix and Linux, but I know that on Windows, "localhost" means "127.0.0.1." But I'm not using Windows. – Jan Steinman Feb 17 '15 at 3:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.