← Back to team overview

mythbuntu-bugs team mailing list archive

[Bug 1012376] [NEW] DBI connect failed: Access denied for user 'mythtv'@'localhost'

 

Public bug reported:

Hi -

Mythexport (on mythbuntu 12.04) fails to connect to the mysql database,
for some reason I cannot work out. The ~/.mythtv/config.xml is set up
correctly (mythtv itself works fine), and I can successfully browse the
database in phpMyAdmin by using the same authentication credentials. Yet
when I do "sudo /etc/init.d/mythexport start", this is the kind of thing
that appears in /var/log/mythtv/mythexport.log:

-------------
June 12 21:22:50 dan-mythbox /usr/bin/mythexport-daemon[5643]: Starting Processing:  1339532570
DBI connect('database=mythconverg:host=localhost;port=3306','mythtv',...) failed: Access denied for user 'mythtv'@'localhost' (using password: YES) at /usr/share/perl5/MythTV.pm line 351
June 12 21:22:50 dan-mythbox /usr/bin/mythexport-daemon[5643]: Can't connect to MythTV: Cannot connect to database:
 at line 88 in /usr/bin/mythexport-daemon
June 12 21:22:50 dan-mythbox /usr/bin/mythexport-daemon[5643]: Sleeping 5 seconds...  hostname dan-mythbox, myth->dbh  at line 89 in /usr/bin/mythexport-daemon
DBI connect('database=mythconverg:host=localhost;port=3306','mythtv',...) failed: Access denied for user 'mythtv'@'localhost' (using password: YES) at /usr/share/perl5/MythTV.pm line 351
June 12 21:22:55 dan-mythbox /usr/bin/mythexport-daemon[5643]: Can't connect to MythTV: Cannot connect to database:
 at line 88 in /usr/bin/mythexport-daemon
June 12 21:22:55 dan-mythbox /usr/bin/mythexport-daemon[5643]: Sleeping 5 seconds...  hostname dan-mythbox, myth->dbh  at line 89 in /usr/bin/mythexport-daemon
--------------

I made a test script based on the mythexport code, as follows:

#!/usr/bin/perl

use strict;
use POSIX qw(setsid);
use DBI;
use DBD::mysql;
use Config::Simple;
use MythTV;
use Proc::Daemon;
use Proc::PID::File;
use Log::Dispatch;
use Log::Dispatch::File;
use Date::Format;
use File::Spec;
use File::Copy;
use XML::Writer;
use IO::File;

use lib '/usr/share/mythexport';
use lib '/usr/share/mythexport/configs';

print "Dan's test script\n";

our $HOSTNAME = `hostname`;
chomp $HOSTNAME;

my $connect = undef;
my $myth = undef;

my $tries = 5;
while ($connect == undef && --$tries > 0) {
    eval {
        $myth = new MythTV();
        # connect to database
        $connect = $myth->{'dbh'};
        1;
    } or do {
        logerror("Can't connect to MythTV: $@");
        logdebug("Sleeping 5 seconds...  hostname $HOSTNAME, myth->dbh ");
        sleep(5);
    };
}
if ($connect == undef) {
    die "Couldn't connect to MythTV.";
}
-------------------------


This script has no problems connecting (it prints out "Dan's test script" and nothing else). So why does mythexport choke? It seems mysterious! Any tips please?

** Affects: mythexport (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Mythbuntu
Bug Team, which is subscribed to mythexport in Ubuntu.
https://bugs.launchpad.net/bugs/1012376

Title:
  DBI connect failed: Access denied for user 'mythtv'@'localhost'

Status in “mythexport” package in Ubuntu:
  New

Bug description:
  Hi -

  Mythexport (on mythbuntu 12.04) fails to connect to the mysql
  database, for some reason I cannot work out. The ~/.mythtv/config.xml
  is set up correctly (mythtv itself works fine), and I can successfully
  browse the database in phpMyAdmin by using the same authentication
  credentials. Yet when I do "sudo /etc/init.d/mythexport start", this
  is the kind of thing that appears in /var/log/mythtv/mythexport.log:

  -------------
  June 12 21:22:50 dan-mythbox /usr/bin/mythexport-daemon[5643]: Starting Processing:  1339532570
  DBI connect('database=mythconverg:host=localhost;port=3306','mythtv',...) failed: Access denied for user 'mythtv'@'localhost' (using password: YES) at /usr/share/perl5/MythTV.pm line 351
  June 12 21:22:50 dan-mythbox /usr/bin/mythexport-daemon[5643]: Can't connect to MythTV: Cannot connect to database:
   at line 88 in /usr/bin/mythexport-daemon
  June 12 21:22:50 dan-mythbox /usr/bin/mythexport-daemon[5643]: Sleeping 5 seconds...  hostname dan-mythbox, myth->dbh  at line 89 in /usr/bin/mythexport-daemon
  DBI connect('database=mythconverg:host=localhost;port=3306','mythtv',...) failed: Access denied for user 'mythtv'@'localhost' (using password: YES) at /usr/share/perl5/MythTV.pm line 351
  June 12 21:22:55 dan-mythbox /usr/bin/mythexport-daemon[5643]: Can't connect to MythTV: Cannot connect to database:
   at line 88 in /usr/bin/mythexport-daemon
  June 12 21:22:55 dan-mythbox /usr/bin/mythexport-daemon[5643]: Sleeping 5 seconds...  hostname dan-mythbox, myth->dbh  at line 89 in /usr/bin/mythexport-daemon
  --------------

  I made a test script based on the mythexport code, as follows:

  #!/usr/bin/perl

  use strict;
  use POSIX qw(setsid);
  use DBI;
  use DBD::mysql;
  use Config::Simple;
  use MythTV;
  use Proc::Daemon;
  use Proc::PID::File;
  use Log::Dispatch;
  use Log::Dispatch::File;
  use Date::Format;
  use File::Spec;
  use File::Copy;
  use XML::Writer;
  use IO::File;

  use lib '/usr/share/mythexport';
  use lib '/usr/share/mythexport/configs';

  print "Dan's test script\n";

  our $HOSTNAME = `hostname`;
  chomp $HOSTNAME;

  my $connect = undef;
  my $myth = undef;

  my $tries = 5;
  while ($connect == undef && --$tries > 0) {
      eval {
          $myth = new MythTV();
          # connect to database
          $connect = $myth->{'dbh'};
          1;
      } or do {
          logerror("Can't connect to MythTV: $@");
          logdebug("Sleeping 5 seconds...  hostname $HOSTNAME, myth->dbh ");
          sleep(5);
      };
  }
  if ($connect == undef) {
      die "Couldn't connect to MythTV.";
  }
  -------------------------

  
  This script has no problems connecting (it prints out "Dan's test script" and nothing else). So why does mythexport choke? It seems mysterious! Any tips please?

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mythexport/+bug/1012376/+subscriptions


Follow ups

References