Forum

Results 1 to 3 of 3
  1. #1
    Join Date
    January 2013
    Posts
    4

    Ubuntu 16.04 LTS mysql_real_connect() failed

    Hello,

    I switched my server from a well running Ubuntu 14.04 LTS to Ubuntu 16.04 LTS. My Teamspeakserver is running well on both systems using Mariadb as backend.

    At the moment I am having troubles to configure the Teamspeak-server to start on boot.

    I created some new SystemD script to start it. Butt all I get on boot is the message that the mariadb server is not available:
    Code:
    2016-07-12 18:16:26.059307|ERROR   |DatabaseQuery |   |mysql_real_connect() failed with error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    2016-07-12 18:16:26.059406|CRITICAL|ServerLibPriv |   |Server() unable to initialize database
    After that I changed my systemd script to start as late as possible (see script below). But nothing changed.

    My question is if anyone had this problem and if there is any solution for it.

    (To start/stop/restart and control the teamspeakserver I am using https://gameservermanagers.com/lgsm/ts3server/ which is working very good. I also tried using the "ts3server_startscript.sh" and the "ts3server_minimal_runscript.sh" - but no changes.)

    /lib/systemd/system/ts3.service:
    Code:
    [Unit]
    Description=Team Speak 3 Server
    After=network.target
    
    [Service]
    WorkingDirectory=/home/teamspeak/
    User=teamspeak
    Group=teamspeak
    Type=forking
    ExecStart=/home/teamspeak/ts3server start
    ExecStop=/home/teamspeak/ts3server stop
    PIDFile=/home/teamspeak/serverfiles/ts3server.pid
    #RestartSec=15
    #Restart=always
    
    [Install]
    WantedBy=graphical.target

  2. #2
    Join Date
    January 2013
    Posts
    4
    Just one small information:

    The only thing what is working is to set:
    Code:
    RestartSec=15
    Restart=always
    But for me this is really ugly ... trying to start as long as there is no error left ...

  3. #3
    Join Date
    February 2012
    Location
    Germany
    Posts
    571
    If you want that your Teamspeak unit is started after the Mariadb server, add this to your unit file:
    Code:
    [unit]
    After=mariadb.service
    In your current setup both are independent, so their starting order is undefined.

    By the way, you don't need to call any start scripts on systemd. Just start the Teamspeak server directly.
    Use a unit file like this:

    Code:
    [Unit]
    Description=TeamSpeak 3 Server
    After=nss-lookup.target network.target
    After=mariadb.service
    
    [Service]
    User=teamspeak
    WorkingDirectory=/home/teamspeak
    ExecStart=<insert teamspeak path>/ts3server inifile=<insert ini path>/ts3server.ini
    Restart=on-failure
    
    [Install]
    WantedBy=multi-user.target
    In this example, <insert teamspeak path>/ts3server is the real Teamspeak server binary, not any start script.
    The nss-lookup.target is somewhat important, because if you own a NPL license, the Teamspeak server tries to validate it on startup with the license server, and this works only if DNS name resolution is available, which nss-lookup.target ensures.
    You don't need to define any stop command as well, because systemd sends a SIGTERM per default to processes to stop them, and this is exactly what makes Teamspeak stop gracefully.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 12
    Last Post: September 1st, 2014, 05:20 AM
  2. mysql_real_connect() failed with error
    By bigmonmulgrew in forum Server Support
    Replies: 4
    Last Post: August 9th, 2014, 10:58 PM
  3. Replies: 14
    Last Post: August 10th, 2010, 03:41 PM
  4. [CRITICAL] Server crash (db_exec failed and assertion failed)
    By Slater in forum Bug Reports [EN/DE]
    Replies: 8
    Last Post: August 10th, 2010, 09:36 AM
  5. [Ubuntu 10.04] "converting bind() IP failed"
    By Hertog_Jan in forum Linux / FreeBSD
    Replies: 5
    Last Post: July 21st, 2010, 08:51 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •