"Connection failed! Connection unexpectedly terminated." during tv setup (1 Viewer)

Jman100

New Member
August 6, 2015
5
0
Home Country
United States of America United States of America
During TV setup with a windows 10 pc, when it attempts to connect, it throws that error, "Connection failed! Connection unexpectedly terminated.". I've tested the sql server directly and can login just fine, so I'm not sure what the issue is here.

Thanks,
Jman100
 

mm1352000

Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Hello and welcome! :)

    Did the MediaPortal installer install the SQL Server, or did you do it?
    If you installed SQL Server, have you ensured:
    1. There's no security software (eg. firewall) blocking the connection.
    2. The connection credentials are correct.
    3. The SQL Server account has permission to check whether a TV Server database/schema exists already, and create a new database if not.
     

    Jman100

    New Member
    August 6, 2015
    5
    0
    Home Country
    United States of America United States of America
    Hi!

    MediaPortal installed the SQL server. However while trying to fix the issue I went and downloaded MySQL5 myself and updated it successfully. I've checked, and everything is allowed through the firewall as necessary, connection credentials are correct, and the server account was set up by mediaportal so I assume that's also correct.
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    I'm starting to get rather confused.

    When using MediaPortal's TV Server, you have 2 choices of database:
    1. MySQL 5.x
    2. Microsoft SQL Server - often simply referred to as "SQL Server"
    When I read your first post I thought you were saying that you were attempting to use [Microsoft] SQL Server. I now think that you're saying you're attempting to use MySQL only. Please confirm.

    MediaPortal installed the SQL server.
    ...and this was when you got the connection error?

    However while trying to fix the issue I went and downloaded MySQL5 myself and updated it successfully.
    That's really not recommended unless you know your way around databases. By doing this you may have just made things a lot more complicated for yourself.

    I've checked, and everything is allowed through the firewall as necessary, connection credentials are correct and the server account was set up by mediaportal so I assume that's also correct.
    No, you've misunderstood the situation.

    MediaPortal doesn't set up an account unless it installs the database. You've told me that you installed the database, therefore MediaPortal has not installed the database... and therefore MediaPortal has not set up any account. In other words, you should not assume that anything is correct.

    With a self install you must choose one of 2 options, and configure appropriately.

    Option 1 - use default/built-in database administrator account ("root")
    This is not recommended for security reasons, however it is a little easier than option 2. The password will be whatever you chose/entered during MySQL installation. You must also configure the account to allow connections from all PCs which will run either MediaPortal or TV Server. When you see the "connection failed" error it means you haven't done one of:
    • corrected the password in the TV Server database configuration dialog
    • configured the MySQL account to allow connections from the PC that you're installing MediaPortal on

    Option 2 - create a new account
    This is the recommended option. If you're installing your own database then it's assumed that you know how to create a new user account and configure it appropriately.

    If you don't know how to do either of these things then it's a very good indication that you should not be attempting to install your own database. In this case I would recommend you full uninstall MediaPortal and MySQL and try to install MediaPortal from scratch. If you get stuck, report the problem and wait for assistance.
     

    Jman100

    New Member
    August 6, 2015
    5
    0
    Home Country
    United States of America United States of America
    I believe there's a bit of miscommunication here.

    MediaPortal installation fully installed MySQL5 itself. It made the user and everything. The issue arose at the SetupTV portion of the installation, on the "Setup database connection" window. MediaPortal installation made the root user with the default MediaPortal password and everything. I do know my way around databases, and when I say I tested it manually I mean i ran mysql.exe and logged in with the user and pass MediaPortal created.

    I did update MySQL5 and that may or may not have been bad but the issue was there before and after. The databases and all that updated fine using the MySQL5 installer (the root login worked for that installer).

    Microsoft SQL server has not been used at all during the entire process. I had no SQL server of any sort running or installed prior to running the MediaPortal installer. This is literally what your last sentence said, I installed from scratch and ran into this issue. The only odd thing I did was update MySQL5 AFTER MediaPortal installed it. The error was present before and after said update.

    Jman100
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Thanks for clarifying.

    Okay. The only reason you will see the "connection failed" message is because the installer (actually SetupTv.exe running after the installer completes) is unable to connect to the database with the credentials you supply.

    If you're familiar with code, it's here:
    https://github.com/MediaPortal/Medi...3/TVLibrary/SetupTv/SetupDatabaseForm.cs#L479

    When you see the connection failed message:
    1. Which field(s) are red - database name, server host name, or both?
    2. Are you using a host (computer) name or IP address? If using a host name, what happens if you try the IP address?
     

    Jman100

    New Member
    August 6, 2015
    5
    0
    Home Country
    United States of America United States of America
    1. Hostname is red, dependency is green, and everything else stays white.
    2. I am using host name, however the local IP shows the same error. Note the error is "connection unexpectedly terminated", so I know it's seeing the SQL server. When i put in gibberish (or if the sql server isnt running) it says "Unable to connect to any of the specified MySQL hosts."

    Screenshot attached of resulting window.

    I get the gist of what the code you linked is doing. It should be working, and I have no idea why it isn't.
     

    Attachments

    • sql.png
      sql.png
      22.6 KB

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    Not that it should make any difference, but did you change the "dependency" manually? That needs to match the Windows service name, which is usually MySQL5.

    Aside from that I'm stumped. As you say, this should work. To me the behaviour you describe along with the "connection unexpectedly terminated" does sound like a firewall may be [partially] getting in the way. That would be the thing I'd be looking at now.
     

    Jman100

    New Member
    August 6, 2015
    5
    0
    Home Country
    United States of America United States of America
    Dependency started off as MySQL5 and changes when I hit the Test button.

    I'll look around at anything that could be blocking this, and I'll post here if i figure it out. Thanks for your help![DOUBLEPOST=1438844794][/DOUBLEPOST]Well, this is interesting..

    I have a headless virtual environment (VirtualBox VM) that is used for web development for work. It must have been causing issues, because I shut down that VM and everything works now.

    I'm not sure how to use both at the same time though...is there a port I can change or something with the MediaPortal DB?
     
    Last edited:

    Users who are viewing this thread

    Top Bottom