[mythtv-users] mythtv-users Digest, Vol 104, Issue 14

Damian myth at surr.co.uk
Sun Nov 6 14:01:46 UTC 2011


On 05/11/2011 21:24, mythtv-users-request at mythtv.org wrote:
> Date: Sat, 05 Nov 2011 13:09:43 +0000
> From: Robert Longbottom<rongblor at googlemail.com>
> Subject: Re: [mythtv-users] Upgraded the Ubuntu 11.10 and not Myth
> 	can't connect to MySQL
> To:mythtv-users at mythtv.org
> Message-ID:<4EB53597.8020309 at googlemail.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> On 05/11/2011 11:45, Damian wrote:
>> >  :-)  Thanks Geoff, Bill and John for helping out.
> I'll start by saying I've not been following this, but here goes with a
> few suggestions...
>
>> >  Here's the latest. I've done a lot, and think I've got enough to clarify
>> >  the problem a bit to 'those of you who know', but I'm at the edge of my
>> >  understanding again. Here's where it's at ....
>> >
>> >  Both mysql.txt and config.xml contain '192.168.0.2' rather than
>> >  'MythBox', but I think I need to fix my bigger problems with mysql
>> >  before I start messing with the MythTV setup. I can't currently log into
>> >  mysql as root, so trying to fix anything further down the line seems futile.
>> >
>> >  I did run:
>> >  /var/run$ chown -R mysql:mysql mysql
>> >  but this just responded:
>> >  chown: cannot access `mysql': No such file or directory
>> >
>> >  Should one of those 'mysql's have been 'mysqld'? I assume so, but I
>> >  don't know which one.
> Yes, that last one should be mysqld - thats the directory name and the
> command is changing the ownership of that directory to the mysql user
> and group.  Check it's worked with 'ls -la /var/run/mysqld' - you should
> see all file (except the ".." owned by mysql)
>
>> >  I've just had a look at the /var/run/mysqld folder, and it looks
>> >  completely empty. That doesn't seem like a good thing!???
> Thats fine.  It should be empty when mysql isn't running (which it looks
> like it isn't from some of the output you've posted below.
>
>> >  Have I not even got mysql installed properly anymore?? This is just
>> >  weird. How can an 'upgrade' break things so badly??
>> >
>> >  Found this thread:
>> >
>> >  http://ubuntuforums.org/showthread.php?t=1601420
>> >
>> >  $ sudo chown -R mysql:mysql /var/lib/mysql
>> >  Then rebooted
>> >
>> >
>> >  $ sudo service mysql status
>> >  mysql respawn/post-start, (post-start) process 3234
>> >
>> >
>> >  $ mysql -u mythtv -pmythtv mythconverg
>> >  ERROR 2002 (HY000): Can't connect to local MySQL server through socket
>> >  '/var/run/mysqld/mysqld.sock' (2)
>> >
>> >  $ ps -A | grep mysql
>> >  Returns nothing
> ^-- looks like the mysql service is failing to start correctly.
>
>> >  Tried running mysqld out of bin:
>> >
>> >  /usr/bin$ mysqld
>> >  111105 11:19:20 [Warning] option 'net_buffer_length': unsigned value
>> >  8388608 adjusted to 1048576
>> >  111105 11:19:20 [Warning] Can't create test file
>> >  /var/lib/mysql/MythBox.lower-test
>> >  111105 11:19:20 [Warning] Can't create test file
>> >  /var/lib/mysql/MythBox.lower-test
>> >  mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13)
>> >  111105 11:19:20 [ERROR] Aborting
>> >
>> >  111105 11:19:20 [Note] mysqld: Shutdown complete
>> >
>> >  Tried running mysqld_safe out of bin:
>> >
>> >  /usr/bin$ mysqld_safe
>> >  111105 11:21:25 mysqld_safe Logging to syslog.
>> >  111105 11:21:25 mysqld_safe Starting mysqld daemon with databases from
>> >  /var/lib/mysql
>> >  rm: cannot remove `/var/lib/mysql/MythBox.pid': Permission denied
>> >  111105 11:21:25 mysqld_safe mysqld from pid file
>> >  /var/lib/mysql/MythBox.pid ended
>> >
>> >  Im I getting somewhere here? Maybe the hole problem is just down to
>> >  permissions? Or maybe it's permissions and paswords have been changed?
>> >  One thing at a time. What should the permissions on these folders be and
>> >  how do I change them?
> Trying to run mysql under your user account (or root) will cause issues
> with permissions because either you wont have access to the mysql files,
> or if you run it as root, then it will create some files that it then
> wont be able to access when you run it as a service because then it will
> (should) run under the mysql user.
>
>> >  I'm learning, but not enough:-)
>> >
>> >  There's this sequence suggested by the guy on the forum thread from last
>> >  year...
>> >         purge and reinstall mysql server
>> >         chgrp -R mysql/var/lib/mysql/
>> >         Check if mysql can run in savemode: /usr/bin: mysqld_safe
>> >         Somehow I lost my mysql.conf for upstart. So recreate it and paste
>> >  exec sudo -u mysql /usr/sbin/mysqld #<- important execute as use mysql
>> >
>> >  but I don't even understand all of that, let alone have confidence in
>> >  accieving it. Nor do I know if it will kill any database I once had
>> >  (which I'm hoping I can keep if possible, although I am losing hope that
>> >  it even exists any more).
>> >
>> >  The last thing I did was follow bills advice and run the 'post-start
>> >  script' from /etc/init/mysql.conf maually on the command line. Here's
>> >  the results:
>> >
>> >  $ for i in `seq 1 30` ; do
>> >     >   /usr/bin/mysqladmin --defaults-file="${HOME}"/debian.cnf ping&&   {
>> >     >   exec "${HOME}"/debian-start
>> >     >   # should not reach this line
>> >     >               exit 2
>> >     >           }
>> >     >           sleep 1
>> >     >       done
>> >  Could not open required defaults file: /home/damian/debian.cnf
>> >  Fatal error in defaults handling. Program aborted
>> >  /usr/bin/mysqladmin: connect to server at 'localhost' failed
>> >  error: 'Can't connect to local MySQL server through socket
>> >  '/var/run/mysqld/mysqld.sock' (2)'
>> >  Check that mysqld is running and that the socket:
>> >  '/var/run/mysqld/mysqld.sock' exists!
>> >  Could not open required defaults file: /home/damian/debian.cnf
>> >  Fatal error in defaults handling. Program aborted
>> >  /usr/bin/mysqladmin: connect to server at 'localhost' failed
>> >  error: 'Can't connect to local MySQL server through socket
>> >  '/var/run/mysqld/mysqld.sock' (2)'
>> >  Check that mysqld is running and that the socket:
>> >  '/var/run/mysqld/mysqld.sock' exists!
>> >  etc etc repeat to infinity
>> >
>> >  I then tried Bill's test to see if my mythconverg database was still
>> >  there .. and I think it is!:-)  Here's the results:
>> >
>> >  $ sudo -i
>> >  root at MythBox:~#    cd /var/lib/mysql/mythconverg
>> >  root at MythBox:/var/lib/mysql/mythconverg#    ls -l
>> >  total 19748
>> >  -rw-rw---- 1 mysql mysql    9255 2011-05-09 07:53 archiveitems.frm
>> >  -rw-rw---- 1 mysql mysql       0 2011-10-27 08:11 archiveitems.MYD
>> >  -rw-rw---- 1 mysql mysql    2048 2011-10-27 08:11 archiveitems.MYI
>> >  -rw-rw---- 1 mysql mysql    8630 2011-05-09 07:53 callsignnetworkmap.frm
>> >  -rw-rw---- 1 mysql mysql       0 2011-10-27 08:11 callsignnetworkmap.MYD
>> >  -rw-rw---- 1 mysql mysql    1024 2011-10-27 08:11 callsignnetworkmap.MYI
>> >  -rw-rw---- 1 mysql mysql    9752 2011-05-09 07:53 capturecard.frm
>> >  -rw-rw---- 1 mysql mysql     328 2011-10-27 08:11 capturecard.MYD
>> >  and lots more of this .. as expected.
> Looks like your db is there, which is a good start.  I'd say that
> following the complete remove and reinstall risks loosing that.
>
>> >  Ok, my head hurts now. Where next?
> Have you checked the mysql log files in /var/log/mysql?  I'd suggest you
> go into /var/log/mysql, delete any existing log files (maybe take a copy
> elsewhere just in case).  Check that the /var/log/mysql directory is
> owned and writable by the mysql user.  Then try and start the mysql
> service.  Check to see if the process is running and then check the log
> files to see what they say.  So, commands something like this:
>
> # cd /var/log/mysql
>
> # sudo rm *.err *.log
>
> # ls -la /var/log/mysql
> Check that the . directory is owned by mysql and is writeable eg:
> robert at quad ~ $ ls -la/var/log/mysql/
> total 4872
> drwxr-xr-x  2 mysql mysql    4096 May 13 14:40 .
> drwxr-xr-x 19 root  root     4096 Nov  2 03:15 ..
>
> # sudo service mysql start (?? I assume this is how you start service on
> Ubuntu based on your postings above - I'm not a Ubuntu user, so I'm not
> familiar)
>
> Wait a few seconds
>
> # ps ax |grep -i mysql
>
> Based on your output above, I'd expect this to report that it isn't running.
>
> # cat/var/log/mysql/*.err/var/log/mysql/*.log
>
> And see what falls out.
>
> If it looks like permissions, post and much 'ls -la' output as you can
> from the various mysql directories including
> /var/run/mysql
> /var/log/mysql
> /var/lib/mysql
> /etc/mysql
>
> Hoepfully someone will be able to spot the problem
>
> Good luck!
> Robert.

