LAMP安装各种问题解决(3)

mysql安装文件(除了data)的主人都改为root,避免数据库恢复为出厂设置。

shell># chown -R root /usr/local/mysql

shell># chown -R mysql /usr/local/mysql/data

& 后台运行mysql服务

shell># /usr/local/mysql/bin/mysqld_safe --user=mysql &

//查看mysql是否有启动

shell># ps –A | grep mysql

测试数据库

shell># /usr/local/mysql/bin/mysql –u root

mysql> show databases;   

接上步,修改mysql密码(可不做此步,默认无密码)

mysql> UPDATE user SET Password=password('123456') WHERE user='root';

mysql> flush privileges;

配置开机自启动服务项

shell># cp 安装包解压目录/support-files/mysql.server /etc/init.d/mysqld

shell># chmod +x /etc/init.d/mysqld

shell># chkconfig --add mysqld

shell># chkconfig mysqld on //设置开机自启动

配置文件路径:

shell># vi /etc/rc.d/rc.local

文件中增加启动相关服务的命令如下:

/usr/local/http2/bin/apachectl start

/usr/local/mysql/bin/mysqld_safe --user=mysql &

service vsftpd start

重新安装apache启动失败

[root@localhost httpd-2.2.19]# /usr/local/http2/bin/apachectl restart

httpd not running, trying to start

(98)Address already in use: make_sock: could not bind to address [::]:80

(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80

no listening sockets available, shutting down

Unable to open logs

原因是80端口被占用

解决:

查看80端口使用情况

[root@localhost httpd-2.2.19]# netstat -lnp|grep 80

tcp 0 0 :::80 :::* LISTEN 28195/httpd

unix 2 [ ACC ] STREAM LISTENING 6580 1957/gpm /dev/gpmctl

unix 2 [ ACC ] STREAM LISTENING 5422 1800/pcscd /var/run/pcscd.comm

查看80的使用者是谁端口

[root@localhost httpd-2.2.19]# ps 28195

PID TTY STAT TIME COMMAND

28195 ? Ss 0:00 /usr/local/http2/bin/httpd -k restart

LAMP安装各种问题解决

经过分析知道了80端口被系统的一个进程占用,这个进程是旧的apache服务

将这个进程杀之

[root@localhost httpd-2.2.19]# kill -9 28195

[root@localhost httpd-2.2.19]#

十一.卸载操作系统自带apache

LAMP安装各种问题解决

删除默认apache进程

ps –A | grep http

杀死apache对应进程

LAMP安装各种问题解决

killall httpd 杀死全部的httpd进程

把默认apache服务给删除

LAMP安装各种问题解决

启动自己的apache

 

下面关于LAMP相关的内容你可能也喜欢

LAMP平台安装Xcache和Memcached加速网站运行   

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/8d058c4a40cbfedf6a91bf55aace2d09.html