Search code examples
xmppejabberd

Moving ejabberd default DB to MySQL shows authentication failure


I am trying to setup an ejabberd server on my Amazon EC2 Ubuntu instance. With the default DB Provided by ejabberd, I can easily setup my connection. But I need to replace the mnesia DB with MySQL. I found some tutorials over the internet. From those tutorial I found out a solution. I will explain it as step by step.

I am using ejabberd 2.1.11. I made the following changes on ejabberd.cfg file

  1. Commented the following line :

    {auth_method, internal}

  2. Uncommented this:
    {auth_method, odbc}
  3. Configured my MySQL DB

    {odbc_server, {mysql, "localhost", "students", "root", ""}} // No Password set

  4. Change mod_last to mod_last_odbc

  5. Change mod_offline to mod_offline_odbc

  6. Change mod_roster to mod_roster_odbc

  7. Change mod_private to mod_private_odbc

  8. Change mod_privacy to mod_privacy_odbc

  9. Change mod_pubsub to mod_pubsub_odbc

  10. Change mod_vcard to mod_vcard_odbc

Then I installed ejabberd-mysql driver from the following link

http://stefan-strigler.de/2009/01/14/ejabberd-mysql-drivers-for-debian-and-ubuntu/

After making all these changes I restarted my ejabberd server.

Then I tried to login to my ejabberd server. It shows me the login prompt.

After entering the credentials it takes a lot time and then displays authentication failed.

Any help on the topic is appreciated.


Solution

  • Let's dig into problem

    • Your setup is working that means your config file is fine. But then Why does auth fails ?
    • What schema you have in your students database ?
      • If you have a proper schema installed then does the user present in ur db's users table?
      • Have you also updated conf/odbc.ini with proper mysql details.
      • Even if both the conditions meet then I'll advice you to set mysql password and try again.

    Let me know if that helps or not.

    Update :-

    • update your config with {loglevel, 5}
    • then hit the login and tail all the log files.

    odbc.ini

      1 [ejabberd]
      2 Driver      = MySQL
      3 DATABASE    = students
      4 PWD     = 
      5 SERVER      = localhost
      6 SOCKET      = /tmp/mysql.sock
      7 UID     = root