How do I start/stop mysql server? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)how to stop mysql server with rootHow to check and clean Ubuntu 16.04 from multiple Apache, Mysql, php installations?Cannot install mysql on Ubuntu 17.10 Gnome 3.26.2running XAMPP does not workIs it important to leave mysql running in the background ? Is there a gui to control processes on Ubuntu 12.04?After installing mysql-server, and doing $mysql, mysql won't start. Mysqld.sock missingConnect to mysql on another deviceError Updating MYSQL packageProblems installing MySQL Servermysql service can not start automatically at boot upHow can I restore mysql db?Mysql on Ubuntu 16.04: cannot log in as root, cannot start in safe mode, /var/run/mysqld removed at rebootCannot Connect to Database Server

Why did Israel vote against lifting the American embargo on Cuba?

3D Masyu - A Die

How to achieve cat-like agility?

Changing order of draw operation in PGFPlots

Are there any irrational/transcendental numbers for which the distribution of decimal digits is not uniform?

Unicode symbols with XeLaTeX and Lato font

Magento 2 - Add additional attributes in register

Centre cell vertically in tabularx across multiple multiline rows

Is it possible to intall libXft.so.2 on WSL?

How do I find my Spellcasting Ability for my D&D character?

Can anyone explain what's the meaning of this in the new Game of Thrones opening animations?

My mentor says to set image to Fine instead of RAW — how is this different from JPG?

Is there night in Alpha Complex?

How can I prevent/balance waiting and turtling as a response to cooldown mechanics

JImage - Set generated image quality

Why are two-digit numbers in Jonathan Swift's "Gulliver's Travels" (1726) written in "German style"?

Maximum rotation made by a symmetric positive definite matrix?

Does the main washing effect of soap come from foam?

A German immigrant ancestor has a "Registration Affidavit of Alien Enemy" on file. What does that mean exactly?

malloc in main() or malloc in another function: allocating memory for a struct and its members

New Order #6: Easter Egg

The test team as an enemy of development? And how can this be avoided?

Why are current probes so expensive?

Pointing to problems without suggesting solutions



How do I start/stop mysql server?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)how to stop mysql server with rootHow to check and clean Ubuntu 16.04 from multiple Apache, Mysql, php installations?Cannot install mysql on Ubuntu 17.10 Gnome 3.26.2running XAMPP does not workIs it important to leave mysql running in the background ? Is there a gui to control processes on Ubuntu 12.04?After installing mysql-server, and doing $mysql, mysql won't start. Mysqld.sock missingConnect to mysql on another deviceError Updating MYSQL packageProblems installing MySQL Servermysql service can not start automatically at boot upHow can I restore mysql db?Mysql on Ubuntu 16.04: cannot log in as root, cannot start in safe mode, /var/run/mysqld removed at rebootCannot Connect to Database Server



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








198















I tried to find in some articles describing how to correctly start & stop mysql server.



I found this link: How to start/stop MySql server on Ubuntu 8.04 | Abhi's Blogging World



I ran this command:



/etc/init.d/mysql start 


but I see this error



ERROR 1045 (28000) Access denied for user....


After I tried this command:



sudo /etc/init.d/mysql start


I entered my password, and again I see the same error.



Next command:



sudo /etc/init.d/mysql - root -p start


results in:



ERROR 1049 (42000) Unknown database 'start'.


And when I run this command:



sudo service mysql start


MySQL server success started. Cool!



So, what's wrong with the other commands? Why do they result in error?










share|improve this question



















  • 3





    In fact, even with sudo it didn't work for me, but then I found in the script the following hint: Rather than invoking init scripts through /etc/init.d, use the service(8) and it was ok

    – Timofey
    Sep 20 '12 at 20:21






  • 2





    Tim is correct. Use sudo service mysql start.

    – Ed Manet
    Mar 15 '13 at 18:07











  • Generally you can use sudo -l to see what your specific user on your specific system is allowed to do with sudo. (Your permissions are configured in /etc/sudoers.) However I don't know for sure if it would help in this particular case. EDIT: Wait, never mind, the access denied error looks like it is coming from MySQL or something, not sudo.

    – David Winiecki
    Dec 16 '16 at 19:41


















198















I tried to find in some articles describing how to correctly start & stop mysql server.



I found this link: How to start/stop MySql server on Ubuntu 8.04 | Abhi's Blogging World



I ran this command:



/etc/init.d/mysql start 


but I see this error



ERROR 1045 (28000) Access denied for user....


After I tried this command:



sudo /etc/init.d/mysql start


I entered my password, and again I see the same error.



Next command:



sudo /etc/init.d/mysql - root -p start


results in:



ERROR 1049 (42000) Unknown database 'start'.


And when I run this command:



sudo service mysql start


MySQL server success started. Cool!



So, what's wrong with the other commands? Why do they result in error?










share|improve this question



















  • 3





    In fact, even with sudo it didn't work for me, but then I found in the script the following hint: Rather than invoking init scripts through /etc/init.d, use the service(8) and it was ok

    – Timofey
    Sep 20 '12 at 20:21






  • 2





    Tim is correct. Use sudo service mysql start.

    – Ed Manet
    Mar 15 '13 at 18:07











  • Generally you can use sudo -l to see what your specific user on your specific system is allowed to do with sudo. (Your permissions are configured in /etc/sudoers.) However I don't know for sure if it would help in this particular case. EDIT: Wait, never mind, the access denied error looks like it is coming from MySQL or something, not sudo.

    – David Winiecki
    Dec 16 '16 at 19:41














198












198








198


65






I tried to find in some articles describing how to correctly start & stop mysql server.



I found this link: How to start/stop MySql server on Ubuntu 8.04 | Abhi's Blogging World



I ran this command:



/etc/init.d/mysql start 


but I see this error



ERROR 1045 (28000) Access denied for user....


After I tried this command:



sudo /etc/init.d/mysql start


I entered my password, and again I see the same error.



Next command:



sudo /etc/init.d/mysql - root -p start


results in:



ERROR 1049 (42000) Unknown database 'start'.


And when I run this command:



sudo service mysql start


MySQL server success started. Cool!



So, what's wrong with the other commands? Why do they result in error?










share|improve this question
















I tried to find in some articles describing how to correctly start & stop mysql server.



I found this link: How to start/stop MySql server on Ubuntu 8.04 | Abhi's Blogging World



I ran this command:



/etc/init.d/mysql start 


but I see this error



ERROR 1045 (28000) Access denied for user....


After I tried this command:



sudo /etc/init.d/mysql start


I entered my password, and again I see the same error.



Next command:



sudo /etc/init.d/mysql - root -p start


results in:



ERROR 1049 (42000) Unknown database 'start'.


And when I run this command:



sudo service mysql start


MySQL server success started. Cool!



So, what's wrong with the other commands? Why do they result in error?







sudo mysql






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 4 '16 at 16:21









amc

4,85462746




4,85462746










asked Nov 24 '11 at 16:12









user471011user471011

1,45961918




1,45961918







  • 3





    In fact, even with sudo it didn't work for me, but then I found in the script the following hint: Rather than invoking init scripts through /etc/init.d, use the service(8) and it was ok

    – Timofey
    Sep 20 '12 at 20:21






  • 2





    Tim is correct. Use sudo service mysql start.

    – Ed Manet
    Mar 15 '13 at 18:07











  • Generally you can use sudo -l to see what your specific user on your specific system is allowed to do with sudo. (Your permissions are configured in /etc/sudoers.) However I don't know for sure if it would help in this particular case. EDIT: Wait, never mind, the access denied error looks like it is coming from MySQL or something, not sudo.

    – David Winiecki
    Dec 16 '16 at 19:41













  • 3





    In fact, even with sudo it didn't work for me, but then I found in the script the following hint: Rather than invoking init scripts through /etc/init.d, use the service(8) and it was ok

    – Timofey
    Sep 20 '12 at 20:21






  • 2





    Tim is correct. Use sudo service mysql start.

    – Ed Manet
    Mar 15 '13 at 18:07











  • Generally you can use sudo -l to see what your specific user on your specific system is allowed to do with sudo. (Your permissions are configured in /etc/sudoers.) However I don't know for sure if it would help in this particular case. EDIT: Wait, never mind, the access denied error looks like it is coming from MySQL or something, not sudo.

    – David Winiecki
    Dec 16 '16 at 19:41








3




3





In fact, even with sudo it didn't work for me, but then I found in the script the following hint: Rather than invoking init scripts through /etc/init.d, use the service(8) and it was ok

– Timofey
Sep 20 '12 at 20:21





In fact, even with sudo it didn't work for me, but then I found in the script the following hint: Rather than invoking init scripts through /etc/init.d, use the service(8) and it was ok

– Timofey
Sep 20 '12 at 20:21




2




2





Tim is correct. Use sudo service mysql start.

– Ed Manet
Mar 15 '13 at 18:07





Tim is correct. Use sudo service mysql start.

– Ed Manet
Mar 15 '13 at 18:07













Generally you can use sudo -l to see what your specific user on your specific system is allowed to do with sudo. (Your permissions are configured in /etc/sudoers.) However I don't know for sure if it would help in this particular case. EDIT: Wait, never mind, the access denied error looks like it is coming from MySQL or something, not sudo.

– David Winiecki
Dec 16 '16 at 19:41






Generally you can use sudo -l to see what your specific user on your specific system is allowed to do with sudo. (Your permissions are configured in /etc/sudoers.) However I don't know for sure if it would help in this particular case. EDIT: Wait, never mind, the access denied error looks like it is coming from MySQL or something, not sudo.

– David Winiecki
Dec 16 '16 at 19:41











9 Answers
9






active

oldest

votes


















221














Your first two commands weren't run as root so that is expected behaviour. You need to be root to stop/start mysql.



However:



sudo /etc/init.d/mysql start


should work. Indeed it does, for me:



kojan:~> sudo /etc/init.d/mysql restart
[sudo] password for chris:
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld.
Checking for corrupt, not cleanly closed and upgrade needing tables..


I used restart rather than start, since it was already running, but the effect is the same. Are you sure you entered your password correctly? :) Have you edited your sudo config at all which would stop this working?



This one..



sudo /etc/init.d/mysql - root -p start


The arguments are wrong. an init.d script only takes start or stop or restart - just one word telling it what to do. You cannot give it multiple arguments as you were trying to do.



Anyway, the short answer is the one you actually got to work, is the recommended way. service is replacing all the init.d scripts over time, so you should get into the habit of using service. The page you link is 3 years old so has to be taken with some salt :)






