MrKranChof Posted April 17, 2013 Posted April 17, 2013 (edited) hi guys i have problem. this script not working idk what is the problem -- Connection functions local connection = nil local function connect( ) connection = dbConnect( "mysql", "dbname=mtadev;host=127.0.0.1;port=3306;unix_socket=/var/run/mysqld/mysqld.sock", "mtadev", "t9CPZJbJTe8FtnwC", "share=1" ) if connection then outputConsole ( "Server is now connected with the MySQL database!", 1 ) return true else outputConsole ( "Connection with the MySQL database failed!", 1 ) return false end end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), connect ) -- Exported functions function query( ... ) if connection then local qh = dbQuery( connection, ... ) local result = dbPoll( qh, -1 ) return result else return false end end -- Get a single row from the database function querySingle( str, ... ) if connection then local result = query( str, ... ) if type(result) == 'table' then return result[1] end return result else return false end end -- DB exec as used function exec( str, ... ) if connection then local qh = dbExec( connection, str, ... ) return qh else return false end end console say: mysql.lua:5: dbConnect failed; Can't connect to MySQL server on '127.0.0.1' (10061) Edited April 17, 2013 by Guest
WASSIm. Posted April 17, 2013 Posted April 17, 2013 local function connect( ) maybe that? i think problem to connection = dbConnect( "mysql", "dbname=mtadev;host=127.0.0.1;port=3306;unix_socket=/var/run/mysqld/mysqld.sock", "mtadev", "t9CPZJbJTe8FtnwC", "share=1" )
50p Posted April 17, 2013 Posted April 17, 2013 If it says it can't connect, what can we do about it? It's not the script problem but the MySQL server itself. You need to sort it out or speak to someone who is hosting the server for you.
xXMADEXx Posted April 18, 2013 Posted April 18, 2013 its not working to server local ? It can be hosted on local server.... Not sure, but try this: connection = dbConnect( "mysql", "dbname=mtadev;host=127.0.0.1;", "mtadev", "t9CPZJbJTe8FtnwC", "autoreconnect=1" )
Castillo Posted April 18, 2013 Posted April 18, 2013 The unix socket is required if he's not using Windows ( as far as I know ).
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now