How Do I Restart MySQL Server?

Each distribution comes with a shell script (read as service) to restart / stop / start MySQL server. First login as root user and open shell prompt (command prompt).

First login as root user. Now type the following command as per your Linux distro:

A) If you are using mysql on RedHat Linux (Fedora Core/Cent OS) then use following command:

* To start mysql server:

/etc/init.d/mysqld start

* To stop mysql server:

/etc/init.d/mysqld stop

* To restart mysql server

 /etc/init.d/mysqld restart

Tip: Redhat Linux also supports service command, which can be use to start, restart, stop any service:

# service mysqld start
# service mysqld stop
# service mysqld restart

(B) If you are using mysql on Debian / Ubuntu Linux then use following command:

* To start mysql server:

/etc/init.d/mysql start

* To stop mysql server:

/etc/init.d/mysql stop

* To restart mysql server

/etc/init.d/mysql restart

More MySQL articles are here and here.

Author: admin

I like chocolate, gadgets, open source software, photography, traveling and all shades of green colors. I love spending time with fun loving friends and family members. This is my own online journal.

38 thoughts on “How Do I Restart MySQL Server?”

  1. hi
    i am new to linux and i have to stop the mysqld service so as to install bugzilla … i have tried the following cmds but they have failed
    /etc/init.d/mysqld stop
    i am using redhat os

  2. try the other commands –

    # service mysqld start
    # service mysqld stop
    # service mysqld restart

    These usually work for me

  3. hi
    iam using centos 5.0 and ihave problem with mysql
    mysql cant connect
    i have try to restart n all command which u show on your web but its unsuccesfull
    can tell me why..?n what can i do to get mysql back like before

  4. Hi,
    I’m really embarrased to ask this, but I’m really new to linux + mysql. I installed mysql following the proceadure in, then I try to run your restart command and I get: -bash: /etc/init.d/mysql: No such file or directory.
    I’m using mysql 5.0 over Debian… I’m sure I missed some configuration little detail, what can it be?
    Any response is well appreciated :)

  5. mysqld_safe is the recommended way to start a mysqld server if you install it from source or
    mysqld_safe &

    The correct method to install it via apt-get under Debian and Ubuntu Linux. Type the following to install
    apt-get install mysql-server-5.0 mysql-client-5.0
    Type the following to start:
    /etc/init.d/mysql start

  6. Hi thanks for this site, I sometimes have to restart the mysqld server myself, when it hangs. So this is really helpful, best result on google :)

  7. You can also use:
    # kill mysqld
    .. wait till it shuts down – you can check by
    # ps ax | grep mysql
    then start it:
    # cd /usr/local/mysql/bin (or where your mysql is installed)
    # ./mysqld_safe &

  8. For fedora, You must start mysqld everytime you boot up your pc, using /etc/init.d/mysqld start
    If you stop without knowing it is starting it will show errors, you must start first, ok?

  9. you use the comand top
    and see all process and look,
    what procces using more Memory and use killall nameprocess or kill pid process

  10. Hi, everyone. I’ve developed a project in php which requires one shell file as backup/output, one same file – manually updated. Between these two shell files if anyone is changed, the newer should update the older one. I’ve done it already by shell script but after the update process I need to restart the service I’m working on. I know the terminal command which is “/etc/init.d/service_name restart” but when I put this in my shell file it doesn’t work. Everything else are working but not the restart command. Can anyone help me out? Thanks in advance.

  11. I have got a problem with MySQL. I can’t connect to the server, get the message: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

    I am running Kubuntu 9.10,

    I had moved my MySQL database from my stationary PC to my laptop. Everything seemed to function OK, but so I got the preceding error message both from MySQL Navigator, Knoda and trying to connect from the terminal window. Restarting the server didn’t help. Where to search for the error? I am new to MySQL.

  12. you are my hero, now I know how to restart mysql… it also works the same for apache2 :)

  13. how to start the server with password???
    when i used these commands i got it!
    administrator@administrator-desktop / $ /etc/init.d/mysql start
    * Starting MySQL database server mysqld
    cat: /var/run/mysqld/ Permission denied

    Is there any suitable commands?….

  14. how to start . then system is started then my sqld , tomcat services are start give me advice

  15. Hi everyone,

    when i tried to restart mysql server i got the error as “Access denied for user@localhost” then i tried to run mysql script externally,
    cd /etc/init.d/
    ./mysql restart
    it works,.. mine is linux ubuntu 9.04 Debian based

  16. I have somehow lost all permissions on root and don’t currently have any other users. This is troublesome because I don’t have the privileges to give myself privileges or create new users. I also don’t know how to start the mysql program with –skip-grant-tables, or I would try this. Any help would be great.

  17. i am using fedora 13 . one problem with me is mysql is not start by using the command /etc/init.d/mysqld start if i use thid command then showing the message Command not found. Similar command is: ‘mysql’
    please solve my problem……….

  18. Sounds like you only have a part of MySQL installed, you also need the client.
    Try ‘sudo apt-get install mysql-client-5.1’

    and then follow the steps mentioned above to start. During the install you should be prompted for setting the MySQL password etc.

  19. Can’t locate mysqld and mysqladmin after deploying from rpm package. I can’t deploy rpm without using root. So can anyone help me? It keeps saying cannot start mysql on root, asked to check security part in the manual. But can’t search manual because it has error. Can someone help?

  20. Does anybody knows what is the difference between “/etc/init.d/mysqld restart” and “/etc/init.d/mysqld reload”?

  21. Don’t forget:
    $ service mysql start
    $ service mysql stop
    $ service mysql restart
    These worked for me, at least.

  22. thanks a bunch. my EC2 server was acting up and all it needed was a quick restart.

  23. @Tyrotoxism

    For me the shortcut is
    $ service mysqld start
    $ service mysqld stop
    $ service mysqld restart

  24. Thank you! my home server was stuck and my wordpress said something like “database error”. Your post solved the problem!

Leave a Reply

Your email address will not be published. Required fields are marked *