share|improve this answer




















  • 7





    Also try sudo service mysql start

    – user108762
    Nov 17 '12 at 12:45






  • 2





    start mysql worked for me (Ubuntu 12.04.4).

    – Tim
    May 12 '14 at 7:28






  • 2





    sudo /etc/init.d/mysql restart restarted MySQL for me

    – Edward
    Jul 13 '16 at 20:23






  • 5





    how about sudo systemctl start mysql for Ubuntu 16.04 and up?

    – Ankit Balyan
    Feb 2 '17 at 3:16


















79














Also helps to double check that "mysql" is the correct service name. In my case it wasn't. I kept getting following response: mysql: unrecognized service when running



service mysql status 


Then I checked /etc/init.d and found script named mysqld which listed process name: mysqld and prog=mysqld



So then I did



service mysqld status
service mysqld stop
service mysqld start


and they all worked fine.






share|improve this answer




















  • 4





    mysql: unrecognized service

    – Green
    Jul 20 '13 at 1:06






  • 7





    At least on 13.10, you'll need to run it with root privileges. eg, "sudo service mysql status".

    – Bryce
    Mar 4 '14 at 5:09






  • 12





    For 14.10 I needed to use "mysql" not mysqld

    – redanimalwar
    Oct 23 '14 at 1:39






  • 1





    when running without root rights, it'll say unknown job: mysql. a bit confusing.

    – Blauhirn
    Mar 20 '16 at 15:55











  • Failed to start mysqld.service: Unit mysqld.service not found.

    – JCarlos
    Nov 23 '17 at 23:54


















30














For Ubuntu 12.10 and later:



START MYSQL:



sudo start mysql


RESTART MYSQL:



sudo restart mysql # The service must be running


STOP MYSQL:



sudo stop mysql # The service must be running





share|improve this answer




















  • 3





    stop: Unknown job: mysql

    – Green
    Jul 20 '13 at 1:07











  • @Green I just tried this (one year later) and it is still working. This is my result: mysql stop/waiting. You must know that you have to be already running mysql to stop this ;)

    – Lucio
    Jul 24 '13 at 22:45







  • 1





    Hero, you save my life, that mysqld has been occupied my machine memory for so long. I tried all kinds of methods to remove it, but all failed, until I met your answer.

    – Zen
    Sep 2 '14 at 13:07











  • sudo: start: command not found

    – JCarlos
    Nov 23 '17 at 23:55






  • 1





    @JCarlos Do apt install upstart

    – Edward
    Dec 28 '17 at 17:06


















9














Actually, I got a strange error, when I installed mysql-workbench on my Ubuntu machine. After that I tried to start the mysql service using this command:



service mysql start


So I got the solution that the MySQL server was not installed, so I installed it and my problem was solved. The command to install mysql-server is:



sudo apt-get install mysql-server


After successful installation, start the MySQL server as:



service mysql start





