• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[TFS 0.3.6] [8.60] Mysql Error

jeffaklumpen

Member
Joined
Jan 20, 2022
Messages
76
Solutions
2
Reaction score
15
GitHub
jeffaklumpen
I've launched a new OT server on a vps machine. Everything's been working fine for a couple of days but all of a sudden I've been getting this error:

Failed connecting to database - MYSQL ERROR: Can't connect to MySQL server on 'localhost' (10061) (2003)

The weird thing is that I get this problem at random a while after the server has been online. Sometimes it's a couple of hours in and sometimes a couple of minutes. People can log on and play and then all of a sudden this happens.

Config.lua

sqlType = "mysql"
sqlHost = "127.0.0.1"
sqlPort = 3306
sqlUser = "xxxxx"
sqlPass = "xxxxx"
sqlDatabase = "xxxxx"
sqlFile = "forgottenserver.s3db"
sqlKeepAlive = 0
mysqlReadTimeout = 10
mysqlWriteTimeout = 10
encryptionType = "sha1"

Config.php

$config['sqlUser'] = 'xxxxx';

$config['sqlPassword'] = 'xxxxx';

$config['sqlDatabase'] = 'xxxxx';

$config['sqlHost'] = '127.0.0.1';


I have searched the forums and could not find anything that would solve my problem. I'm using Uniserver.
 
Solution
I think I know why this error occurs now.. everytime I do a server save I get the error:

Failed connecting to database - MYSQL ERROR: Can't connect to MySQL server on 'localhost' (10061) (2003)

The server is very new so there's not much that has been lost, I've got a backup I've used to reset. But I don't know why MySQL always crashes when I do a server save.
Post automatically merged:

Hmm ok.. I think I might have solved it, I'm not 100% sure though. So I'm hosting the server on a VPS and thought to myself "Hmm, how nice would it be to store the server in a Pcloud folder so that I easily can edit the server via my own personal computer".

I think that messed it up because now that I moved the server to the desktop it's working to save...
I've launched a new OT server on a vps machine. Everything's been working fine for a couple of days but all of a sudden I've been getting this error:

Failed connecting to database - MYSQL ERROR: Can't connect to MySQL server on 'localhost' (10061) (2003)

The weird thing is that I get this problem at random a while after the server has been online. Sometimes it's a couple of hours in and sometimes a couple of minutes. People can log on and play and then all of a sudden this happens.

Config.lua

sqlType = "mysql"
sqlHost = "127.0.0.1"
sqlPort = 3306
sqlUser = "xxxxx"
sqlPass = "xxxxx"
sqlDatabase = "xxxxx"
sqlFile = "forgottenserver.s3db"
sqlKeepAlive = 0
mysqlReadTimeout = 10
mysqlWriteTimeout = 10
encryptionType = "sha1"

Config.php

$config['sqlUser'] = 'xxxxx';

$config['sqlPassword'] = 'xxxxx';

$config['sqlDatabase'] = 'xxxxx';

$config['sqlHost'] = '127.0.0.1';


I have searched the forums and could not find anything that would solve my problem. I'm using Uniserver.

The error above means that your request to connect to the MySQL server has been refused.
Most likely cause is that you haven't installed the MySQL as a service.

 
This can happen from a few things. Do you have your server posted on any server lists? If you got DDOS'd it could cause this.
 
This can happen from a few things. Do you have your server posted on any server lists? If you got DDOS'd it could cause this.
Hmm that might be it because I can connect to the database and the server is running fine for some time and then this happens. Although I cant find MySQL as a service when the server is running. But I can't find a guide for settings up an OT that says anything about installing MySQL as a service? Isn't that somehow included in Uniserver when running MySQL from there?

The server is listed on otservlist. How can you protect against DDOS? I'm using Contabo VPS
 
Last edited:
Hmm that might be it because I can connect to the database and the server is running fine for some time and then this happens. Although I cant find MySQL as a service when the server is running. But I can't find a guide for settings up an OT that says anything about installing MySQL as a service? Isn't that somehow included in Uniserver when running MySQL from there?

