Prosody 0.9 Windows 64bit + MySQL

226 views
Skip to first unread message

Rui Coelho

unread,
Oct 22, 2013, 3:15:17 PM10/22/13
to prosod...@googlegroups.com
Hello everyone,

I'm trying to get prosody 0.9 to connect to MySQL, but it's not working.

I've downloaded luadbi.mysql.zip from http://prosody.im/downloads/windows/addons/, and placed bin\libmysql.dll on Prosody\bin\libmysql.dll,
and, lib\dbdmysql.dll and lib\DBI.lua, under Prosody\lib\.

I have prosody.cfg.lua set up with:

storage = "sql"
sql = { driver = "MySQL", database = "prosody", username = "prosody", password = "secret", host = "localhost", port=3306 }
sql_manage_tables = true

Here is the account setup on phpMyAdmin:

This is there log I get when I try to run: http://pastebin.com/cahsUuLU

What am I missing?

Thanks.

Kim Alvefur

unread,
Oct 27, 2013, 4:17:45 PM10/27/13
to prosod...@googlegroups.com
Hi,

On 2013-10-22 21:15, Rui Coelho wrote:
> I'm trying to get prosody 0.9 to connect to MySQL, but it's not working.

> I have prosody.cfg.lua set up with:
>
> storage = "sql"
> sql = { driver = "MySQL", database = "prosody", username =
> "prosody", password = "secret", host = "localhost", port=3306 }
> sql_manage_tables = true

> This is there log I get when I try to run: http://pastebin.com/cahsUuLU

Which says
> Failed to connect to database: Can't connect to MySQL server on
> 'localhost' (10061)

The MySQL docs[1] says that this means the connection was refused, so
doublecheck that MySQL is running and listening on that port, and on the
same machine as Prosody.

[1]: http://dev.mysql.com/doc/refman/5.5/en/can-not-connect-to-server.html

--
Kim "Zash" Alvefur

signature.asc

Rui Coelho

unread,
Oct 28, 2013, 6:15:46 AM10/28/13
to prosod...@googlegroups.com, za...@zash.se
Hi,
Awesome, thanks to you I've manage to figure I can't use localhost, it has to be 127.0.0.1. :D

Simon Iremonger

unread,
Oct 28, 2013, 6:23:58 AM10/28/13
to prosod...@googlegroups.com, za...@zash.se
> Awesome, thanks to you I've manage to figure I can't use localhost, it has to be 127.0.0.1. :D

Is worth being able to be aware what your mysqld is listening on anyway?

Check "netstat -lutnp" on gnu-linuxy-type-system -- shows you UDP/TCP
listening sockets.
Maybe "netstat -an" or similar will tell you similar on Windows?

May well be the case that mysqld is listening only for legacy internet
loopback connections (i.e. bound only to 127.0.0.1) or only for
legacy connections (but works from other legacy machines) --
(i.e. bound to 0.0.0.0).

Whereas, the 'hosts' file (in system32\etc on windows?) MAY have
"localhost" pointing to both ::1 and 127.0.0.1 maybe? Some systems
(at least used to) have a separate "ip6-localhost" but now "localhost"
tends to have both in my experience....

Worth, in any case, learning how to check /being *aware* of what
socket(s) your daemons are listening-on....

Hope that helps you notice/think-about what is going on and hopefully
avoid future problems of similar nature in various contexts.

--Simon

Darac Marjal

unread,
Oct 29, 2013, 7:44:40 AM10/29/13
to prosod...@googlegroups.com
On Mon, 28 Oct 2013 03:15:46 -0700 (PDT)
Rui Coelho <rui.co...@gmail.com> wrote:

> Hi,
> Awesome, thanks to you I've manage to figure I can't use localhost,
> it has to be 127.0.0.1. :D

This is a "known" quirk of mysql. If you try to connect to "localhost"
it will try to talk over a local UNIX socket (something
like /var/run/mysqld/mysqld.sock). If the server's not listening on
that, then you won't be able to connect. But if you use an IP address,
then the client will, instead, use TCP/IP sockets to talk.

Ah, it IS actually documented here:
https://dev.mysql.com/doc/refman/5.1/en/connecting.html (read the
paragraph starting "On Unix, MySQL programs treat the host name
localhost specially).
--
Paul Saunders | PGP: 0xCC9A6F67 | http://www.darac.org.uk
aka Darac Marjal | ICQ: 4161505 | Da...@Darac.org.uk
-----------------
Life only demands from you the strength you possess.
Only one feat is possible -- not to have run away.
-- Dag Hammarskjold
Reply all
Reply to author
Forward
0 new messages