So, I’m using the MySQL module from AndyVincent, how ever no matter what I do, it just won’t connect to my sql server.
function SQL.ConnectToDB( ip, username, password, database )
local db, error = mysql.connect( ip, username, password, database, “3306” );
if( db == 0 ) then
WW.SendMessage( nil, "MySQL connection unsuccesful. Error message: " … error, true );
SQL.db = db;
print( “Mysql connection succesful.” );
this is the code I’m using. I am 100% sure that the information I put in is right. I can log onto my sql server through putty for example, with the exact same informations. I haven’t binded my mysql server, so it can’t be connected to from the outside of my server, but is this needed? Seeing as the server I’m testing on is where my garry’s mod server is also hosted. I’m running multiple websites on the same server using that mysql, and they all work fine.
The error message is: “MySQL connection unsuccesful. Error message: Can’t connect to MySQL server on ‘localhost’ (10061)”