Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: sql_authentication with remote database?  (Read 4384 times)

0 Members and 1 Guest are viewing this topic.

Francesco

  • Anope User
  • Offline Offline
  • Gender: Male
  • Posts: 15
  • Il Caius
    • Caius' Site
sql_authentication with remote database?
« on: February 19, 2014, 02:40:37 PM »

Hi all!
My question is this: is possible to use sql_authentication module with a remote mysql database or it works only with local database?
If it is possible, how should I do?
Thanks in advance

LEthaLity

  • Team
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 307
    • LEthaLity
Re: sql_authentication with remote database?
« Reply #1 on: February 19, 2014, 02:43:53 PM »

same way you would usually but using the remote IP's... you'll probably need to do something mysql/host side to enable remote connections to mysql as by default it's only meant for local connections.
Logged

Jens Voss

  • Team
  • *
  • Offline Offline
  • Posts: 123
Re: sql_authentication with remote database?
« Reply #2 on: February 19, 2014, 02:46:59 PM »

you can configure different mysql connections :

Code: [Select]
module
{
   name = "m_mysql"

   mysql
          {
              /* The name of this service. */
              name = "mysql/main"
              database = "anope"
              server = "127.0.0.1"
              username = "anope"
              password = "mypassword"
             port = 3306
           }
   mysql
          {
              /* The name of this service. */
              name = "mysql/forum"
              database = "phpbb"
              server = "forum.your-net.com"
              username = "phpbb"
              password = "mypassword"
             port = 3306
           }

}

and then configure m_sql_authentication to use the second connection:

Code: [Select]
module
{
name = "m_sql_authentication"

            /* SQL engine to use. Should be configured elsewhere with m_mysql, m_sqlite, etc. */
           engine = "mysql/forum"
....
Logged

Francesco

  • Anope User
  • Offline Offline
  • Gender: Male
  • Posts: 15
  • Il Caius
    • Caius' Site
Re: sql_authentication with remote database?
« Reply #3 on: February 19, 2014, 07:05:54 PM »

you can configure different mysql connections :

Code: [Select]
module
{
   name = "m_mysql"

   mysql
          {
              /* The name of this service. */
              name = "mysql/main"
              database = "anope"
              server = "127.0.0.1"
              username = "anope"
              password = "mypassword"
             port = 3306
           }
   mysql
          {
              /* The name of this service. */
              name = "mysql/forum"
              database = "phpbb"
              server = "forum.your-net.com"
              username = "phpbb"
              password = "mypassword"
             port = 3306
           }

}

and then configure m_sql_authentication to use the second connection:

Code: [Select]
module
{
name = "m_sql_authentication"

            /* SQL engine to use. Should be configured elsewhere with m_mysql, m_sqlite, etc. */
           engine = "mysql/forum"
....



I tried this, but when I /os reload my services an error appears in the log:
Code: [Select]
[Feb 19 10:33:50 2014] MySQL: Unable to connect to MySQL service mysql/forum: Can't connect to MySQL server on 'HOST' (4)(of course I replaced HOST with the real host of my database)
What does this mean? What is that "4"?

Borja

  • Anope User
  • Offline Offline
  • Posts: 17
Re: sql_authentication with remote database?
« Reply #4 on: February 20, 2014, 03:36:13 PM »

I use sql_authentication with remote database.

You only change the server option.


   mysql
          {
              /* The name of this service. */
              name = "mysql/main"
              database = "anope"
              server = "remote.database.host"
              username = "anope"
              password = "mypassword"
             port = 3306
           }

In the remote server "remote.database.host" check that you are listening on your host IP.

Maybe mysqld is listening only on localhost.

« Last Edit: February 20, 2014, 03:52:36 PM by Borja »
Logged

Francesco

  • Anope User
  • Offline Offline
  • Gender: Male
  • Posts: 15
  • Il Caius
    • Caius' Site
Re: sql_authentication with remote database?
« Reply #5 on: February 20, 2014, 06:27:25 PM »

Maybe mysqld is listening only on localhost.

In fact it was so :D
Thanks a lot!
Pages: [1]   Go Up