Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ mushclient and mysql/lua

mushclient and mysql/lua

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Lilbopeep   USA  (42 posts)  Bio
Date Mon 01 Oct 2012 05:08 AM (UTC)
Message

I tried following the instructions on various parts of the website but most of it seems fairly old so just double checking some things..

I have lua5.1.dll, mysql.dll, and libmySQL.dll all installed in the same directory as my mushclient.exe

I have changed global properties of lua to reflect trust_all_worlds = true

I reloaded the script file


when I try to run

 assert (package.loadlib ("mysql.dll", "luaopen_luasqlmysql")) ()

 env = assert (luasql.mysql())
    
 con = assert (env:connect ("tumbleweed_db", "tumble", "password", "mudsite.com"))

 -- retrieve a cursor
 cur = assert (con:execute ("SELECT count(*) from users" ))

 -- print all rows, the rows will be indexed by field names
 row = cur:fetch ({}, "a")

 while row do
   table.foreach (row, print)
   row = cur:fetch (row, "a")
 end

 -- close everything
 cur:close()
 con:close() 
 env:close()

I get


Immediate execution
[string "Immediate"]:6: LuaSQL: Error connecting to database. MySQL: Can't connect to MySQL server on 'mudsite.com' (10061)
stack traceback:
        [C]: in function 'assert'
        [string "Immediate"]:6: in main chunk


Have things changed? I can't find much information on this subject that is recent. thanks!

,.~`'~.,Dance Magic Dance,.~`'~.,
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 01 Oct 2012 09:06 PM (UTC)
Message

$ mysql -utumble -ppassword -hmudsite.com
ERROR 2003 (HY000): Can't connect to MySQL server on 'mudsite.com' (111)


When I connect with the command-line interface I get the same results. I presume "password" isn't the real password. Try using the command-line interface and see if that works.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Lilbopeep   USA  (42 posts)  Bio
Date Reply #2 on Tue 02 Oct 2012 04:43 AM (UTC)
Message
well yeah, I just didnt give out my username and password over the internet..

I can log into my server no problem, however when I provide the hostname option I get an error, I wonder if the problem is related to networking and am checking with system admin to see if remote mysql access is blocked.

Thanks nick

,.~`'~.,Dance Magic Dance,.~`'~.,
Top

Posted by Bakarus   (17 posts)  Bio
Date Reply #3 on Tue 02 Oct 2012 08:23 PM (UTC)
Message
You tried using the ip instead of mudsite.com
Top

Posted by Ircria   (24 posts)  Bio
Date Reply #4 on Mon 08 Oct 2012 12:29 AM (UTC)

Amended on Mon 08 Oct 2012 12:32 AM (UTC) by Ircria

Message
Mysql Error 10061 is "Connection Refused". It means it is connecting, but the server is actively refusing the connection. This isn't a Lua problem, but an issue with your server. I'm going to assume from hereout your MySQL server is on a linux box, but feel free to correct me and I can update my instructions. Open a terminal or SSH into the box MySQL is running on and enter the following:

netstat -ape | grep mysql

You should see a listening connection. Something like

tcp        0      0 *:mysql                     *:*                         LISTEN      mysql      9480       2657/mysqld


If you get nothing, your service isn't running and you'll want to start it (I assume you've checked that, but saying it just in case).
If it's saying it's listening to localhost instead of *, you won't be able to access it from outside machines, or possibly even on the same machine unless you use a loopback (127.0.0.1 or localhost), and will need to update your configuration to allow it.
If neither of those are the issue, check iptables for any rules that could be blocking outside connections from connecting on that port (As a note, certain distributions have been released with default rules in IPtables that do this, which can cause issues. Fedora comes to mind.)

EDIT: As a note, if this is MySQL being provided from a webhosting account, chances are it is blocked for security issues. That tends to be a standard practice. Also, just noticed you were contacting your network admin, so most of this information will likely be redundant. If that is the case, my apologies.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


15,690 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.