Skip to main content

how to connect httpd service to mysqld service

connecting http service to mysql service


this is tutorial to connecting htttpd and mysqld on separated pc (dedicated server)

on this example information provides for the database server has ip address 192.168.1.100, and the web server has ip address 192.168.1.200
this tutorial is using oracle linux server 6 but this can be applied to rhel-based distributions

on the database server pcaccess your server,
$ mysql -u root mysql

create new database,
mysql>create database namedb;

create database user,
mysql>create user 'user'@'host_ip_addr_webserver' identified by 'password'
note : use sign '%' at host if you want your database server to be accessed from any IP's

give user created to access database,
mysql>grant all on namedb.* to 'user'@'host_ip_addr_webserver';

mysql>flush privileges;
mysql>exit

edit iptables to open port tcp:3306

on the web server pc
check first your pc can remotely access database on another pc
$ mysql -u user -h ip_addr_databaseserver -p

if success, continue to next step
here i use wordpress cms to gain access database on database server
edit wordpress configuration file, wp-config.php, locate line parameters below

/** MySQL hostname*/
Define('DB_HOST','localhost')

edit 'locahost' change to 'ip_addr_database_server'

edit selinux to allow web server to access database server
# setsebool -P httpd_can_network_connect_db=1

edit iptables to open port tcp:80

source selinux config :
http://stackoverflow.com/questions/4078205/php-cant-connect-to-mysql-with-error-13-but-command-line-can

Comments

Popular posts from this blog

Installing Qualcomm Atheros AR8162 Fast Ethernet Driver on Lenovo G400

I was preparing Lenovo G400 laptop for my linux class, after I installed CentOS 6.5 on it, tada,,,, my ethernet adapter won't show up. I checked with ifconfig command but where the hell my eth0 ??. Then i type the command below : # lspci -v 01:00.0 Ethernet controller: Qualcomm Atheros AR8162 Fast Ethernet (rev 10)     Subsystem: Lenovo Device 3802     Flags: bus master, fast devsel, latency 0, IRQ 32     Memory at 90500000 (64-bit, non-prefetchable) [size=256K]     I/O ports at 2000 [size=128]     Capabilities: <access denied>     Kernel driver in use: alx It seem my wired network adapter do not have its driver. After searching on the net then I find this great article. I wrote it out on my blog to make it sure I have notes for the trouble. This is how we troubleshoot it :   First download this file : alx-linux-v2.0.0.6.rar unrar it, run make command, change directory...

All certification

Honor Code Certificate from edX - Linux Foundation