Raised This Month: $ Target: $400
 0% 

Remote SQL connection problem.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NedStar
Senior Member
Join Date: Apr 2005
Location: The Netherlands
Old 05-07-2008 , 15:57   Remote SQL connection problem.
Reply With Quote #1

Hi,

I've been messing with this all day and sending some emails forward to my webhost but sadly they were unable to solve my problem.

First of all what I'm trying to do is:

Setup sourcemod SQL, I want to start using sql for my server (sql bans etc) so I figured starting of with getting the default system to work. Sql admins seems like a good thing to do, to make sure it works.

Now the problem is that I'm unable to connect to the database in anyway through sourcemod. When I try the sm_create_adm_tables command it simply gives me:

Code:
sql-admin-manager.smx] Could not connect to database: [2005]: Unknown MySQL server host 'remote-mysql3.servage.net' (1)
The SQL database I'm using is a MySQL 5.0 remote database that my webhost offers for remote purposes. I figured it was probably the fault of my webhost that it wasn't working but they didn't seem to found anything fishy or anything that would solve the problem.
So here I am.

What I've tried so far is:

Latest metamod build 1.4.3
Latest sourcemod build 1946
Another remote database ( same host )

Sourcemod itself is working fine I've been using it for a while now.
Also the database seems to work fine when I use a website and change the db to the remote one. This is on the same host though.

I'm not sure if I have to open any "special" ports for it to work or if they need to allow my IP address which I doubt is needed for the remote databases they use as they tell you its less secure.

Quote:
Warning - please note:
This database is hosted on a remotely accessible server as requested. In rare cases remote accessibility is required by your applications - there are however some major disadvantages:

* Slower.
* Less stability.
* Less security.

If you applications does not explicitly require remote access we strongly recommend using one of our normal MySQL servers which are hosted on a secure network.
My databases.cfg looks like this:

Code:
"Databases"
{
	"driver_default"		"mysql"
	
	"default"
	{
		"driver"			"default"
		"host"				"remote-mysql3.servage.net"
		"database"			"sourcemodicecave"
		"user"				"sourcemodicecave"
		"pass"				"****"
                "port"                           "3306"
	}
	
	"storage-local"
	{
		"driver"			"sqlite"
		"database"			"sourcemod-local"
	}
}
Furthermore the server is running on Linux Suse.
Any help would be greatly appreciated. Thanks in advance.

Greetings,

NedStar
__________________
NedStar is offline
Send a message via MSN to NedStar
teddyruxpin
Overseer of lost packets
Join Date: Feb 2008
Old 05-07-2008 , 16:47   Re: Remote SQL connection problem.
Reply With Quote #2

Can you even ping 'remote-mysql3.servage.net' from the command line of the host your trying to setup the mysql on. The errors you are seeing now state it cant find the hostname so it is likely either you have bad DNS resolvers setup on your game host or the host name they provided you does not work from your area for other reasons, Windows or Linux firewall, ISP cached resolver records, some anal security program on your host blocking the queries.

Code:
$ nslookup remote-mysql3.servage.net
Server:        192.168.10.15
Address:    192.168.10.15#53

Non-authoritative answer:
Name:    remote-mysql3.servage.net
Address: 77.232.65.3
I am able to resolve the host name myself from my remote site so I would start by looking at your local hosts configs or firewalls in between and see if there is anything blocking the DNS queries which are trying to resolve the host name your provider gave you.

Another option is to replace the hostname in your config file with the IP address of the host. So instead of using 'remote-mysql3.servage.net' use '77.232.65.3'

Make sure you also have your "GRANT"s setup correct for the remote site user and host IP to connect to your MySQL host otherwise you will more errors about no permission to connect. Do not use a stupid all encompassing wildcard either for the username and grants or the root mysql account.

IE do NOT do

GRANT ALL PRIVILEGES ON sourcemodicecave.* TO 'sourcemodicecave'@'%' IDENTIFIED BY 'superstrongpassword';

Instead do

GRANT ALL PRIVILEGES ON db_sourcemodicecave.* TO 'sourcemodicecave'@'192.168.1.100' IDENTIFIED BY 'superstrongpassword';

Even further I would drill down and not grant ALL privileges and only give it what it needs, IE READ, SELECT, UPDATE etc. Note I also changed the name of the DB in my example to keep things easier to debug. Having the same username and database name can get very confusing when your trying to debug issues late at night with little sleep.

Also keep in mind when using a remote mysql host it WILL slow down your game host and connections of players. Each time a player event occurs where the DB needs to be updated their is a small chance there could be some sort of network issue or similar that prevents that update and if the application is not written correct it will lock up your game waiting to update that record and will stay locked until it fails or times out.

-Teddy

Last edited by teddyruxpin; 05-07-2008 at 16:49.
teddyruxpin is offline
NedStar
Senior Member
Join Date: Apr 2005
Location: The Netherlands
Old 05-07-2008 , 17:26   Re: Remote SQL connection problem.
Reply With Quote #3

Thanks a bunch for the fast reply.

The problem is solved, it was indeed a DNS problem. Using the ip worked flawless. I would have never come up with that.

Also thanks for your security suggestions. I so far keep getting Access denied errors when trying to change any privileges I'll be looking into that more tomorrow.

Once again thanks a bunch, your help is greatly appreciated.

Greetings,

NedStar
__________________
NedStar is offline
Send a message via MSN to NedStar
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:07.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode