Tuesday, February 21, 2012

Configure Apache PHP MySQL on centos

Today, I will use centos minimal to setup a php server with mysql database
1. #yum -y update

2. install packets

yum -y install httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-mcrypt php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc mysql-connector-odbc mysql-devel libdbi-dbd-mysql


3. start http and mysql service, and set them as auto boot


[root@localhost ~]# service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
[ OK ]
[root@localhost ~]# service mysqld start
Initializing MySQL database: Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

[ OK ]
Starting mysqld: [ OK ]
[root@localhost ~]# chkconfig httpd on
[root@localhost ~]# chkconfig mysqld on

 

4. configure mysql

set mysql root password:
[root@localhost ~]#mysql -u root password 'your password'

Now we can access the web server with ip address.

========================================================
help


========================================================


If can not access check the status of iptables (linux firewall)
use the following commands to close the iptables:

[root@localhost ~]#service iptables status
[root@localhost ~]#service iptables stop
[root@localhost ~]#chkconfig iptables off


/etc/my.cnf mysql configuration file.
/etc/php.in php configuration file.

use command find to find out file:
find / -name my.cnf

html file dir: /var/www/html



--------------------------------------------------------------------------------------
[root@localhost etc]# find / -name mysqladmin
/usr/local/mysql/bin/mysqladmin
/data/mysql5/bin/mysqladmin
/var/www/mysql-5.5.2-m2/client/mysqladmin
[root@localhost etc]# /var/www/mysql-5.5.2-m2/client/mysqladmin -u root password 'zz'

No comments:

Post a Comment

Tomb sweeping day

It's Tomb-Sweeping Day Today. It's a very important traditional Chinese festival. It's a day for tomb-sweeping. People visit the...