Announcement

Collapse
No announcement yet.

mysql service isn't getting started

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    mysql service isn't getting started

    I am getting this error when I start mysql service with this command :

    systemctl start mysql


    Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.

    Later I ran this commad to check :
    systemctl status mysql.service

    Result :
    mysql.service - LSB: Start and stop the mysql database server daemon
    Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
    Active: failed (Result: exit-code) since Mon 2016-10-10 13:20:22 IST; 19s ago
    Docs: man:systemd-sysv-generator(8)
    Process: 6445 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

    Oct 10 13:19:52 invidev1-PC /etc/init.d/mysql[6460]: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz
    Oct 10 13:19:52 invidev1-PC mysql[6445]: * Starting MySQL database server mysqld
    Oct 10 13:19:52 invidev1-PC su[6481]: Successful su for mysql by root
    Oct 10 13:19:52 invidev1-PC su[6481]: + root:mysql
    Oct 10 13:19:52 invidev1-PC su[6481]: pam_unix(su:session): session opened for user mysql by (uid=0)
    Oct 10 13:20:22 invidev1-PC mysql[6445]: ...fail!
    Oct 10 13:20:22 invidev1-PC systemd[1]: mysql.service: Control process exited, code=exited status=1
    Oct 10 13:20:22 invidev1-PC systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
    Oct 10 13:20:22 invidev1-PC systemd[1]: mysql.service: Unit entered failed state.
    Oct 10 13:20:22 invidev1-PC systemd[1]: mysql.service: Failed with result 'exit-code'.

    Please help me asap

    #2
    /etc/mysql/my.cnf is owned by root:root and its permissions are lrw-r--r--, meaning that it is a link to another location and that root can read and write the file at that other location but members of the root group and others (the world) can only read it. The actual file is at /etc/alternatives/my.cnf. If it cannot be read then more than likely the link has been destroyed or the file at /etc/alternatives/ is destroyed.

    The contents of /etc/alternatives/my.cnf is:
    #
    # The MySQL database server configuration file.
    #
    # You can copy this to one of:
    # - "/etc/mysql/my.cnf" to set global options,
    # - "~/.my.cnf" to set user-specific options.
    #
    # One can use all long options that the program supports.
    # Run program with --help to get a list of available options and with
    # --print-defaults to see which it would actually understand and use.
    #
    # For explanations see
    # http://dev.mysql.com/doc/mysql/en/se...variables.html

    # This will be passed to all mysql clients
    # It has been reported that passwords should be enclosed with ticks/quotes
    # escpecially if they contain "#" chars...
    # Remember to edit /etc/mysql/debian.cnf when changing the socket location.

    # Here is entries for some specific programs
    # The following values assume you have at least 32M ram

    !includedir /etc/mysql/conf.d/
    :~$ systemctl status mysql.service
    ● mysql.service
    Loaded: not-found (Reason: No such file or directory)
    Active: inactive (dead)
    I have mysql installed for akonadi, KMail and kaddressbook, but there is no systemd service associated with it, which is probably why, when you use systemctl to start it, it fails and tries to use /etc/init.d/mysql start to start it. which is the Upstart/sysVinit script. Did you try to create a systemd unit file for mysql?
    Last edited by GreyGeek; Oct 10, 2016, 02:21 PM.
    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
    – John F. Kennedy, February 26, 1962.

    Comment


      #3
      How to create a systemd unit file for mysql?

      Please elaborate

      Comment


        #4
        mysql service isn't getting started

        Writing a systemd unit file isn't your solution. You problem is to investigate why your /etc/alternatives/my.cnf file cannot be read or if it even exists. I posted a copy of the my.cnf file on my system in case you needed to re-create yours, if it was damaged or missing. Have you checked /etc/alternatives/my.cnf on your system? Does it exist? If it does what are the permissions, owner, group, etc.
        Last edited by GreyGeek; Oct 11, 2016, 06:44 AM.
        "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
        – John F. Kennedy, February 26, 1962.

        Comment


          #5
          Have you tried starting it via mysqld_safe?

          Comment


            #6
            Thanks for stepping in, WTF. My rdbm of choice is PostgreSQL. I know next to nothing about MySQL.


            Sent from my iPhone using Tapatalk
            "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
            – John F. Kennedy, February 26, 1962.

            Comment


              #7
              Originally posted by GreyGeek View Post
              Writing a systemd unit file isn't your solution. You problem is to investigate why your /etc/alternatives/my.cnf file cannot be read or if it even exists. I posted a copy of the my.cnf file on my system in case you needed to re-create yours, if it was damaged or missing. Have you checked /etc/alternatives/my.cnf on your system? Does it exist? If it does what are the permissions, owner, group, etc.
              I checked that location and the file "my.cnf" wasn't there. So, I created the file and pasted in those two locations (/etc/alternatives/ & /etc/mysql). Then I started it once again using systemctl command. The results were same (Failed to run mySQL error with the message in my post). Point out any step if I just missed here.

              Secondly, it might be a problem in permissions, so I need to check it again. But, I want to know one thing : is this the way linux behave everytime when a user want to setup a LAMP server running. I mean it is so messy to change privileges everytime and to run a 10-15 lines of command just for using it? There should be some direct way to setup a LAMP server like in Windows. I am a developer and folks say Linux is pretty much good at delivering such platform.

              So, I can completely remove (purge) everything (Apache2, MySQL, PHP5.6, PHPmyAdmin) and begin from the very beginning. I just want to set up a LAMP server on my local machine.
              I'll appreciate if you can tell me the exact steps for doing so.

              Note : I've also tried the GUI XAMPP for Linux. MySQL service is running fine but in that case Apache2 service is not getting started. It stops as soon as it is being started.

              Comment


                #8
                No not yet, I just tried the default way of starting it and I am waiting for @greygeek to respond first because I think I can mess up my Linux config if I apply someone's suggestions during a debugging phase.
                Will get back to you soon

                Comment


                  #9
                  You guys are my hope. Please assist me

                  Comment


                    #10
                    The digitalocean guides are usually really good. I used this one just a few weeks ago and it went smoothly: https://www.digitalocean.com/communi...n-ubuntu-16-04

                    Comment


                      #11
                      Originally posted by kaushakya View Post
                      I checked that location and the file "my.cnf" wasn't there. So, I created the file and pasted in those two locations (/etc/alternatives/ & /etc/mysql). Then I started it once again using systemctl command. The results were same (Failed to run mySQL error with the message in my post). Point out any step if I just missed here.
                      I suspect that using systemctl probably deleted the file at /etc/alternatives/, since there is no mysql unit (service). Using sysVinit synatax is how you start it. Either that or it may be a bug reported in msqld.conf in which
                      The mysqld.conf file had collation-set-server = utf8 when it should have been character-set-server = utf8
                      You may want to check your mysqld.conf to see if that bug regressed, and if so, repair it.

                      The my.cnf at /etc/mysql/ is not a file, it is a symbolic link to the file at /etc/alternatives/. Copy the file to /etc/alternatives/, set its permissions
                      chmod u=rw,g=r,o=r /etc/alternatives/my.cnf or use Dolphin as root,
                      and then, from a Konsole issue the ln command
                      ln -s /etc/mysql/my.cnf /etc/alternatives/my.cnf
                      Then logout (reboot is not necessary) and back in, then issue
                      service mysql restart
                      If it starts then great. If not, and not knowing exactly what you've during your installation and afterwards, I'd recommend ... (see below)

                      Originally posted by kaushakya View Post
                      .....But, I want to know one thing : is this the way linux behave everytime when a user want to setup a LAMP server running. I mean it is so messy to change privileges everytime and to run a 10-15 lines of command just for using it? There should be some direct way to setup a LAMP server like in Windows. I am a developer and folks say Linux is pretty much good at delivering such platform.
                      What folks say is correct!

                      I programmed using Linux from 1998 until I retired in 2008 and setting up LAMP was always easy, but later on I switched to the Qt API with PostgreSQL. Setting up LAMP is even easier now using tasksel, which is in the repository. Here is how.


                      Originally posted by kaushakya View Post
                      So, I can completely remove (purge) everything (Apache2, MySQL, PHP5.6, PHPmyAdmin) and begin from the very beginning. I just want to set up a LAMP server on my local machine.
                      I'll appreciate if you can tell me the exact steps for doing so.

                      Note : I've also tried the GUI XAMPP for Linux. MySQL service is running fine but in that case Apache2 service is not getting started. It stops as soon as it is being started.
                      Looks like you did some Googling and found XAMPP.

                      If I were you, I'd reinstall Kubuntu from your LiveCD or LiveUSB, just to be sure you are starting with a clean slate. As a newbie I couldn't guess what changes you made, deliberately or inadvertantly, when sudo is involved.

                      Then, from a Konsole, I'd install tasksel from the repository
                      sudo apt install tasksel
                      run it
                      sudo tasksel
                      and follow the instructions on the link I gave you above, if you need to, in order to install your LAMP setup. It would be a lot easier and quicker than purging five packages and their dependencies, and reverse what other changes you might have made.

                      (Edit: here is a second tasksel explanation.
                      "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                      – John F. Kennedy, February 26, 1962.

                      Comment

                      Working...
                      X