Hi Robert,

Thanks for talking me though this. Here's the latest, following your 
instructions:

damian at MythBox:~$ ls -la /var/run/mysqld
total 0
drwxr-xr-x  2 mysql root   40 2011-11-05 11:04 .
drwxr-xr-x 26 root  root 1000 2011-11-05 11:04 ..

damian at MythBox:~$ cd /var/run
damian at MythBox:/var/run$ sudo chown -R mysql:mysql mysqld

damian at MythBox:/var/run$ ls -la /var/run/mysqld
total 0
drwxr-xr-x  2 mysql mysql   40 2011-11-05 11:04 .
drwxr-xr-x 26 root  root  1000 2011-11-05 11:04 ..

And then the rest:

damian at MythBox:/var/run$ cd /var/log/mysql
damian at MythBox:/var/log/mysql$ ls
error.log  error.log-old

I deleted both of these, then:

damian at MythBox:/var/log/mysql$ ls -la /var/log/mysql
total 8
drwxr-s---  2 mysql adm  4096 2011-11-06 13:42 .
drwxr-xr-x 22 root  root 4096 2011-11-06 07:40 ..

damian at MythBox:/var/log/mysql$ sudo service mysql start
mysql start/running

damian at MythBox:/var/log/mysql$ ps ax |grep -i mysql
30457 pts/1    S+     0:00 grep -i mysql

