1。直接用mysqld手工启动
[root@ora11g bin]# ./mysqld --defaults-file=../my.cnf :: [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root! :: [ERROR] Aborting :: [Note] ./mysqld: Shutdown complete [root@ora11g bin]# ./mysqld --defaults-file=../my.cnf --user=mysql :: InnoDB: The InnoDB memory heap is disabled :: InnoDB: Mutexes and rw_locks use InnoDB's own implementation :: InnoDB: Compressed tables use zlib :: InnoDB: Using Linux native AIO :: InnoDB: Initializing buffer pool, size = 128.0M :: InnoDB: Completed initialization of buffer pool :: InnoDB: highest supported file format is Barracuda. InnoDB: The log sequence number in ibdata files does not match InnoDB: the log sequence number in the ib_logfiles! :: InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... :: InnoDB: Waiting for the background threads to start :: InnoDB: started; log sequence number :: [Note] Server :: [Note] - '0.0.0.0' resolves to '0.0.0.0'; :: [Note] Server socket created on IP: '0.0.0.0'. :: [Note] Event Scheduler: Loaded events :: [Note] ./mysqld: ready for connections. Version: Source distribution [root@ora11g ~]# ps -ef | grep mysql mysql : pts/ :: ./mysqld --defaults-file=../my.cnf --user=mysql root : pts/ :: grep mysql [root@ora11g ~]#
2.安全启动
[root@ora11g bin]# ./mysqld_safe --defaults-file=../my.cnf --user=mysql & [] [root@ora11g bin]# :: mysqld_safe Logging to '/usr/local/mysql/data/ora11g.err'. :: mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data [root@ora11g bin]# ps -ef | grep mysql root : pts/ :: /bin/sh ./mysqld_safe --defaults-file=../my.cnf --user=mysql mysql : pts/ :: /usr/local/mysql/bin/mysqld --defaults- root : pts/ :: grep mysql [root@ora11g bin]#
3.用服务的方式启动
[root@ora11g support-files]# [root@ora11g support-files]# ./mysql.server start Starting MySQL [ OK ] [root@ora11g support-files]# ps -ef | grep mysql root : pts/ :: /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/ora11g.pid mysql : pts/ :: /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin- root : pts/ :: grep mysql [root@ora11g support-files]#
把mysql.server cp到 /etc/rc.d/init.d/mysql,再chkconfig --add mysql就ok了
[root@ora11g support-files]# cp mysql.server /etc/rc.d/init.d/mysql [root@ora11g support-files]# chkconfig --add mysql [root@ora11g support-files]# chkconfig --list | grep mysql mysql :off :off :on :on :on :on :off [root@ora11g support-files]# service mysqld stop mysqld: unrecognized service [root@ora11g support-files]# service mysql stop Shutting down MySQL. [ OK ] [root@ora11g support-files]# service mysql start Starting MySQL.. [ OK ] [root@ora11g support-files]# ps -ef | grep mysql root : pts/ :: /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/ora11g.pid mysql : pts/ :: /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin- root : pts/ :: grep mysql [root@ora11g support-files]#
查看mysql的启动时的参数:
[root@ora11g bin]# ./mysqld --help --verbose | less