Anope IRC Services

Anope Support => 2.0.x/1.9.x Support => Topic started by: Francesco on February 19, 2014, 02:40:37 PM

Title: sql_authentication with remote database?
Post by: Francesco 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
Title: Re: sql_authentication with remote database?
Post by: LEthaLity 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.
Title: Re: sql_authentication with remote database?
Post by: Jens Voss 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"
....
Title: Re: sql_authentication with remote database?
Post by: Francesco 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"?
Title: Re: sql_authentication with remote database?
Post by: Borja 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.

Title: Re: sql_authentication with remote database?
Post by: Francesco on February 20, 2014, 06:27:25 PM
Maybe mysqld is listening only on localhost.

In fact it was so :D
Thanks a lot!