Alex_Rubio Posted May 10, 2015 Share Posted May 10, 2015 Hello, im trying to put a login panel but when i start the script it says msyql connect failed and all the mysql information is good http://xrc-clan.com/error.png Link to comment
Alex_Rubio Posted May 11, 2015 Author Share Posted May 11, 2015 Sure databaseINFO = { host = 'localhost', user = 'root', pass = 'PRIVATE', db = 'mybb', } addEventHandler("onResourceStart",resourceRoot, function() local connection = dbConnect('mysql', 'dbname='..databaseINFO.db..';host='..databaseINFO.host, databaseINFO.user, databaseINFO.pass) if connection then databaseINFO.connection = connection outputDebugString('[MYSQL-CONNECT]: Connected') else databaseINFO.connection = false outputDebugString('[MYSQL-CONNECT]: Could not connect') end end) function playerWantToLogin(username,password) local qh = dbQuery(databaseINFO.connection,'SELECT * FROM mybb_users WHERE username = ?',username) local result, row, errmsg = dbPoll ( qh, 5000 ) if row and row > 0 then for id, result in ipairs(result) do local Asalt = result['salt'] local Aname = result['username'] local Apass = result['password'] local convertPass = md5(md5(Asalt):lower()..md5(password):lower()):lower() if convertPass == Apass then return "success",result['uid'] end end end end function getPlayerGroup(accName) local qh = dbQuery(databaseINFO.connection,'SELECT * FROM mybb_users WHERE username = ?',accName) local result, row, errmsg = dbPoll ( qh, 5000 ) if row and row > 0 then for id, result in ipairs(result) do local groupID = result['usergroup'] return groupID end else return false end end function checkUserName(username) local qh = dbQuery(databaseINFO.connection,'SELECT * FROM mybb_users WHERE username = ?',username) local result, row, errmsg = dbPoll ( qh, 5000 ) if row and row > 0 then return "success" end return false end In my windows server works. Now, i dont know why it dosent on linux. Link to comment
xXMADEXx Posted May 11, 2015 Share Posted May 11, 2015 Are you sure you have some type of MySQL server software running? Also, try changing localhost to 127.0.0.1, sometimes that works. Link to comment
Alex_Rubio Posted May 11, 2015 Author Share Posted May 11, 2015 OMG Worked! Thank you very much Link to comment
xXMADEXx Posted May 11, 2015 Share Posted May 11, 2015 OMG Worked!Thank you very much You're welcome, happy to help! Link to comment
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