The server is listed on otservlist. How can you protect against DDOS? I'm using Contabo VPS
Yeah he assumed you were on linux probably regarding the mysql. The host would have to have ddos protection, there are some things you can do but pretty limited. If your server is on otservlist 100% it is getting ddos'd im not sure if its the otservlist owner or just someone that watches it but that has always been a problem.
 
Yeah he assumed you were on linux probably regarding the mysql. The host would have to have ddos protection, there are some things you can do but pretty limited. If your server is on otservlist 100% it is getting ddos'd im not sure if its the otservlist owner or just someone that watches it but that has always been a problem.
Contabo says they have DDOS protection but I'm guessing it's not Fort Knox level?

Any tips on anything I can do, however small it is?
 
Last edited:
Contabo says they have DDOS protection but I'm guessing it's not Fort Knox level?

Any tips on anything I can do, however small it is?
I would try running the server, when the error happens, try to access your website and also try to access a website like google. If you can't connect to either then it probably is a ddos. Report the results here.

Also if you have added any code to the source files say so. While you wait for the error to happen you can check all the source files for the error and see the code that is causing it. Search for: error connecting to database
 
I would try running the server, when the error happens, try to access your website and also try to access a website like google. If you can't connect to either then it probably is a ddos. Report the results here.
The website is always down when this happens, I haven't tried normal websites though so I will do that!

I also noticed that I had opened port 3306, could it be because of that? I have closed it now.
 
The website is always down when this happens, I haven't tried normal websites though so I will do that!

I also noticed that I had opened port 3306, could it be because of that? I have closed it now.
Reload this page and read my last post, i added some to it. Opening port 3306 wouldn't change anything as it should be open (assuming the host has standard ports open). Otherwise you have to open it anyway so if its an issue you would have to address it in a different way.
 
I would try running the server, when the error happens, try to access your website and also try to access a website like google. If you can't connect to either then it probably is a ddos. Report the results here.

Also if you have added any code to the source files say so. While you wait for the error to happen you can check all the source files for the error and see the code that is causing it. Search for: error connecting to database
Hmm what are the source files exactly? I don't think I have messed with the engine files for Uniserver if it's those you mean?
 
I think I have messed up the server. Everything worked fine for a couple of hours when I decided to do a server save through the TFS console. The moment I did that the MySQL server crashed, so I restarted the server, then a couple of minutes in it crashed again and the log said something about "error saving (charactername)".

So I tried restarting it again but this time I cant even get the MySQL server running. No matter what I do I always get this error now:

Failed to connect to MySQL: (2002) No connection could be made because the target machine actively refused it.

I think the database has been corrupted somehow :/
 
I think I have messed up the server. Everything worked fine for a couple of hours when I decided to do a server save through the TFS console. The moment I did that the MySQL server crashed, so I restarted the server, then a couple of minutes in it crashed again and the log said something about "error saving (charactername)".

So I tried restarting it again but this time I cant even get the MySQL server running. No matter what I do I always get this error now:

Failed to connect to MySQL: (2002) No connection could be made because the target machine actively refused it.

I think the database has been corrupted somehow :/
DO BACKUP (phpmyadmin 'Export' or mysqldump)
I can help you to reinstall and reconfigure mysql tommorow. Contact me on Discord: Gesior.pl#3208
 
I think I know why this error occurs now.. everytime I do a server save I get the error:

Failed connecting to database - MYSQL ERROR: Can't connect to MySQL server on 'localhost' (10061) (2003)

The server is very new so there's not much that has been lost, I've got a backup I've used to reset. But I don't know why MySQL always crashes when I do a server save.
Post automatically merged:

Hmm ok.. I think I might have solved it, I'm not 100% sure though. So I'm hosting the server on a VPS and thought to myself "Hmm, how nice would it be to store the server in a Pcloud folder so that I easily can edit the server via my own personal computer".

I think that messed it up because now that I moved the server to the desktop it's working to save the server and things run more smoothly. I'll let it run for a while just to make sure.

Feel kinda stupid if this was the solution...
 
Last edited:
Solution

Similar threads

Back
Top