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
{ 17 comments… read them below or add one }
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
try the other commands –
# service mysqld start
# service mysqld stop
# service mysqld restart
These usually work for me
Thanks a lot for this! I really helped me out.
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
thanks
Hi,
I’m really embarrased to ask this, but I’m really new to linux + mysql. I installed mysql following the proceadure in http://dev.mysql.com/doc/refman/5.0/en/installing-binary.html, 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
Al
mysqld_safe is the recommended way to start a mysqld server if you install it from source or mysql.com:
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.0Type the following to start:
/etc/init.d/mysql startMany thanx!
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
What’s about Darwin with the ‘launchd’ installed? How do I restart mysql?
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 &
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?
Thanks a lot.
Hey thanks a lot,
Very very useful post.
you use the comand top
and see all process and look,
what procces using more Memory and use killall nameprocess or kill pid process
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.
Thanks, very works for me.
It saved my day. I know nothing about mysql and I hade to restart one!