Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Unable to secure mysql/mariadb in 12.3 new installation

Hybrid View

  1. #1

    Default Unable to secure mysql/mariadb in 12.3 new installation

    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:

    Code:
    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:

    Code:
    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?

    Thanks,
    maab

  2. #2

    Default Re: Unable to secure mysql/mariadb in 12.3 new installation

    Is the daemon running? (akonadi does use mysql/mariadb but it starts its own private instance in the default setup)
    You can check this with:
    Code:
    systemctl status mysql
    It should show something like this if mysql is running:
    Code:
    mysql.service - LSB: Start the MySQL database server
              Loaded: loaded (/etc/init.d/mysql)
              Active: active (running) since Thu, 2013-04-25 08:13:59 CEST; 8h ago
             Process: 793 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)
              CGroup: name=systemd:/system/mysql.service
                      ├ 1322 /bin/sh /usr/bin/mysqld_safe --mysqld=mysqld --use...
                      └ 1675 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib...
    If it is not running, start it with (as root):
    Code:
    systemctl start mysql
    To always start it on boot:
    Code:
    systemctl enable mysql

  3. #3

    Default Re: Unable to secure mysql/mariadb in 12.3 new installation

    Oh, right, thanks. Obvious thing to do. It fails thusly:

    Code:
    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

  4. #4

    Default AW: Re: Unable to secure mysql/mariadb in 12.3 new installation

    Quote Originally Posted by maabaum View Post
    Oh, right, thanks. Obvious thing to do. It fails thusly:

    Code:
    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
    And what do "systemctl status mysql.sevice" and "journalctl -n" say?

  5. #5

    Default Re: Unable to secure mysql/mariadb in 12.3 new installation

    That's in there. Beginning at the third line of the code block, you'll see the call to

    systemctl status mysql.service

    what follows is the output. The lines that begin with a time stamp are gathered from the journalctl output, so they're basically the same.

  6. #6

    Default Re: Unable to secure mysql/mariadb in 12.3 new installation

    OK sorry, haven't looked good enough!
    Well, that doesn't tell much.

    Do you have a file /var/log/mysql/mysqld.log?
    Maybe something's in there...

  7. #7

    Default Re: Unable to secure mysql/mariadb in 12.3 new installation

    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:

    Code:
    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?

  8. #8

    Default Re: Unable to secure mysql/mariadb in 12.3 new installation

    Quote Originally Posted by maabaum View Post
    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 )...

  9. #9

    Default Re: Unable to secure mysql/mariadb in 12.3 new installation SOLVED

    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?

    maab

  10. #10

    Default Re: Unable to secure mysql/mariadb in 12.3 new installation SOLVED

    Quote Originally Posted by maabaum View Post
    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?

    maab
    Great that it works now!

    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...

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •