Reputation: 110592
To find out the start command for mysqld (using a mac) I can do:
ps aux|grep mysql
I get the following output, which allows me to start mysql server.
/usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=...
How would I find the necessary command to stop mysql from the command line?
Upvotes: 222
Views: 566017
Reputation: 11
sudo launchctl list | grep -i mysql
sudo launchctl remove xxx.xxx.mysqlxxx
This works for me!
Upvotes: 1
Reputation: 85
if all else fails, this help me. Every time I tried to kill the process with the last installation it will respawn.
sudo rm -rf /usr/local/var/mysql
brew reinstall mysql
Upvotes: 0
Reputation: 125
first try this
sudo service apache2 stop
if not, then
sudo mysql stop
if not, then
sudo stop mysql
if not, then
sudo mysqladmin shutdown
I have been there, and I do with many tips, at the end of using tips that I follow will lead me to solved. So if you not solve in this issue, you just do other tips, till your issue get solved. Hopefully it's will help you. Thanks
Upvotes: 1
Reputation: 2676
When mysql was installed with Homebrew, it automatically restarts when killed. You need to use the following command:
brew services stop mysql
PS: If you installed a specific version, it will be [email protected]
Upvotes: 21
Reputation: 17
Upvotes: 1
Reputation: 1501
brew services stop mysql
Incase if you want to stop all brew services:
brew services stop --all
Upvotes: 0
Reputation: 41
/etc/init.d/mysql stop
service mysql stop
killall -KILL mysql mysqld_safe mysqld
When you see the following information, you success
mysql: no process found
mysqld_safe: no process found
mysqld: no process found
I use this to solve the installation problem of MySQL 5.6 in Ubuntu 15.10 using this link.
During this installation, I encounter the problem saying:
"mysqld_safe A mysqld process already exists"
Just completely stop the mysqld, mysqld_safe, mysql solves the problem.
Upvotes: 4
Reputation: 2426
To stop MariaDB and MySQL server instance:
sudo mysqladmin shutdown
To start MariaDB and MySQL server instance:
mysqld &
To change data ownership for MariaDB and MySQL server instance:
sudo chown -R 755 /usr/local/mariadb/data
Upvotes: 2
Reputation: 954
Try killing mysqld four times in a row. It's the only thing that worked for me...
root@ubuntu:/etc/init# killall -KILL mysqld
root@ubuntu:/etc/init# killall -KILL mysqld
root@ubuntu:/etc/init# killall -KILL mysqld
root@ubuntu:/etc/init# killall -KILL mysqld
mysqld: no process found
Just keep killing it over and over until you see "mysqld: no process found".
Upvotes: 8
Reputation: 8914
For mysql 5.7 downloaded from binary file onto MacOS:
sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
Upvotes: 0
Reputation: 19119
/Applications/MAMP/tmp/mysql/
which holds the mysql.pid
and mysql.sock.lock
filesUpvotes: -1
Reputation: 3684
To stop autostart of mysql on boot, the following worked for me with mysql 8.0.12
installed using Homebrew in macOS Mojave 10.14.1
:
rm -rf ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Upvotes: 2
Reputation: 266
sudo launchctl list | grep -i mysql
If the result shows anything like: "xxx.xxx.mysqlxxx"
sudo launchctl remove xxx.xxx.mysqlxxx
Example:
sudo launchctl remove org.macports.mysql56-server
sudo launchctl unload -wF /Library/LaunchDaemons/xxx.xxx.mysqlxxx.plist
Example:
sudo launchctl unload -wF /Library/LaunchDaemons/org.macports.mysql56-server.plist
Note: In some cases if you tried "a)" first, you need to reboot again before try b).
Upvotes: 21
Reputation: 687
If my mysql keeps restarting
sudo rm -rf /usr/local/var/mysql/dev.work.err
mysql.server stop
worked for me.
Upvotes: 2
Reputation: 2696
For Windows, you can run this command directly if mysql/bin is in your path.
mysqladmin -u root -p shutdown
Upvotes: 21
Reputation: 5761
Try:
/usr/local/mysql/bin/mysqladmin -u root -p shutdown
Or:
sudo mysqld stop
Or:
sudo /usr/local/mysql/bin/mysqld stop
Or:
sudo mysql.server stop
If you install the Launchctl in OSX you can try:
sudo launchctl unload -w /Library/LaunchDaemons/org.macports.mysql.plist
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql.plist
Note: this is persistent after reboot.
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart
I found that in: https://stackoverflow.com/a/102094/58768
Upvotes: 365
Reputation: 3676
On OSX 10.8 and on, the control for MySQL is available from the System Configs. Open System Preferences, click on Mysql (usually on the very bottom) and start/stop the service from that pane. https://dev.mysql.com/doc/refman/5.6/en/osx-installation-launchd.html
The plist file is now under /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
Upvotes: 14
Reputation: 410
Kill is definitly the wrong way! The PID will stay, Replicationsjobs will be killed etc. etc.
STOP MySQL Server
/sbin/service mysql stop
START MySQL Server
/sbin/service mysql start
RESTART MySQL Server
/sbin/service mysql restart
Perhaps sudo will be needed if you have not enough rights
Upvotes: 6
Reputation: 701
What worked for me on CentOS 6.4 was running service mysqld stop
as the root user.
I found my answer on nixCraft.
Upvotes: 3
Reputation: 1278
There is an alternative way of just killing the daemon process by calling
kill -TERM PID
where PID
is the value stored in the file mysqld.pid
or the mysqld process id which can be obtained by issuing the command ps -a | grep mysqld
.
Upvotes: 45
Reputation: 5454
for Binary installer use this:
to stop:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
to start:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
to restart:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart
Upvotes: 10