Sign in to follow this  
=KoG=Rouche

[OK] dbconnect & MySQL

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

Share this post


Link to post

Check the MySQL port, maybe its different from normal one. then in dbConnect add it like this port=yourMySQLPort

Share this post


Link to post

(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") 
  

Share this post


Link to post
(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"

Share this post


Link to post

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

Share this post


Link to post

I add to :

dpkg -i --arch-structure i386

apt-get install ia32-libs (need to add a old depository in /etc/apt/source.list)

Then add your file in usr/lib32

Thank you.

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.