Jump to content

[OK] dbconnect & MySQL


=KoG=Rouche

Recommended Posts

Hi all,

I'm back into Scripting.

I have a new problem with my dbconnect function.

Here is my code :

server.lua

  
---- MYSQL Connection ---- 
-- Create an connection object for the Database 
function connectDB() 
    local con = dbConnect("mysql","dbname=MYDBNAME;host=127.0.0.1", "DBUSER", "DBPASS", "share=1") 
    if (con) then 
        outputDebugString("Connection OK !") 
    else 
        outputDebugString("Connection to Database failled !") 
    end 
    return con 
end 
------- VARIABLES ------- 
rootElement = getRootElement() 
local connect = connectDB() 
  

When i try this it says :

ERROR : line4 : dbConnect failed. Could not connect

Do you see any error ?

Thanks for helping.

Edited by Guest
Link to comment
(Copy and Paste make more line than normal)

Modules are loaded in mtaserv.conf

and result of netstat is :

tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN

I tried with :

  
local con = dbConnect("mysql","dbname=MYDBNAME;host=127.0.0.1;port=3306", "DBUSER", "DBPASS", "share=1") 
  

Make sure the group of your db user is set to "host"

Link to comment

Found the problem.

I use Debian 64bits.

[2015-12-02 19:42:42] MODULE: Unable to load mods/deathmatch/modules/mta_mysql.so (libmysqlclient.so.15: wrong ELF class: ELFCLASS64)

[2015-12-02 19:42:42] MODULE: Loaded "Sockets Module" (1.30) by "Gamesnert, MCvarial & x86"

Does someone have the file for 64 ?

libmysqlclient.so.15

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...