MySQL Ubuntu 16.04 not starting












2















I have tried to open Mysql in Linux Ubuntu 16.04 but I got an error:



ilqar@ubuntu:~$ mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)


Then I tried to start the mysql server:



ilqar@ubuntu:~$ sudo service mysql start
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
ilqar@ubuntu:~$ ^C
ilqar@ubuntu:~$ systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Sun 2018-01-21 10:39:04 +04; 17s ago
Process: 3620 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)

Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Control process exited, code=exited status=1
Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Unit entered failed state.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Failed with result 'exit-code'.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Jan 21 10:39:04 ubuntu systemd[1]: Stopped MySQL Community Server.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Start request repeated too quickly.
Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
ilqar@ubuntu:~$ journalctl -xe
--
-- Unit mysql.service has finished shutting down.
Jan 21 10:39:04 ubuntu systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Jan 21 10:39:04 ubuntu mysql-systemd-start[3611]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Control process exited, code=exited status=1
Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Unit entered failed state.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Failed with result 'exit-code'.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Jan 21 10:39:04 ubuntu systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Jan 21 10:39:04 ubuntu systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has begun starting up.
Jan 21 10:39:04 ubuntu mysql-systemd-start[3620]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Control process exited, code=exited status=1
Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Unit entered failed state.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Failed with result 'exit-code'.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Jan 21 10:39:04 ubuntu systemd[1]: Stopped MySQL Community Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Start request repeated too quickly.
Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.


I am newbie in Linux, please help me find out the problem.










