I’m trying to set up a database using mariadb on a newly installed openSUSE 12.3. The initialization script “mysql_install_db” seems to run correctly, but when I try to run “mysql_secure_installation” either as myself or using sudo, it fails with the message:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)
Trying to run mysqld_safe produces a similar set of messages:
130425 10:05:55 mysqld_safe Logging to '/var/log/mysql/mysqld.log'.
touch: cannot touch ‘/var/log/mysql/mysqld.log’: No such file or directory
chmod: cannot access ‘/var/log/mysql/mysqld.log’: No such file or directory
touch: cannot touch ‘/var/log/mysql/mysqld.log’: No such file or directory
chown: cannot access ‘/var/log/mysql/mysqld.log’: No such file or directory
130425 10:05:55 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/bin/mysqld_safe: line 132: /var/log/mysql/mysqld.log: No such file or directory
/usr/bin/mysqld_safe: line 176: /var/log/mysql/mysqld.log: No such file or directory
touch: cannot touch ‘/var/log/mysql/mysqld.log’: No such file or directory
chown: cannot access ‘/var/log/mysql/mysqld.log’: No such file or directory
chmod: cannot access ‘/var/log/mysql/mysqld.log’: No such file or directory
130425 10:05:55 mysqld_safe mysqld from pid file /var/lib/mysql/h210087.nist.gov.pid ended
/usr/bin/mysqld_safe: line 132: /var/log/mysql/mysqld.log: No such file or directory
Does anyone recognize what’s going on here? It looks a bit like a permissions error, but as I say, this is a brand new install of 12.3, and I seem to vaguely recall that akonadi uses mysql/mariadb so on the whole I’d have expected it to be set up correctly by the install process?
Oh, right, thanks. Obvious thing to do. It fails thusly:
SYSTEMID:/home/baum # systemctl start mysql
Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -n' for details.
SYSTEMID:/home/baum # systemctl status mysql.service
mysql.service - LSB: Start the MySQL database server
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: exit-code) since Thu, 2013-04-25 11:03:54 EDT; 21s ago
Process: 14491 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/mysql.service
Apr 25 11:03:24 SYSTEMID systemd[1]: Starting LSB: Start the MySQL database server...
Apr 25 11:03:54 SYSTEMID mysql[14491]: Starting service MySQL warning: /var/run/mysql/mysql.sock didn't appear within 30 seconds
Apr 25 11:03:54 SYSTEMID mysql[14491]: chmod: cannot access '/var/run/mysql/mysqld.pid': No such file or directory
Apr 25 11:03:54 SYSTEMID mysql[14491]: ..failed
Apr 25 11:03:54 SYSTEMID systemd[1]: Failed to start LSB: Start the MySQL database server.
Apr 25 11:03:54 SYSTEMID systemd[1]: Unit mysql.service entered failed state
Yes, that’s sort of interesting. There is a** /var/log/mysql/mysqld.log** which so far only seems to get used when I try to run mysqld_safe. This is what I get:
130425 12:09:15 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
130425 12:09:15 [ERROR] mysqld: File './mysql-bin.index' not found (Errcode: 13)
130425 12:09:15 [ERROR] Aborting
130425 12:09:15 [Note] /usr/sbin/mysqld: Shutdown complete
130425 12:09:15 mysqld_safe mysqld from pid file /var/lib/mysql/XXX.XXX.XXX.pid ended
The intersting thing is that it whines about a missing file: /var/lib/mysql/mysql-bin.index
but that file exists. You know, all the folders and files in /var/lib/mysql are owned by root:root, which seems maybe doubtful. Shouldn’t they be owned by user and group mysql?
Yeah, I guess that’s the reason why it can’t open it.
On my system all the files in /var/lib/mysql/ (and the directory itself) are owned by mysql:mysql.
I suggest you just remove the whole directory /var/lib/mysql/ and start mysql with “systemctl start mysql”.
It should then recreate the directory (and hopefully work )…
Oh happy dayz, that does seem to have been the problem. I went in as root and recursively chown’d the mysql directory in /var/lib to mysql:mysql. Also, I had to close and restart the entire system for some reason difficult to explain. But once I’d done that the mysql daemon started itself happily and I was able to run the mysql_secure_installation routine without problem. Thank you wolfi323.
It does make me wonder, however, why this happened to me. :\ I’m certain I did not set all those files to owner root. That surely should have been handled by the mariadb install program. Unless maybe it’s that mysql_install_db routine that fargles the setup?
Well, I guess you started mysql_install_db as root and it created that directory as root then of course.
But the daemon runs as user mysql (for safety reasons) and couldn’t access it therefore.
Btw. the daemon should create it on its own when first started. You shouldn’t have needed to run mysql_install_db.
I never did on my systems anyway…
I would like to relativate this a bit: Do look at the manual, but don’t follow it blindly!
Especially if you don’t know who wrote it and under what circumstancies…
On 04/25/2013 11:36 PM, wolfi323 wrote:
> I would like to relativate this a bit: -Do- look at the manual, but
> don’t follow it blindly!
> Especially if you don’t know who wrote it and under what
> circumstancies…
or for which version of which distro!
you can be sure that there are many step-by-step how-tos written for
11.x that will almost work for 12.3, and other which will
absolutely not get close to working!!!
and, i’ve seen it here in the forums where some reference the man via
google (just put say “man fsck” in a google search blank) and then
use it…all the while, they have the manual for their version
of fsck right on their hard drive–and the one they pick from the
google list may be 5 or 15 years old and very wrong for their system…
i’ve not checked (because i would never use it), but following this
“man parted” http://linux.die.net/man/8/parted on your
machine may (or may not) destroy your data and system.