首页 > 代码库 > xampp安装后,添加apache、mysql服务

xampp安装后,添加apache、mysql服务

配置mysql服务

[root@centos1 ~]# find / -name mysql.server
/opt/lampp/share/mysql/mysql.server
/opt/lampp/bin/mysql.server   ##mysql启动文件


[root@centos1 ~]# ln -s /opt/lampp/bin/mysql.server /etc/rc.d/init.d/mysql   ##软连接(理解为快捷键)
[root@centos1 ~]# vi /etc/rc.d/init.d/mysql   ##大概看了一眼


[root@centos1 ~]# chkconfig --add mysql   ##增加mysql的系统服务
[root@centos1 ~]# chkconfig --list mysql    ##列出mysql服务的设置情况
mysql              0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭


[root@centos1 ~]# netstat -an|grep :3306
tcp        0      0 :::3306                     :::*                        LISTEN     
[root@centos1 ~]# ps -aux|grep mysql
Warning: bad syntax, perhaps a bogus ‘-‘? See /usr/share/doc/procps-3.2.8/FAQ
root      2436  0.0  0.2   3044  1340 pts/0    S    11:46   0:00 /bin/sh /opt/lampp/bin/mysqld_safe --datadir=/opt/lampp/var/mysql --pid-file=/opt/lampp/var/mysql/centos1.pid
mysql     2797  0.6 19.0 330620 97348 pts/0    Sl   11:46   0:00 /opt/lampp/sbin/mysqld --basedir=/opt/lampp --datadir=/opt/lampp/var/mysql --plugin-dir=/opt/lampp/lib/mysql/plugin/ --user=mysql --log-error=/opt/lampp/var/mysql/centos1.err --pid-file=/opt/lampp/var/mysql/centos1.pid --socket=/opt/lampp/var/mysql/mysql.sock --port=3306
root      2830  0.0  0.1   5980   756 pts/0    S+   11:48   0:00 grep mysql
[root@centos1 ~]#

配置apache服务

[root@centos1 ~]# find / -name apachectl
/opt/lampp/bin/apachectl

[root@centos1 ~]# ln -s /opt/lampp/bin/mysql.server /etc/rc.d/init.d/mysql
[root@centos1 ~]# vi /etc/rc.d/init.d/mysql ##加入#chkconfig:2345 85 15

image
[root@centos1 ~]# chkconfig --add mysql
[root@centos1 ~]# chkconfig --list mysql
mysql              0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭
[root@centos1 ~]# service mysql stop
Shutting down MySQL.. SUCCESS!

[root@centos1 ~]# service mysql start
Starting MySQL.. SUCCESS!
[root@centos1 ~]# ps -aux|grep mysql
Warning: bad syntax, perhaps a bogus ‘-‘? See /usr/share/doc/procps-3.2.8/FAQ
root      2436  0.0  0.2   3044  1340 pts/0    S    11:46   0:00 /bin/sh /opt/lampp/bin/mysqld_safe --datadir=/opt/lampp/var/mysql --pid-file=/opt/lampp/var/mysql/centos1.pid
mysql     2797  0.8 19.0 330620 97348 pts/0    Sl   11:46   0:00 /opt/lampp/sbin/mysqld --basedir=/opt/lampp --datadir=/opt/lampp/var/mysql --plugin-dir=/opt/lampp/lib/mysql/plugin/ --user=mysql --log-error=/opt/lampp/var/mysql/centos1.err --pid-file=/opt/lampp/var/mysql/centos1.pid --socket=/opt/lampp/var/mysql/mysql.sock --port=3306
root      2824  0.0  0.1   5980   756 pts/0    S+   11:48   0:00 grep mysql

xampp安装后,添加apache、mysql服务