share|improve this question



























    2















    I have tried to open Mysql in Linux Ubuntu 16.04 but I got an error:



    ilqar@ubuntu:~$ mysql -u root -p
    Enter password:
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)


    Then I tried to start the mysql server:



    ilqar@ubuntu:~$ sudo service mysql start
    Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
    ilqar@ubuntu:~$ ^C
    ilqar@ubuntu:~$ systemctl status mysql.service
    ● mysql.service - MySQL Community Server
    Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
    Active: inactive (dead) (Result: exit-code) since Sun 2018-01-21 10:39:04 +04; 17s ago
    Process: 3620 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)

    Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Control process exited, code=exited status=1
    Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
    Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Unit entered failed state.
    Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Failed with result 'exit-code'.
    Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
    Jan 21 10:39:04 ubuntu systemd[1]: Stopped MySQL Community Server.
    Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Start request repeated too quickly.
    Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
    ilqar@ubuntu:~$ journalctl -xe
    --
    -- Unit mysql.service has finished shutting down.
    Jan 21 10:39:04 ubuntu systemd[1]: Starting MySQL Community Server...
    -- Subject: Unit mysql.service has begun start-up
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit mysql.service has begun starting up.
    Jan 21 10:39:04 ubuntu mysql-systemd-start[3611]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.
    Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Control process exited, code=exited status=1
    Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
    -- Subject: Unit mysql.service has failed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit mysql.service has failed.
    --
    -- The result is failed.
    Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Unit entered failed state.
    Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Failed with result 'exit-code'.
    Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
    Jan 21 10:39:04 ubuntu systemd[1]: Stopped MySQL Community Server.
    -- Subject: Unit mysql.service has finished shutting down
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit mysql.service has finished shutting down.
    Jan 21 10:39:04 ubuntu systemd[1]: Starting MySQL Community Server...
    -- Subject: Unit mysql.service has begun start-up
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit mysql.service has begun starting up.
    Jan 21 10:39:04 ubuntu mysql-systemd-start[3620]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.
    Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Control process exited, code=exited status=1
    Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
    -- Subject: Unit mysql.service has failed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit mysql.service has failed.
    --
    -- The result is failed.
    Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Unit entered failed state.
    Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Failed with result 'exit-code'.
    Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
    Jan 21 10:39:04 ubuntu systemd[1]: Stopped MySQL Community Server.
    -- Subject: Unit mysql.service has finished shutting down
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit mysql.service has finished shutting down.
    Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Start request repeated too quickly.
    Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
    -- Subject: Unit mysql.service has failed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit mysql.service has failed.
    --
    -- The result is failed.


    I am newbie in Linux, please help me find out the problem.










    share|improve this question

























      2












      2








      2


      1






      I have tried to open Mysql in Linux Ubuntu 16.04 but I got an error:



      ilqar@ubuntu:~$ mysql -u root -p
      Enter password:
      ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)


      Then I tried to start the mysql server:



      ilqar@ubuntu:~$ sudo service mysql start
      Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
      ilqar@ubuntu:~$ ^C
      ilqar@ubuntu:~$ systemctl status mysql.service
      ● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) (Result: exit-code) since Sun 2018-01-21 10:39:04 +04; 17s ago
      Process: 3620 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)

      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Control process exited, code=exited status=1
      Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Unit entered failed state.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Failed with result 'exit-code'.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
      Jan 21 10:39:04 ubuntu systemd[1]: Stopped MySQL Community Server.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Start request repeated too quickly.
      Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
      ilqar@ubuntu:~$ journalctl -xe
      --
      -- Unit mysql.service has finished shutting down.
      Jan 21 10:39:04 ubuntu systemd[1]: Starting MySQL Community Server...
      -- Subject: Unit mysql.service has begun start-up
      -- Defined-By: systemd
      -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
      --
      -- Unit mysql.service has begun starting up.
      Jan 21 10:39:04 ubuntu mysql-systemd-start[3611]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Control process exited, code=exited status=1
      Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
      -- Subject: Unit mysql.service has failed
      -- Defined-By: systemd
      -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
      --
      -- Unit mysql.service has failed.
      --
      -- The result is failed.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Unit entered failed state.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Failed with result 'exit-code'.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
      Jan 21 10:39:04 ubuntu systemd[1]: Stopped MySQL Community Server.
      -- Subject: Unit mysql.service has finished shutting down
      -- Defined-By: systemd
      -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
      --
      -- Unit mysql.service has finished shutting down.
      Jan 21 10:39:04 ubuntu systemd[1]: Starting MySQL Community Server...
      -- Subject: Unit mysql.service has begun start-up
      -- Defined-By: systemd
      -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
      --
      -- Unit mysql.service has begun starting up.
      Jan 21 10:39:04 ubuntu mysql-systemd-start[3620]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Control process exited, code=exited status=1
      Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
      -- Subject: Unit mysql.service has failed
      -- Defined-By: systemd
      -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
      --
      -- Unit mysql.service has failed.
      --
      -- The result is failed.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Unit entered failed state.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Failed with result 'exit-code'.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
      Jan 21 10:39:04 ubuntu systemd[1]: Stopped MySQL Community Server.
      -- Subject: Unit mysql.service has finished shutting down
      -- Defined-By: systemd
      -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
      --
      -- Unit mysql.service has finished shutting down.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Start request repeated too quickly.
      Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
      -- Subject: Unit mysql.service has failed
      -- Defined-By: systemd
      -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
      --
      -- Unit mysql.service has failed.
      --
      -- The result is failed.


      I am newbie in Linux, please help me find out the problem.










      share|improve this question














      I have tried to open Mysql in Linux Ubuntu 16.04 but I got an error:



      ilqar@ubuntu:~$ mysql -u root -p
      Enter password:
      ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)


      Then I tried to start the mysql server:



      ilqar@ubuntu:~$ sudo service mysql start
      Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
      ilqar@ubuntu:~$ ^C
      ilqar@ubuntu:~$ systemctl status mysql.service
      ● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) (Result: exit-code) since Sun 2018-01-21 10:39:04 +04; 17s ago
      Process: 3620 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)

      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Control process exited, code=exited status=1
      Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Unit entered failed state.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Failed with result 'exit-code'.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
      Jan 21 10:39:04 ubuntu systemd[1]: Stopped MySQL Community Server.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Start request repeated too quickly.
      Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
      ilqar@ubuntu:~$ journalctl -xe
      --
      -- Unit mysql.service has finished shutting down.
      Jan 21 10:39:04 ubuntu systemd[1]: Starting MySQL Community Server...
      -- Subject: Unit mysql.service has begun start-up
      -- Defined-By: systemd
      -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
      --
      -- Unit mysql.service has begun starting up.
      Jan 21 10:39:04 ubuntu mysql-systemd-start[3611]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Control process exited, code=exited status=1
      Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
      -- Subject: Unit mysql.service has failed
      -- Defined-By: systemd
      -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
      --
      -- Unit mysql.service has failed.
      --
      -- The result is failed.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Unit entered failed state.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Failed with result 'exit-code'.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
      Jan 21 10:39:04 ubuntu systemd[1]: Stopped MySQL Community Server.
      -- Subject: Unit mysql.service has finished shutting down
      -- Defined-By: systemd
      -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
      --
      -- Unit mysql.service has finished shutting down.
      Jan 21 10:39:04 ubuntu systemd[1]: Starting MySQL Community Server...
      -- Subject: Unit mysql.service has begun start-up
      -- Defined-By: systemd
      -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
      --
      -- Unit mysql.service has begun starting up.
      Jan 21 10:39:04 ubuntu mysql-systemd-start[3620]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Control process exited, code=exited status=1
      Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
      -- Subject: Unit mysql.service has failed
      -- Defined-By: systemd
      -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
      --
      -- Unit mysql.service has failed.
      --
      -- The result is failed.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Unit entered failed state.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Failed with result 'exit-code'.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
      Jan 21 10:39:04 ubuntu systemd[1]: Stopped MySQL Community Server.
      -- Subject: Unit mysql.service has finished shutting down
      -- Defined-By: systemd
      -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
      --
      -- Unit mysql.service has finished shutting down.
      Jan 21 10:39:04 ubuntu systemd[1]: mysql.service: Start request repeated too quickly.
      Jan 21 10:39:04 ubuntu systemd[1]: Failed to start MySQL Community Server.
      -- Subject: Unit mysql.service has failed
      -- Defined-By: systemd
      -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
      --
      -- Unit mysql.service has failed.
      --
      -- The result is failed.


      I am newbie in Linux, please help me find out the problem.







      16.04 server mysql






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 21 '18 at 6:43









      Ilqar RasulovIlqar Rasulov

      3113




      3113






















          3 Answers
          3






          active

          oldest

          votes


















          2














          I had to remove mysql and reinstall it, now it works






          share|improve this answer































            0














            The relevant error message is



            MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.


            Try running



            sudo mysqld --initialize


            then try starting the service again.






            share|improve this answer


























            • how did you find out the relevant error message? I did as you said and got another error <pre><code> ilqar@ubuntu:~$ sudo mysqld --initialize [sudo] password for ilqar: 2018-01-21T07:01:10.666769Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-01-21T07:01:10.694011Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting. 2018-01-21T07:01:10.694164Z 0 [ERROR] Aborting </code></pre>

              – Ilqar Rasulov
              Jan 21 '18 at 7:04













            • how did you find out the relevant message?

              – Ilqar Rasulov
              Jan 21 '18 at 7:05











            • @IlqarRasulov It's in your journalctl -xe output in the question. First -- Unit mysql.service has begun starting up. then next line is Jan 21 10:39:04 ubuntu mysql-systemd-start[3611]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.

              – Chai T. Rex
              Jan 21 '18 at 7:06













            • yes, sure. Just saw it.

              – Ilqar Rasulov
              Jan 21 '18 at 7:10






            • 1





              I had to remove mysql and reinstall it, now it works

              – Ilqar Rasulov
              Jan 21 '18 at 7:26



















            0














            The problem is solved, when you remove mysql and then reinstall it.



            To remove mysql completely run the following command:



            $ sudo apt-get remove --purge --auto-remove mysql-client-* mysql-common mysql-server-*
            $ sudo rm -r /etc/mysql* /var/lib/mysql* /var/log/mysql*


            To install it again run:



            $ sudo apt-get install mysql-server





            share|improve this answer























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "89"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f998224%2fmysql-ubuntu-16-04-not-starting%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2














              I had to remove mysql and reinstall it, now it works






              share|improve this answer




























                2














                I had to remove mysql and reinstall it, now it works






                share|improve this answer


























                  2












                  2








                  2







                  I had to remove mysql and reinstall it, now it works






                  share|improve this answer













                  I had to remove mysql and reinstall it, now it works







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 21 '18 at 14:02









                  Ilqar RasulovIlqar Rasulov

                  3113




                  3113

























                      0














                      The relevant error message is



                      MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.


                      Try running



                      sudo mysqld --initialize


                      then try starting the service again.






                      share|improve this answer


























                      • how did you find out the relevant error message? I did as you said and got another error <pre><code> ilqar@ubuntu:~$ sudo mysqld --initialize [sudo] password for ilqar: 2018-01-21T07:01:10.666769Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-01-21T07:01:10.694011Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting. 2018-01-21T07:01:10.694164Z 0 [ERROR] Aborting </code></pre>

                        – Ilqar Rasulov
                        Jan 21 '18 at 7:04













                      • how did you find out the relevant message?

                        – Ilqar Rasulov
                        Jan 21 '18 at 7:05











                      • @IlqarRasulov It's in your journalctl -xe output in the question. First -- Unit mysql.service has begun starting up. then next line is Jan 21 10:39:04 ubuntu mysql-systemd-start[3611]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.

                        – Chai T. Rex
                        Jan 21 '18 at 7:06













                      • yes, sure. Just saw it.

                        – Ilqar Rasulov
                        Jan 21 '18 at 7:10






                      • 1





                        I had to remove mysql and reinstall it, now it works

                        – Ilqar Rasulov
                        Jan 21 '18 at 7:26
















                      0














                      The relevant error message is



                      MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.


                      Try running



                      sudo mysqld --initialize


                      then try starting the service again.






                      share|improve this answer


























                      • how did you find out the relevant error message? I did as you said and got another error <pre><code> ilqar@ubuntu:~$ sudo mysqld --initialize [sudo] password for ilqar: 2018-01-21T07:01:10.666769Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-01-21T07:01:10.694011Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting. 2018-01-21T07:01:10.694164Z 0 [ERROR] Aborting </code></pre>

                        – Ilqar Rasulov
                        Jan 21 '18 at 7:04













                      • how did you find out the relevant message?

                        – Ilqar Rasulov
                        Jan 21 '18 at 7:05











                      • @IlqarRasulov It's in your journalctl -xe output in the question. First -- Unit mysql.service has begun starting up. then next line is Jan 21 10:39:04 ubuntu mysql-systemd-start[3611]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.

                        – Chai T. Rex
                        Jan 21 '18 at 7:06













                      • yes, sure. Just saw it.

                        – Ilqar Rasulov
                        Jan 21 '18 at 7:10






                      • 1





                        I had to remove mysql and reinstall it, now it works

                        – Ilqar Rasulov
                        Jan 21 '18 at 7:26














                      0












                      0








                      0







                      The relevant error message is



                      MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.


                      Try running



                      sudo mysqld --initialize


                      then try starting the service again.






                      share|improve this answer















                      The relevant error message is



                      MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.


                      Try running



                      sudo mysqld --initialize


                      then try starting the service again.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jul 27 '18 at 10:16









                      d a i s y

                      3,36882444




                      3,36882444










                      answered Jan 21 '18 at 6:56









                      Chai T. RexChai T. Rex

                      4,18711536




                      4,18711536













                      • how did you find out the relevant error message? I did as you said and got another error <pre><code> ilqar@ubuntu:~$ sudo mysqld --initialize [sudo] password for ilqar: 2018-01-21T07:01:10.666769Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-01-21T07:01:10.694011Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting. 2018-01-21T07:01:10.694164Z 0 [ERROR] Aborting </code></pre>

                        – Ilqar Rasulov
                        Jan 21 '18 at 7:04













                      • how did you find out the relevant message?

                        – Ilqar Rasulov
                        Jan 21 '18 at 7:05











                      • @IlqarRasulov It's in your journalctl -xe output in the question. First -- Unit mysql.service has begun starting up. then next line is Jan 21 10:39:04 ubuntu mysql-systemd-start[3611]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.

                        – Chai T. Rex
                        Jan 21 '18 at 7:06













                      • yes, sure. Just saw it.

                        – Ilqar Rasulov
                        Jan 21 '18 at 7:10






                      • 1





                        I had to remove mysql and reinstall it, now it works

                        – Ilqar Rasulov
                        Jan 21 '18 at 7:26



















                      • how did you find out the relevant error message? I did as you said and got another error <pre><code> ilqar@ubuntu:~$ sudo mysqld --initialize [sudo] password for ilqar: 2018-01-21T07:01:10.666769Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-01-21T07:01:10.694011Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting. 2018-01-21T07:01:10.694164Z 0 [ERROR] Aborting </code></pre>

                        – Ilqar Rasulov
                        Jan 21 '18 at 7:04













                      • how did you find out the relevant message?

                        – Ilqar Rasulov
                        Jan 21 '18 at 7:05











                      • @IlqarRasulov It's in your journalctl -xe output in the question. First -- Unit mysql.service has begun starting up. then next line is Jan 21 10:39:04 ubuntu mysql-systemd-start[3611]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.

                        – Chai T. Rex
                        Jan 21 '18 at 7:06













                      • yes, sure. Just saw it.

                        – Ilqar Rasulov
                        Jan 21 '18 at 7:10






                      • 1





                        I had to remove mysql and reinstall it, now it works

                        – Ilqar Rasulov
                        Jan 21 '18 at 7:26

















                      how did you find out the relevant error message? I did as you said and got another error <pre><code> ilqar@ubuntu:~$ sudo mysqld --initialize [sudo] password for ilqar: 2018-01-21T07:01:10.666769Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-01-21T07:01:10.694011Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting. 2018-01-21T07:01:10.694164Z 0 [ERROR] Aborting </code></pre>

                      – Ilqar Rasulov
                      Jan 21 '18 at 7:04







                      how did you find out the relevant error message? I did as you said and got another error <pre><code> ilqar@ubuntu:~$ sudo mysqld --initialize [sudo] password for ilqar: 2018-01-21T07:01:10.666769Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-01-21T07:01:10.694011Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting. 2018-01-21T07:01:10.694164Z 0 [ERROR] Aborting </code></pre>

                      – Ilqar Rasulov
                      Jan 21 '18 at 7:04















                      how did you find out the relevant message?

                      – Ilqar Rasulov
                      Jan 21 '18 at 7:05





                      how did you find out the relevant message?

                      – Ilqar Rasulov
                      Jan 21 '18 at 7:05













                      @IlqarRasulov It's in your journalctl -xe output in the question. First -- Unit mysql.service has begun starting up. then next line is Jan 21 10:39:04 ubuntu mysql-systemd-start[3611]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.

                      – Chai T. Rex
                      Jan 21 '18 at 7:06







                      @IlqarRasulov It's in your journalctl -xe output in the question. First -- Unit mysql.service has begun starting up. then next line is Jan 21 10:39:04 ubuntu mysql-systemd-start[3611]: MySQL system database not found in /var/lib/mysql. Please run mysqld --initialize.

                      – Chai T. Rex
                      Jan 21 '18 at 7:06















                      yes, sure. Just saw it.

                      – Ilqar Rasulov
                      Jan 21 '18 at 7:10





                      yes, sure. Just saw it.

                      – Ilqar Rasulov
                      Jan 21 '18 at 7:10




                      1




                      1





                      I had to remove mysql and reinstall it, now it works

                      – Ilqar Rasulov
                      Jan 21 '18 at 7:26





                      I had to remove mysql and reinstall it, now it works

                      – Ilqar Rasulov
                      Jan 21 '18 at 7:26











                      0














                      The problem is solved, when you remove mysql and then reinstall it.



                      To remove mysql completely run the following command:



                      $ sudo apt-get remove --purge --auto-remove mysql-client-* mysql-common mysql-server-*
                      $ sudo rm -r /etc/mysql* /var/lib/mysql* /var/log/mysql*


                      To install it again run:



                      $ sudo apt-get install mysql-server





                      share|improve this answer




























                        0














                        The problem is solved, when you remove mysql and then reinstall it.



                        To remove mysql completely run the following command:



                        $ sudo apt-get remove --purge --auto-remove mysql-client-* mysql-common mysql-server-*
                        $ sudo rm -r /etc/mysql* /var/lib/mysql* /var/log/mysql*


                        To install it again run:



                        $ sudo apt-get install mysql-server





                        share|improve this answer


























                          0












                          0








                          0







                          The problem is solved, when you remove mysql and then reinstall it.



                          To remove mysql completely run the following command:



                          $ sudo apt-get remove --purge --auto-remove mysql-client-* mysql-common mysql-server-*
                          $ sudo rm -r /etc/mysql* /var/lib/mysql* /var/log/mysql*


                          To install it again run:



                          $ sudo apt-get install mysql-server





                          share|improve this answer













                          The problem is solved, when you remove mysql and then reinstall it.



                          To remove mysql completely run the following command:



                          $ sudo apt-get remove --purge --auto-remove mysql-client-* mysql-common mysql-server-*
                          $ sudo rm -r /etc/mysql* /var/lib/mysql* /var/log/mysql*


                          To install it again run:



                          $ sudo apt-get install mysql-server






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jan 28 at 10:10







                          user760819





































                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f998224%2fmysql-ubuntu-16-04-not-starting%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              How to change which sound is reproduced for terminal bell?

                              Can I use Tabulator js library in my java Spring + Thymeleaf project?

                              Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents