Jump to content
  • 0

Can’t Connect To MySQL Server


nickyb

Question


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   1
  • Joined:  07/22/12
  • Last Seen:  

For some reason I can’t get rathena to connect to the MySQL server I configured using either localhost or 127.0.0.1. I don’t have any issues connecting to the ragnarok DB locally or remotely from another pc using workbench with the same credentials that are set in the conf files.

Rathena is setup on a dedicated windows server 2016 and I’m using the latest MySQL version 8.x.

[01:43 AM][SQL]: SSL connection error: unknown error number
[01:43 AM][Error]: Couldn't connect with uname='xxxxx',host='127.0.0.1',port='3306',database='ragnarok'

Update:

I've since reconfigured the MySQL server to allow for legacy authentication for 5.x compatibility. I also tried to force as well as remove SSL connection requirements, but regardless I'm still getting the same error on all three servers. 

 

Update #2:

Still have not resolved this issue or determined the cause of the communication error. By all accounts there is no issue with the sql server as I am able to connect to it both locally and remotely with the same credentials via workbench. As previously mentioned I ensured there was also backwards compatibility to 5.x and tried enabling/disabling SSL. At this point I'm beginning to review how the servers establish a connection to the MySQL server:

sql.ccp

/**
 * Establishes a connection to schema
 * @param self : sql handle
 * @param user : username to access
 * @param passwd : password
 * @param host : hostname
 * @param port : port
 * @param db : schema name
 * @return 
 */
int Sql_Connect(Sql* self, const char* user, const char* passwd, const char* host, uint16 port, const char* db)
{
	if( self == NULL )
		return SQL_ERROR;

	StringBuf_Clear(&self->buf);
	if( !mysql_real_connect(&self->handle, host, user, passwd, db, (unsigned int)port, NULL/*unix_socket*/, 0/*clientflag*/) )
	{
		ShowSQL("%s\n", mysql_error(&self->handle));
		return SQL_ERROR;
	}

	self->keepalive = Sql_P_Keepalive(self);
	if( self->keepalive == INVALID_TIMER )
	{
		ShowSQL("Failed to establish keepalive for DB connection!\n");
		return SQL_ERROR;
	}

	return SQL_SUCCESS;
}

  

Edited by nickyb
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   1
  • Joined:  07/22/12
  • Last Seen:  

Since everything is hosted locally I was able to resolve this by adding an option in sql.ccp to disable ssl.

Sql* Sql_Malloc(void)
{
    Sql* self;

    CREATE(self, Sql, 1);
    mysql_init(&self->handle);
    StringBuf_Init(&self->buf);
    self->lengths = NULL;
    self->result = NULL;
    self->keepalive = INVALID_TIMER;
    my_bool reconnect = 1;
    int sslmode = 1;
    mysql_options(&self->handle, MYSQL_OPT_RECONNECT, &reconnect);
    mysql_options(&self->handle, MYSQL_OPT_SSL_MODE, &sslmode);
    return self;
}

 

Edited by nickyb
  • MVP 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...