share|improve this answer
































    4














    I had the same issue with Ubuntu64 and I fixed by simply not using systemctl but instead this:



    sudo service mysql restart


    hopefully this command will work for you.






    share|improve this answer






























      2














      This one should work for the manually built mysql server:



      sudo /usr/local/mysql/bin/mysqld_safe --user=mysql





      share|improve this answer






























        1














        after installing MySQL on your system just do that:




        $ service mysql status




        if service down just does this :




        $ service mysql start




        and for stopping my service that :




        $ service mysql stop







        share|improve this answer


















        • 1





          /etc/init.d/mysql start and service mysql start are exactly the same.

          – storm
          Jul 26 '17 at 8:55


















        0














        A little script to cover both cases [server running/server not running]:



        #!/bin/bash

        service mysql restart
        if [ "$?" != "0" ]; then
        service mysql start
        fi





        share|improve this answer






























          0














          On ubuntu 18.04 the socket is defined in the file




          /etc/mysql/mysql.conf.d/mysqld.cnf



          socket = /var/run/mysqld/mysqld.sock




          The directory was not present so I created it manually as below:




          sudo mkdir -p /var/run/mysqld




          Restart mysql. That solved it for my case here.





          share








          New contributor




          Noel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.




















            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%2f82374%2fhow-do-i-start-stop-mysql-server%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            9 Answers
            9






            active

            oldest

            votes








            9 Answers
            9






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            221














            Your first two commands weren't run as root so that is expected behaviour. You need to be root to stop/start mysql.



            However:



            sudo /etc/init.d/mysql start


            should work. Indeed it does, for me:



            kojan:~> sudo /etc/init.d/mysql restart
            [sudo] password for chris:
            Stopping MySQL database server: mysqld.
            Starting MySQL database server: mysqld.
            Checking for corrupt, not cleanly closed and upgrade needing tables..


            I used restart rather than start, since it was already running, but the effect is the same. Are you sure you entered your password correctly? :) Have you edited your sudo config at all which would stop this working?



            This one..



            sudo /etc/init.d/mysql - root -p start


            The arguments are wrong. an init.d script only takes start or stop or restart - just one word telling it what to do. You cannot give it multiple arguments as you were trying to do.



            Anyway, the short answer is the one you actually got to work, is the recommended way. service is replacing all the init.d scripts over time, so you should get into the habit of using service. The page you link is 3 years old so has to be taken with some salt :)






            share|improve this answer




















            • 7





              Also try sudo service mysql start

              – user108762
              Nov 17 '12 at 12:45






            • 2





              start mysql worked for me (Ubuntu 12.04.4).

              – Tim
              May 12 '14 at 7:28






            • 2





              sudo /etc/init.d/mysql restart restarted MySQL for me

              – Edward
              Jul 13 '16 at 20:23






            • 5





              how about sudo systemctl start mysql for Ubuntu 16.04 and up?

              – Ankit Balyan
              Feb 2 '17 at 3:16















            221














            Your first two commands weren't run as root so that is expected behaviour. You need to be root to stop/start mysql.



            However:



            sudo /etc/init.d/mysql start


            should work. Indeed it does, for me:



            kojan:~> sudo /etc/init.d/mysql restart
            [sudo] password for chris:
            Stopping MySQL database server: mysqld.
            Starting MySQL database server: mysqld.
            Checking for corrupt, not cleanly closed and upgrade needing tables..


            I used restart rather than start, since it was already running, but the effect is the same. Are you sure you entered your password correctly? :) Have you edited your sudo config at all which would stop this working?



            This one..



            sudo /etc/init.d/mysql - root -p start


            The arguments are wrong. an init.d script only takes start or stop or restart - just one word telling it what to do. You cannot give it multiple arguments as you were trying to do.



            Anyway, the short answer is the one you actually got to work, is the recommended way. service is replacing all the init.d scripts over time, so you should get into the habit of using service. The page you link is 3 years old so has to be taken with some salt :)






            share|improve this answer




















            • 7





              Also try sudo service mysql start

              – user108762
              Nov 17 '12 at 12:45






            • 2





              start mysql worked for me (Ubuntu 12.04.4).

              – Tim
              May 12 '14 at 7:28






            • 2





              sudo /etc/init.d/mysql restart restarted MySQL for me

              – Edward
              Jul 13 '16 at 20:23






            • 5





              how about sudo systemctl start mysql for Ubuntu 16.04 and up?

              – Ankit Balyan
              Feb 2 '17 at 3:16













            221












            221








            221







            Your first two commands weren't run as root so that is expected behaviour. You need to be root to stop/start mysql.



            However:



            sudo /etc/init.d/mysql start


            should work. Indeed it does, for me:



            kojan:~> sudo /etc/init.d/mysql restart
            [sudo] password for chris:
            Stopping MySQL database server: mysqld.
            Starting MySQL database server: mysqld.
            Checking for corrupt, not cleanly closed and upgrade needing tables..


            I used restart rather than start, since it was already running, but the effect is the same. Are you sure you entered your password correctly? :) Have you edited your sudo config at all which would stop this working?



            This one..



            sudo /etc/init.d/mysql - root -p start


            The arguments are wrong. an init.d script only takes start or stop or restart - just one word telling it what to do. You cannot give it multiple arguments as you were trying to do.



            Anyway, the short answer is the one you actually got to work, is the recommended way. service is replacing all the init.d scripts over time, so you should get into the habit of using service. The page you link is 3 years old so has to be taken with some salt :)






            share|improve this answer















            Your first two commands weren't run as root so that is expected behaviour. You need to be root to stop/start mysql.



            However:



            sudo /etc/init.d/mysql start


            should work. Indeed it does, for me:



            kojan:~> sudo /etc/init.d/mysql restart
            [sudo] password for chris:
            Stopping MySQL database server: mysqld.
            Starting MySQL database server: mysqld.
            Checking for corrupt, not cleanly closed and upgrade needing tables..


            I used restart rather than start, since it was already running, but the effect is the same. Are you sure you entered your password correctly? :) Have you edited your sudo config at all which would stop this working?



            This one..



            sudo /etc/init.d/mysql - root -p start


            The arguments are wrong. an init.d script only takes start or stop or restart - just one word telling it what to do. You cannot give it multiple arguments as you were trying to do.



            Anyway, the short answer is the one you actually got to work, is the recommended way. service is replacing all the init.d scripts over time, so you should get into the habit of using service. The page you link is 3 years old so has to be taken with some salt :)







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 24 '11 at 16:34

























            answered Nov 24 '11 at 16:24









            CaesiumCaesium

            11.7k33147




            11.7k33147







            • 7





              Also try sudo service mysql start

              – user108762
              Nov 17 '12 at 12:45






            • 2





              start mysql worked for me (Ubuntu 12.04.4).

              – Tim
              May 12 '14 at 7:28






            • 2





              sudo /etc/init.d/mysql restart restarted MySQL for me

              – Edward
              Jul 13 '16 at 20:23






            • 5





              how about sudo systemctl start mysql for Ubuntu 16.04 and up?

              – Ankit Balyan
              Feb 2 '17 at 3:16












            • 7





              Also try sudo service mysql start

              – user108762
              Nov 17 '12 at 12:45






            • 2





              start mysql worked for me (Ubuntu 12.04.4).

              – Tim
              May 12 '14 at 7:28






            • 2





              sudo /etc/init.d/mysql restart restarted MySQL for me

              – Edward
              Jul 13 '16 at 20:23






            • 5





              how about sudo systemctl start mysql for Ubuntu 16.04 and up?

              – Ankit Balyan
              Feb 2 '17 at 3:16







            7




            7





            Also try sudo service mysql start

            – user108762
            Nov 17 '12 at 12:45





            Also try sudo service mysql start

            – user108762
            Nov 17 '12 at 12:45




            2




            2





            start mysql worked for me (Ubuntu 12.04.4).

            – Tim
            May 12 '14 at 7:28





            start mysql worked for me (Ubuntu 12.04.4).

            – Tim
            May 12 '14 at 7:28




            2




            2





            sudo /etc/init.d/mysql restart restarted MySQL for me

            – Edward
            Jul 13 '16 at 20:23





            sudo /etc/init.d/mysql restart restarted MySQL for me

            – Edward
            Jul 13 '16 at 20:23




            5




            5





            how about sudo systemctl start mysql for Ubuntu 16.04 and up?

            – Ankit Balyan
            Feb 2 '17 at 3:16





            how about sudo systemctl start mysql for Ubuntu 16.04 and up?

            – Ankit Balyan
            Feb 2 '17 at 3:16













            79














            Also helps to double check that "mysql" is the correct service name. In my case it wasn't. I kept getting following response: mysql: unrecognized service when running



            service mysql status 


            Then I checked /etc/init.d and found script named mysqld which listed process name: mysqld and prog=mysqld



            So then I did



            service mysqld status
            service mysqld stop
            service mysqld start


            and they all worked fine.






            share|improve this answer




















            • 4





              mysql: unrecognized service

              – Green
              Jul 20 '13 at 1:06






            • 7





              At least on 13.10, you'll need to run it with root privileges. eg, "sudo service mysql status".

              – Bryce
              Mar 4 '14 at 5:09






            • 12





              For 14.10 I needed to use "mysql" not mysqld

              – redanimalwar
              Oct 23 '14 at 1:39






            • 1





              when running without root rights, it'll say unknown job: mysql. a bit confusing.

              – Blauhirn
              Mar 20 '16 at 15:55











            • Failed to start mysqld.service: Unit mysqld.service not found.

              – JCarlos
              Nov 23 '17 at 23:54















            79














            Also helps to double check that "mysql" is the correct service name. In my case it wasn't. I kept getting following response: mysql: unrecognized service when running



            service mysql status 


            Then I checked /etc/init.d and found script named mysqld which listed process name: mysqld and prog=mysqld



            So then I did



            service mysqld status
            service mysqld stop
            service mysqld start


            and they all worked fine.






            share|improve this answer




















            • 4





              mysql: unrecognized service

              – Green
              Jul 20 '13 at 1:06






            • 7





              At least on 13.10, you'll need to run it with root privileges. eg, "sudo service mysql status".

              – Bryce
              Mar 4 '14 at 5:09






            • 12





              For 14.10 I needed to use "mysql" not mysqld

              – redanimalwar
              Oct 23 '14 at 1:39






            • 1





              when running without root rights, it'll say unknown job: mysql. a bit confusing.

              – Blauhirn
              Mar 20 '16 at 15:55











            • Failed to start mysqld.service: Unit mysqld.service not found.

              – JCarlos
              Nov 23 '17 at 23:54













            79












            79








            79







            Also helps to double check that "mysql" is the correct service name. In my case it wasn't. I kept getting following response: mysql: unrecognized service when running



            service mysql status 


            Then I checked /etc/init.d and found script named mysqld which listed process name: mysqld and prog=mysqld



            So then I did



            service mysqld status
            service mysqld stop
            service mysqld start


            and they all worked fine.






            share|improve this answer















            Also helps to double check that "mysql" is the correct service name. In my case it wasn't. I kept getting following response: mysql: unrecognized service when running



            service mysql status 


            Then I checked /etc/init.d and found script named mysqld which listed process name: mysqld and prog=mysqld



            So then I did



            service mysqld status
            service mysqld stop
            service mysqld start


            and they all worked fine.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 15 '13 at 17:36









            Eric Carvalho

            42.6k17118148




            42.6k17118148










            answered Mar 15 '13 at 16:58









            user140589user140589

            79152




            79152







            • 4





              mysql: unrecognized service

              – Green
              Jul 20 '13 at 1:06






            • 7





              At least on 13.10, you'll need to run it with root privileges. eg, "sudo service mysql status".

              – Bryce
              Mar 4 '14 at 5:09






            • 12





              For 14.10 I needed to use "mysql" not mysqld

              – redanimalwar
              Oct 23 '14 at 1:39






            • 1





              when running without root rights, it'll say unknown job: mysql. a bit confusing.

              – Blauhirn
              Mar 20 '16 at 15:55











            • Failed to start mysqld.service: Unit mysqld.service not found.

              – JCarlos
              Nov 23 '17 at 23:54












            • 4





              mysql: unrecognized service

              – Green
              Jul 20 '13 at 1:06






            • 7





              At least on 13.10, you'll need to run it with root privileges. eg, "sudo service mysql status".

              – Bryce
              Mar 4 '14 at 5:09






            • 12





              For 14.10 I needed to use "mysql" not mysqld

              – redanimalwar
              Oct 23 '14 at 1:39






            • 1





              when running without root rights, it'll say unknown job: mysql. a bit confusing.

              – Blauhirn
              Mar 20 '16 at 15:55











            • Failed to start mysqld.service: Unit mysqld.service not found.

              – JCarlos
              Nov 23 '17 at 23:54







            4




            4





            mysql: unrecognized service

            – Green
            Jul 20 '13 at 1:06





            mysql: unrecognized service

            – Green
            Jul 20 '13 at 1:06




            7




            7





            At least on 13.10, you'll need to run it with root privileges. eg, "sudo service mysql status".

            – Bryce
            Mar 4 '14 at 5:09





            At least on 13.10, you'll need to run it with root privileges. eg, "sudo service mysql status".

            – Bryce
            Mar 4 '14 at 5:09




            12




            12





            For 14.10 I needed to use "mysql" not mysqld

            – redanimalwar
            Oct 23 '14 at 1:39





            For 14.10 I needed to use "mysql" not mysqld

            – redanimalwar
            Oct 23 '14 at 1:39




            1




            1





            when running without root rights, it'll say unknown job: mysql. a bit confusing.

            – Blauhirn
            Mar 20 '16 at 15:55





            when running without root rights, it'll say unknown job: mysql. a bit confusing.

            – Blauhirn
            Mar 20 '16 at 15:55













            Failed to start mysqld.service: Unit mysqld.service not found.

            – JCarlos
            Nov 23 '17 at 23:54





            Failed to start mysqld.service: Unit mysqld.service not found.

            – JCarlos
            Nov 23 '17 at 23:54











            30














            For Ubuntu 12.10 and later:



            START MYSQL:



            sudo start mysql


            RESTART MYSQL:



            sudo restart mysql # The service must be running


            STOP MYSQL:



            sudo stop mysql # The service must be running





            share|improve this answer




















            • 3





              stop: Unknown job: mysql

              – Green
              Jul 20 '13 at 1:07











            • @Green I just tried this (one year later) and it is still working. This is my result: mysql stop/waiting. You must know that you have to be already running mysql to stop this ;)

              – Lucio
              Jul 24 '13 at 22:45







            • 1





              Hero, you save my life, that mysqld has been occupied my machine memory for so long. I tried all kinds of methods to remove it, but all failed, until I met your answer.

              – Zen
              Sep 2 '14 at 13:07











            • sudo: start: command not found

              – JCarlos
              Nov 23 '17 at 23:55






            • 1





              @JCarlos Do apt install upstart

              – Edward
              Dec 28 '17 at 17:06















            30














            For Ubuntu 12.10 and later:



            START MYSQL:



            sudo start mysql


            RESTART MYSQL:



            sudo restart mysql # The service must be running


            STOP MYSQL:



            sudo stop mysql # The service must be running





            share|improve this answer




















            • 3





              stop: Unknown job: mysql

              – Green
              Jul 20 '13 at 1:07











            • @Green I just tried this (one year later) and it is still working. This is my result: mysql stop/waiting. You must know that you have to be already running mysql to stop this ;)

              – Lucio
              Jul 24 '13 at 22:45







            • 1





              Hero, you save my life, that mysqld has been occupied my machine memory for so long. I tried all kinds of methods to remove it, but all failed, until I met your answer.

              – Zen
              Sep 2 '14 at 13:07











            • sudo: start: command not found

              – JCarlos
              Nov 23 '17 at 23:55






            • 1





              @JCarlos Do apt install upstart

              – Edward
              Dec 28 '17 at 17:06













            30












            30








            30







            For Ubuntu 12.10 and later:



            START MYSQL:



            sudo start mysql


            RESTART MYSQL:



            sudo restart mysql # The service must be running


            STOP MYSQL:



            sudo stop mysql # The service must be running





            share|improve this answer















            For Ubuntu 12.10 and later:



            START MYSQL:



            sudo start mysql


            RESTART MYSQL:



            sudo restart mysql # The service must be running


            STOP MYSQL:



            sudo stop mysql # The service must be running






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Sep 2 '14 at 18:34

























            answered Dec 15 '12 at 0:04









            LucioLucio

            12.7k2485162




            12.7k2485162







            • 3





              stop: Unknown job: mysql

              – Green
              Jul 20 '13 at 1:07











            • @Green I just tried this (one year later) and it is still working. This is my result: mysql stop/waiting. You must know that you have to be already running mysql to stop this ;)

              – Lucio
              Jul 24 '13 at 22:45







            • 1





              Hero, you save my life, that mysqld has been occupied my machine memory for so long. I tried all kinds of methods to remove it, but all failed, until I met your answer.

              – Zen
              Sep 2 '14 at 13:07











            • sudo: start: command not found

              – JCarlos
              Nov 23 '17 at 23:55






            • 1





              @JCarlos Do apt install upstart

              – Edward
              Dec 28 '17 at 17:06












            • 3





              stop: Unknown job: mysql

              – Green
              Jul 20 '13 at 1:07











            • @Green I just tried this (one year later) and it is still working. This is my result: mysql stop/waiting. You must know that you have to be already running mysql to stop this ;)

              – Lucio
              Jul 24 '13 at 22:45







            • 1





              Hero, you save my life, that mysqld has been occupied my machine memory for so long. I tried all kinds of methods to remove it, but all failed, until I met your answer.

              – Zen
              Sep 2 '14 at 13:07











            • sudo: start: command not found

              – JCarlos
              Nov 23 '17 at 23:55






            • 1





              @JCarlos Do apt install upstart

              – Edward
              Dec 28 '17 at 17:06







            3




            3





            stop: Unknown job: mysql

            – Green
            Jul 20 '13 at 1:07





            stop: Unknown job: mysql

            – Green
            Jul 20 '13 at 1:07













            @Green I just tried this (one year later) and it is still working. This is my result: mysql stop/waiting. You must know that you have to be already running mysql to stop this ;)

            – Lucio
            Jul 24 '13 at 22:45






            @Green I just tried this (one year later) and it is still working. This is my result: mysql stop/waiting. You must know that you have to be already running mysql to stop this ;)

            – Lucio
            Jul 24 '13 at 22:45





            1




            1





            Hero, you save my life, that mysqld has been occupied my machine memory for so long. I tried all kinds of methods to remove it, but all failed, until I met your answer.

            – Zen
            Sep 2 '14 at 13:07





            Hero, you save my life, that mysqld has been occupied my machine memory for so long. I tried all kinds of methods to remove it, but all failed, until I met your answer.

            – Zen
            Sep 2 '14 at 13:07













            sudo: start: command not found

            – JCarlos
            Nov 23 '17 at 23:55





            sudo: start: command not found

            – JCarlos
            Nov 23 '17 at 23:55




            1




            1





            @JCarlos Do apt install upstart

            – Edward
            Dec 28 '17 at 17:06





            @JCarlos Do apt install upstart

            – Edward
            Dec 28 '17 at 17:06











            9














            Actually, I got a strange error, when I installed mysql-workbench on my Ubuntu machine. After that I tried to start the mysql service using this command:



            service mysql start


            So I got the solution that the MySQL server was not installed, so I installed it and my problem was solved. The command to install mysql-server is:



            sudo apt-get install mysql-server


            After successful installation, start the MySQL server as:



            service mysql start





            share|improve this answer





























              9














              Actually, I got a strange error, when I installed mysql-workbench on my Ubuntu machine. After that I tried to start the mysql service using this command:



              service mysql start


              So I got the solution that the MySQL server was not installed, so I installed it and my problem was solved. The command to install mysql-server is:



              sudo apt-get install mysql-server


              After successful installation, start the MySQL server as:



              service mysql start





              share|improve this answer



























                9












                9








                9







                Actually, I got a strange error, when I installed mysql-workbench on my Ubuntu machine. After that I tried to start the mysql service using this command:



                service mysql start


                So I got the solution that the MySQL server was not installed, so I installed it and my problem was solved. The command to install mysql-server is:



                sudo apt-get install mysql-server


                After successful installation, start the MySQL server as:



                service mysql start





                share|improve this answer















                Actually, I got a strange error, when I installed mysql-workbench on my Ubuntu machine. After that I tried to start the mysql service using this command:



                service mysql start


                So I got the solution that the MySQL server was not installed, so I installed it and my problem was solved. The command to install mysql-server is:



                sudo apt-get install mysql-server


                After successful installation, start the MySQL server as:



                service mysql start






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 22 '15 at 17:14









                user.dz

                35.3k1198179




                35.3k1198179










                answered Nov 28 '13 at 16:41









                Akash5288Akash5288

                19113




                19113





















                    4














                    I had the same issue with Ubuntu64 and I fixed by simply not using systemctl but instead this:



                    sudo service mysql restart


                    hopefully this command will work for you.






                    share|improve this answer



























                      4














                      I had the same issue with Ubuntu64 and I fixed by simply not using systemctl but instead this:



                      sudo service mysql restart


                      hopefully this command will work for you.






                      share|improve this answer

























                        4












                        4








                        4







                        I had the same issue with Ubuntu64 and I fixed by simply not using systemctl but instead this:



                        sudo service mysql restart


                        hopefully this command will work for you.






                        share|improve this answer













                        I had the same issue with Ubuntu64 and I fixed by simply not using systemctl but instead this:



                        sudo service mysql restart


                        hopefully this command will work for you.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Apr 26 '18 at 14:24









                        Faisal JulaidanFaisal Julaidan

                        412




                        412





















                            2














                            This one should work for the manually built mysql server:



                            sudo /usr/local/mysql/bin/mysqld_safe --user=mysql





                            share|improve this answer



























                              2














                              This one should work for the manually built mysql server:



                              sudo /usr/local/mysql/bin/mysqld_safe --user=mysql





                              share|improve this answer

























                                2












                                2








                                2







                                This one should work for the manually built mysql server:



                                sudo /usr/local/mysql/bin/mysqld_safe --user=mysql





                                share|improve this answer













                                This one should work for the manually built mysql server:



                                sudo /usr/local/mysql/bin/mysqld_safe --user=mysql






                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Feb 1 '17 at 12:04









                                Aram ParonikyanAram Paronikyan

                                1212




                                1212





















                                    1














                                    after installing MySQL on your system just do that:




                                    $ service mysql status




                                    if service down just does this :




                                    $ service mysql start




                                    and for stopping my service that :




                                    $ service mysql stop







                                    share|improve this answer


















                                    • 1





                                      /etc/init.d/mysql start and service mysql start are exactly the same.

                                      – storm
                                      Jul 26 '17 at 8:55















                                    1














                                    after installing MySQL on your system just do that:




                                    $ service mysql status




                                    if service down just does this :




                                    $ service mysql start




                                    and for stopping my service that :




                                    $ service mysql stop







                                    share|improve this answer


















                                    • 1





                                      /etc/init.d/mysql start and service mysql start are exactly the same.

                                      – storm
                                      Jul 26 '17 at 8:55













                                    1












                                    1








                                    1







                                    after installing MySQL on your system just do that:




                                    $ service mysql status




                                    if service down just does this :




                                    $ service mysql start




                                    and for stopping my service that :




                                    $ service mysql stop







                                    share|improve this answer













                                    after installing MySQL on your system just do that:




                                    $ service mysql status




                                    if service down just does this :




                                    $ service mysql start




                                    and for stopping my service that :




                                    $ service mysql stop








                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Jul 26 '17 at 8:42









                                    Manochehr RasouliManochehr Rasouli

                                    311




                                    311







                                    • 1





                                      /etc/init.d/mysql start and service mysql start are exactly the same.

                                      – storm
                                      Jul 26 '17 at 8:55












                                    • 1





                                      /etc/init.d/mysql start and service mysql start are exactly the same.

                                      – storm
                                      Jul 26 '17 at 8:55







                                    1




                                    1





                                    /etc/init.d/mysql start and service mysql start are exactly the same.

                                    – storm
                                    Jul 26 '17 at 8:55





                                    /etc/init.d/mysql start and service mysql start are exactly the same.

                                    – storm
                                    Jul 26 '17 at 8:55











                                    0














                                    A little script to cover both cases [server running/server not running]:



                                    #!/bin/bash

                                    service mysql restart
                                    if [ "$?" != "0" ]; then
                                    service mysql start
                                    fi





                                    share|improve this answer



























                                      0














                                      A little script to cover both cases [server running/server not running]:



                                      #!/bin/bash

                                      service mysql restart
                                      if [ "$?" != "0" ]; then
                                      service mysql start
                                      fi





                                      share|improve this answer

























                                        0












                                        0








                                        0







                                        A little script to cover both cases [server running/server not running]:



                                        #!/bin/bash

                                        service mysql restart
                                        if [ "$?" != "0" ]; then
                                        service mysql start
                                        fi





                                        share|improve this answer













                                        A little script to cover both cases [server running/server not running]:



                                        #!/bin/bash

                                        service mysql restart
                                        if [ "$?" != "0" ]; then
                                        service mysql start
                                        fi






                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Jul 4 '16 at 15:46









                                        ReverseEMFReverseEMF

                                        101




                                        101





















                                            0














                                            On ubuntu 18.04 the socket is defined in the file




                                            /etc/mysql/mysql.conf.d/mysqld.cnf



                                            socket = /var/run/mysqld/mysqld.sock




                                            The directory was not present so I created it manually as below:




                                            sudo mkdir -p /var/run/mysqld




                                            Restart mysql. That solved it for my case here.





                                            share








                                            New contributor




                                            Noel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                            Check out our Code of Conduct.
























                                              0














                                              On ubuntu 18.04 the socket is defined in the file




                                              /etc/mysql/mysql.conf.d/mysqld.cnf



                                              socket = /var/run/mysqld/mysqld.sock




                                              The directory was not present so I created it manually as below:




                                              sudo mkdir -p /var/run/mysqld




                                              Restart mysql. That solved it for my case here.





                                              share








                                              New contributor




                                              Noel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                              Check out our Code of Conduct.






















                                                0












                                                0








                                                0







                                                On ubuntu 18.04 the socket is defined in the file




                                                /etc/mysql/mysql.conf.d/mysqld.cnf



                                                socket = /var/run/mysqld/mysqld.sock




                                                The directory was not present so I created it manually as below:




                                                sudo mkdir -p /var/run/mysqld




                                                Restart mysql. That solved it for my case here.





                                                share








                                                New contributor




                                                Noel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                Check out our Code of Conduct.










                                                On ubuntu 18.04 the socket is defined in the file




                                                /etc/mysql/mysql.conf.d/mysqld.cnf



                                                socket = /var/run/mysqld/mysqld.sock




                                                The directory was not present so I created it manually as below:




                                                sudo mkdir -p /var/run/mysqld




                                                Restart mysql. That solved it for my case here.






                                                share








                                                New contributor




                                                Noel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                Check out our Code of Conduct.








                                                share


                                                share






                                                New contributor




                                                Noel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                Check out our Code of Conduct.









                                                answered 8 mins ago









                                                NoelNoel

                                                1012




                                                1012




                                                New contributor




                                                Noel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                Check out our Code of Conduct.





                                                New contributor





                                                Noel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                Check out our Code of Conduct.






                                                Noel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                Check out our Code of Conduct.



























                                                    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%2f82374%2fhow-do-i-start-stop-mysql-server%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

                                                    Möglingen Índice Localización Historia Demografía Referencias Enlaces externos Menú de navegación48°53′18″N 9°07′45″E / 48.888333333333, 9.129166666666748°53′18″N 9°07′45″E / 48.888333333333, 9.1291666666667Sitio web oficial Mapa de Möglingen«Gemeinden in Deutschland nach Fläche, Bevölkerung und Postleitzahl am 30.09.2016»Möglingen

                                                    Virtualbox - Configuration error: Querying “UUID” failed (VERR_CFGM_VALUE_NOT_FOUND)“VERR_SUPLIB_WORLD_WRITABLE” error when trying to installing OS in virtualboxVirtual Box Kernel errorFailed to open a seesion for the virtual machineFailed to open a session for the virtual machineUbuntu 14.04 LTS Virtualbox errorcan't use VM VirtualBoxusing virtualboxI can't run Linux-64 Bit on VirtualBoxUnable to insert the virtual optical disk (VBoxguestaddition) in virtual machine for ubuntu server in win 10VirtuaBox in Ubuntu 18.04 Issues with Win10.ISO Installation

                                                    Antonio De Lisio Carrera Referencias Menú de navegación«Caracas: evolución relacional multipleja»«Cuando los gobiernos subestiman a las localidades: L a Iniciativa para la Integración de la Infraestructura Regional Suramericana (IIRSA) en la frontera Colombo-Venezolana»«Maestría en Planificación Integral del Ambiente»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«Conózcanos»«Caracas: evolución relacional multipleja»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»