Issue
Does "service mysql start" start the mysql server or client?
I have done as much searching on this topic as I can, and the answers do seem all over the place. Some sites state that the "service mysql start" starts the server, while others state that one must use "service mysqld start": e.g.: http://theos.in/desktop-linux/tip-that-matters/how-do-i-restart-mysql-server/
To elaborate some more - my understanding is that "mysql" is the process that represents the client interface that connects to a mysql server (either remote or local) and "mysqld" is the process for the server. I would assume that "service mysql start" would only start the mysql client (not the server) and I can use this client to connect to any mysql server. And if I haven't used "service mysqld start", no server would have been started on the local host and therefore I can't use the mysql client to connect to any local mysql server. Is my understanding correct?
Also, I am using a Red Hat server.
Any clarifications and explanations most appreciated - Thanks!
Solution
mysql client is never (AFAIK) run as a service, so
service mysql start
will start mysql server. To be precise, this will start service that is described in /etc/init.d/mysql script.
Some distributions name their init script differently, for example mysqld. So you should just check your /etc/init.d/
You can check what exactly that scipt is doing, even if you don't know bash. First few lines should contain short description, in case of my ubuntu installation it is:
# cat /etc/init.d/mysql
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: mysql
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $network $time
# Should-Stop: $network $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop the mysql database server daemon
# Description: Controls the main MySQL database server daemon "mysqld"
# and its wrapper script "mysqld_safe".
### END INIT INFO
So as you can see, mysql service script takes care of mysqld daemon (process). As opposed to mysql binary, found for example in /usr/bin which is client program and doesn't require any service to be running on your OS.
To sum everything up:
# service mysql start
will start server (daemon/service), then you can connect to it with
$ mysql -u root -p
Answered By - konserw Answer Checked By - Willingham (WPSolving Volunteer)