For some reason my /var/run/ dir on debian6 had it’s chown and chmod changed. Problem is from what? Outcome is that mysql fails. I’m guessing the easiest way to fix is to reinstall MySQL. (Previously this LAMP was running fine.)
However, I have established databases and tables and don’t want to lose them. Since mysql is not running I can’t backup (correct?).
I just want to confirm that:
1). if I reinstall, I won’t loose my databases.
2). apt-get install mysql-server mysql-client
is the correct command to use.
Thanks.
EDIT:
/var/log/syslog output when running /etc/init.d/mysql start
:
mysqld_safe: Starting mysqld daemon with databases from /var/lib/mysql
mysqld: 130109 10:44:10 [Note] Plugin 'FEDERATED' is disabled.
mysqld: #007/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
mysqld: 130109 10:44:10 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
mysqld: 130109 10:44:10 InnoDB: The InnoDB memory heap is disabled
mysqld: 130109 10:44:10 InnoDB: Mutexes and rw_locks use GCC atomic builtins
mysqld: 130109 10:44:10 InnoDB: Compressed tables use zlib 1.2.3.4
mysqld: 130109 10:44:10 InnoDB: Using Linux native AIO
mysqld: 130109 10:44:10 InnoDB: Initializing buffer pool, size = 128.0M
mysqld: 130109 10:44:10 InnoDB: Completed initialization of buffer pool
mysqld: 130109 10:44:10 InnoDB: Operating system error number 13 in a file operation.
mysqld: InnoDB: The error means mysqld does not have the access rights to
mysqld: InnoDB: the directory.
mysqld: InnoDB: File name ./ibdata1
mysqld: InnoDB: File operation call: 'create'.
mysqld: InnoDB: Cannot continue operation.
mysqld_safe: mysqld from pid file /var/run/mysqld/mysqld.pid ended
/etc/init.d/mysql[4531]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
/etc/init.d/mysql[4531]: #007/usr/bin/mysqladmin: connect to server at 'localhost' failed
/etc/init.d/mysql[4531]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
/etc/init.d/mysql[4531]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
/etc/init.d/mysql[4531]:
it would be good to find out what really has happened; you can take a look at any other computer with the same OS and mysql installed and use chmod and chown to restore the expected rights and ownership.
quick look at a random debian server tells me:
root@serv:/var/run# ls -la /var/run/mysqld/*
total 12
drwxr-xr-x 2 mysql root 4096 Oct 24 13:29 .
drwxr-xr-x 14 root root 4096 Jan 9 01:28 ..
-rw-rw---- 1 mysql mysql 5 Oct 24 13:29 mysqld.pid
srwxrwxrwx 1 mysql mysql 0 Oct 24 13:29 mysqld.sock
so try first:
chown mysql:mysql /var/run/mysqld/*
chown mysql:root /var/run/mysqld
and appropriate chmods if needed
if you decide to re-install – be on the safe side:
- try to shut down cleanly mysql – if needed using regular kill and waiting
- copy all the data files [nut just few - eg not just the directory of one database; it might not be enough for innodb]
- copy all the config files
only then try to uninstall + reinstall
Check more discussion of this question.