How to Start MySQL Server

Start up MySQL server .

  1. Run /etc/init.d/mysql script , which is called when system start up or shut down. It calls “mysqld_safe” when start up mysqld server.

Usage: mysql  {start|stop|restart|reload|force-reload|status}  [ MySQL server options ]

# find /etc/ -name *mysql* -exec ls {} -ltr \;
-rw-r--r--. 1 root root 844 Jan 30 00:55 /etc/logrotate.d/mysql
-rw-r--r--. 1 root root 2135 Jan 29 2014 /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
-rwxr-xr-x. 1 root root 10880 Mar 24 16:37 /etc/rc.d/init.d/mysql.server
-rwxr-xr-x. 1 root root 10815 Jan 30 00:55 /etc/rc.d/init.d/mysql
lrwxrwxrwx. 1 root root 15 Mar 24 23:31 /etc/rc.d/rc0.d/K36mysql -> ../init.d/mysql
lrwxrwxrwx. 1 root root 15 Mar 24 23:31 /etc/rc.d/rc1.d/K36mysql -> ../init.d/mysql
lrwxrwxrwx. 1 root root 15 Mar 24 23:31 /etc/rc.d/rc2.d/S64mysql -> ../init.d/mysql
lrwxrwxrwx. 1 root root 15 Mar 24 23:31 /etc/rc.d/rc3.d/S64mysql -> ../init.d/mysql
lrwxrwxrwx. 1 root root 15 Mar 24 23:31 /etc/rc.d/rc4.d/S64mysql -> ../init.d/mysql
lrwxrwxrwx. 1 root root 15 Mar 24 23:31 /etc/rc.d/rc5.d/S64mysql -> ../init.d/mysql
lrwxrwxrwx. 1 root root 15 Mar 24 23:31 /etc/rc.d/rc6.d/K36mysql -> ../init.d/mysql
-rw-r--r--. 1 root root 10168 Mar 1 04:18 /etc/selinux/targeted/modules/active/modules/mysql.pp
-rw-r--r--. 1 root root 10168 Mar 1 04:47 /etc/selinux/targeted/modules/tmp/modules/mysql.pp
-rw-r--r--. 1 root root 1060 Jan 29 2014 /etc/yum.repos.d/mysql-community-source.repo
-rw-r--r--. 1 root root 1209 Mar 24 14:43 /etc/yum.repos.d/mysql-community.repo

2) Run /etc/init.d/mysql.server, which is same as /etc/init.d/mysql. Check and adjust the hard coded directories.

3) run “bin/mysqld_safe –user=mysql &”

#bin/mysqld_safe --user=mysql &"

MySQL server be run using an unprivileged (non-root) login account. To ensure this if you run mysqld_safe as root, include the –user option as shown. Otherwise, execute the program while logged in as mysql, in which case you can omit the –user option from the command.

 4) Run mysqld directly.

# /sbin/mysqld  --user=mysql &

5) Run service.

# service mysqld start|stop|status