damian at MythBox:/var/log/mysql$ cat /var/log/mysql/*.err /var/log/mysql/*.log
cat: /var/log/mysql/*.err: No such file or directory
111106 13:42:33 [Note] Plugin 'FEDERATED' is disabled.
111106 13:42:33  InnoDB: Initializing buffer pool, size = 8.0M
111106 13:42:33  InnoDB: Completed initialization of buffer pool
111106 13:42:33  InnoDB: Started; log sequence number 0 20263543
111106 13:42:33 [ERROR] Can't start server : Bind on unix socket: 
Permission denied
111106 13:42:33 [ERROR] Do you already have another mysqld server 
running on socket: /var/run/mysqld/mysqld.sock ?
111106 13:42:33 [ERROR] Aborting

111106 13:42:33  InnoDB: Starting shutdown...
111106 13:42:39  InnoDB: Shutdown completed; log sequence number 0 20263543
111106 13:42:39 [Note] /usr/sbin/mysqld: Shutdown complete

111106 13:43:04 [Note] Plugin 'FEDERATED' is disabled.
111106 13:43:04  InnoDB: Initializing buffer pool, size = 8.0M
111106 13:43:04  InnoDB: Completed initialization of buffer pool
111106 13:43:04  InnoDB: Started; log sequence number 0 20263543
111106 13:43:04 [ERROR] Can't start server : Bind on unix socket: 
Permission denied
111106 13:43:04 [ERROR] Do you already have another mysqld server 
running on socket: /var/run/mysqld/mysqld.sock ?
111106 13:43:04 [ERROR] Aborting

111106 13:43:04  InnoDB: Starting shutdown...
111106 13:43:09  InnoDB: Shutdown completed; log sequence number 0 20263543
111106 13:43:09 [Note] /usr/sbin/mysqld: Shutdown complete

damian at MythBox:/var/log/mysql$ ls -la /var/run/mysql
ls: cannot access /var/run/mysql: No such file or directory

damian at MythBox:/var/log/mysql$ ls -la /var/run/mysqld
total 0
drwxr-xr-x  2 mysql mysql   40 2011-11-05 11:04 .
drwxr-xr-x 26 root  root  1000 2011-11-05 11:04 ..

damian at MythBox:/var/log/mysql$ ls -la /var/log/mysql
total 12
drwxr-s---  2 mysql adm  4096 2011-11-06 13:42 .
drwxr-xr-x 22 root  root 4096 2011-11-06 07:40 ..
-rw-rw----  1 mysql adm  1326 2011-11-06 13:43 error.log

damian at MythBox:/var/log/mysql$ ls -la /var/lib/mysql
ls: cannot open directory /var/lib/mysql: Permission denied

damian at MythBox:/var/log/mysql$ ls -la /etc/mysql
total 36
drwxr-xr-x   3 root root  4096 2011-10-29 17:59 .
drwxr-xr-x 209 root root 12288 2011-11-05 11:04 ..
drwxr-xr-x   2 root root  4096 2011-11-01 23:30 conf.d
-rw-------   1 root root   312 2008-11-11 14:23 debian.cnf
-rwxr-xr-x   1 root root  1220 2011-07-25 22:27 debian-start
-rw-r--r--   1 root root  3701 2011-10-29 17:59 my.cnf
-rw-r--r--   1 root root  3608 2010-10-22 21:01 my.cnf~

Does that help?

I feel like we're getting somewhere, but I've thought that before :-)

Damian


More information about the mythtv-users mailing list