By default remote access to MySQL database server is disabled for security reasons. However, some time you need to provide remote access to database server from home or a web server.
Working on fedora 10, php 5.3.2 and mysql Server version: 5.1.47
Edit my.cnf File
Red Hat Linux/Fedora/Centos Linux file is located at /etc/my.cnf location
opne this file and search [mysqld]
and add bellow line
port = 3306
bind-address = your system ip
service mysqld restart
Open port 3306
open TCP port 3306 using iptables.
A sample iptables rule to open Linux iptables firewall
/sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT
save all rules
service iptables save
Example
<?php
$link = mysql_connect('host ip', 'username', 'password');
if (!$link) {
die('Could not connect: ' . mysql_error());
exit;
}
$db_selected = mysql_select_db('database',$link);
if (!$db_selected) {
die ('Can\'t use database : ' . mysql_error());
exit;
}
$sql = "SELECT id as col1, col2, col3 FROM sometable";
$result = mysql_query($sql);
if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
if (mysql_num_rows($result) == 0) {
echo "No rows found, nothing to print so am exiting";
exit;
}
while ($row = mysql_fetch_assoc($result)) {
echo $row["col1"];
echo " ".$row["col2"];
echo " ".$row["col3"];
}
mysql_free_result($result);
mysql_close($link);
?>
Base on : http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html
Freelance Web Programmer, Android, Php 5, java, MySql, JQuery, Symfony framework, Smarty template, facebook application, googlemap application
Tuesday, April 19, 2011
Thursday, April 7, 2011
windows desktop corrupted
if windows desktop corrupted
then copy explorer.exe from working windows folder to corrupted deskotp windows folder (same version)
then copy explorer.exe from working windows folder to corrupted deskotp windows folder (same version)
Tuesday, March 8, 2011
mount nfs no route to host
in fedora os
first open
vi /etc/exports
add bellow line
/home/USER_NAME/public_html 192.168.1.*(rw,async,no_root_squash)
exportfs -a -v
service nfs start
chkconfig nfs on
service portmap restart
chkconfig portmap on
service iptables stop
(if you want to iptables service permanently disable)
/sbin/chkconfig iptables off
then after mount nfs from other system bellow command
mount -o rw,async 192.168.1.(server id):/home/USER_NAME/web /home/USERS_NAME/MOUNT_DIR_NAME
auto mount in booting (server dir local sys dir)
192.168.1.1:/home/keval/web /home/keval/kevalweb nfs defaults 0 0
==============================
if ssh login not work on fedora
then try commnad through
passwd username
first open
vi /etc/exports
add bellow line
/home/USER_NAME/public_html 192.168.1.*(rw,async,no_root_squash)
exportfs -a -v
service nfs start
chkconfig nfs on
service portmap restart
chkconfig portmap on
service iptables stop
(if you want to iptables service permanently disable)
/sbin/chkconfig iptables off
then after mount nfs from other system bellow command
mount -o rw,async 192.168.1.(server id):/home/USER_NAME/web /home/USERS_NAME/MOUNT_DIR_NAME
auto mount in booting (server dir local sys dir)
192.168.1.1:/home/keval/web /home/keval/kevalweb nfs defaults 0 0
==============================
if ssh login not work on fedora
then try commnad through
passwd username
Monday, March 7, 2011
mysql data copy
start mysql
> mysql -h localhost -u root -p
create user
mysql> create user 'user_name'@'localhost' identified by 'password';
create database
mysql> create database db_name
use database
mysql> use db_name;
copy data from file
mysql> \. /home/user_name/Downloads/my_db.sql
> mysql -h localhost -u root -p
create user
mysql> create user 'user_name'@'localhost' identified by 'password';
create database
mysql> create database db_name
use database
mysql> use db_name;
copy data from file
mysql> \. /home/user_name/Downloads/my_db.sql
apache virtual host configuration
httpd.conf file setting
<IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
# permissions).
#
#UserDir disabled
#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disabled" line above, and uncomment
# the following line instead:
#
UserDir public_html
</IfModule>
make file /etc/httpd/conf.d/vhost.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.test.local
DocumentRoot /home/USER_NAME/public_html/www.test.com
<Directory /home/USER_NAME/public_html/www.test.com>
AllowOverride All
Options FollowSymlinks
Order Allow,Deny
Allow From All
</Directory>
</VirtualHost>
commond prompt
chcon -R -t htppd_sys_content_t /home//public_html
setsebool -P httpd_enable_homedirs true
/etc/hosts file entry
127.0.0.1 www.test.local
<IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
# permissions).
#
#UserDir disabled
#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disabled" line above, and uncomment
# the following line instead:
#
UserDir public_html
</IfModule>
make file /etc/httpd/conf.d/vhost.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.test.local
DocumentRoot /home/USER_NAME/public_html/www.test.com
<Directory /home/USER_NAME/public_html/www.test.com>
AllowOverride All
Options FollowSymlinks
Order Allow,Deny
Allow From All
</Directory>
</VirtualHost>
commond prompt
chcon -R -t htppd_sys_content_t /home/
setsebool -P httpd_enable_homedirs true
/etc/hosts file entry
127.0.0.1 www.test.local
Friday, February 18, 2011
Facebook app request
how to get facebook apprequest receiver user id
<a onclick="facebook_invitess_users(); return false;" href="#" class="link2">click here</a>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: 'your_appid', status: true, cookie: true, xfbml: true});
};
FB.init({appId: 'your_appid', status: true, cookie: true, xfbml: true});
var facebook_invitess_users = function() {
FB.ui(
{
method: 'apprequests',
message: rebuild,
data: 'tracking information for the user',
title: 'Choose the friends you would like to invite',
},
function(response) {
jQuery.post(
"submit_url",
{request_ids: response.request_ids},
function(data) { alert(data); },
"html"
);
}
);
}
</script>
submit url php file code
<?php
if(isset($_REQUEST['request_ids'])) {
$sent = $_REQUEST['request_ids']; //Convert csv to array
$count = count($sent); //count how many objects in array
$appid = 'facebook_app_id';
$secret = 'facebook_app_secrct';
$app_token = file_get_contents('https://graph.facebook.com/oauth/access_token?client_id='.$appid.'&client_secret='.$secret.'&grant_type=client_credentials');
//Get application token
for ($a = 0; $a < $count; $a++) {
$request = file_get_contents('https://graph.facebook.com/'.$sent[$a].'?'.$app_token);
print_r($request); // This will output like below
$arr = json_decode($request);
var_dump($arr);
print_r($arr->to->name);
print_r($arr->to->id);
}
}
?>
<a onclick="facebook_invitess_users(); return false;" href="#" class="link2">click here</a>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: 'your_appid', status: true, cookie: true, xfbml: true});
};
FB.init({appId: 'your_appid', status: true, cookie: true, xfbml: true});
var facebook_invitess_users = function() {
FB.ui(
{
method: 'apprequests',
message: rebuild,
data: 'tracking information for the user',
title: 'Choose the friends you would like to invite',
},
function(response) {
jQuery.post(
"submit_url",
{request_ids: response.request_ids},
function(data) { alert(data); },
"html"
);
}
);
}
</script>
submit url php file code
<?php
if(isset($_REQUEST['request_ids'])) {
$sent = $_REQUEST['request_ids']; //Convert csv to array
$count = count($sent); //count how many objects in array
$appid = 'facebook_app_id';
$secret = 'facebook_app_secrct';
$app_token = file_get_contents('https://graph.facebook.com/oauth/access_token?client_id='.$appid.'&client_secret='.$secret.'&grant_type=client_credentials');
//Get application token
for ($a = 0; $a < $count; $a++) {
$request = file_get_contents('https://graph.facebook.com/'.$sent[$a].'?'.$app_token);
print_r($request); // This will output like below
$arr = json_decode($request);
var_dump($arr);
print_r($arr->to->name);
print_r($arr->to->id);
}
}
?>
Sunday, January 24, 2010
Mount Abu



Weather
In Summer: 33.8 C (Max) - 23.3 C (Min)
In winter: 20.3 C (Max) - 0 C (Min)
Rainy Season : from July to Mid Sept, and very humid (Upton 90%)
My suggestion: Feb to June , Sept. Dec.
Transportation
The nearest railway station is at Abu Road, in the lowlands 27 km southeast of Mount Abu town. The station is on the main Indian Railways line between Delhi,Palanpur and Ahmedabad. It has regular trains for Jaipur, Jodhpur, Udaipur, Ajmer, Kotha, Indore, Bhopal, Gwalior, Jabalpur, Ujjain, Delhi, Mumbai, Calcutta, Madras, Hyderabad, Bangalore, Ahmedabad and Pune
Bellow rate is Junaray 2010
Taxi availabel Abu road to Mount Abu 20 rupees per person.
Nearest site is Udaipur 155 km. Travel bus fair is 150 rupees per person.
and Ahmedabad is 190 km. Travel bus fair is 160 rupees per person.
Hotel
Hotel shalimar ph. 91-2974-238738 1 night stay aprox 400 rs. checkin time 9:00 am
Hotel vilas ph. 91-2974-235086 1 night stay aprox 400 rs. checkin time 9:00 am
Hotel santosh ph. 91-2974-264749 1 night stay aprox 300 rs. checkin time 9:00 am
Hotel meera ph. 91-2974-235418 1 night stay aprox 300 rs. checkin time 9:00 am
Places of tourist in mount abu
Distance from bus stand
1. Nakki lake 1 km
2. Sunset Point 2.5 km
3. Universal peace hall 2 km
4. Adhar Devi 2.5 km
5. Delwar Temple 3.5 km
6. Peace Park 10 km
7. Guru shikhar 18.00 km
8. AchalGarh 12.00 km
Walkin distance
1. Nakki lake, Sunset Point, Universal peace hall 2 km
2. Adhar Devi, Delwar Temple
There is available taxi for all day site seen take 400-500 rs a day.
and buses rent is 80 rs per person 9:00 am to 6:30
And also avilable bike for rent it price is 200 rs a day.
My suggest rent a bike on full day to see all place like
1. Peace Park 10, Guru shikhar, AchalGarh, Adhar Devi, Delwar Temple (all place in one root)
Other place is
Gyan sarovar, toadrock, gaumukh
Jain panch thirth
Pawapuri, bherutarak, jeerawala, dattani & padmavati jain temple
Ambaji Return Tour
Ambaji Temple, Gabbar Temple, kumbhariaji and Koteshwar
2 Mount Abu to Ambaji bus fair is 35-40 rs per person
------------------------About Mount Abu -------------------------
The town of Mount Abu, the only hill station in Rajasthan, is located at an elevation of 1220 meters. It has been a popular retreat from the heat of Rajasthan and neighbouring Gujarat for centuries. The Mount Abu Wildlife Sanctuary was established in 1960 and covers 290 sq. km of the mountain.
Mount Abu is home to a number of Jain temples. The Dilwara Temples are a complex of temples, carved of white marble, that were built between the 11th and 13th centuries AD. The oldest of these is the Vimal Vasahi temple, built in Nr. 1000 AD by Vimal Shah and dedicated to the first of the Jain Tirthankaras. The Lun Vasahi Temple were built in Nr. 1200 AD by the brothers Vastupal and Tejpal, who belonged to the Porwal Jain community. They were ministers of Raja Vir Dhawal, a local ruler of Gujarat.
The Achalgarh fort, built in the 14th century by Rana Kumbha of Mewar, stands nearby. It encloses several beautiful Jain temples, including the Achaleswar Mahadev Temple (Nr. 1400) and the Kantinath Temple (Nr. 1500).
Nakki Lake is another popular visitor attraction of Mount Abu.There is the Toad Rock on a hill near the lake. Raghunath Temple and Maharaja Jaipur Palace are also on hills near Nakki Lake.
The mountain is also home to several Hindu temples, including the Adhar Devi Temple, carved out of solid rock; the Shri Raghunathji Temple; and a shrine and temple to Dattatreya built atop the Guru Shikhar peak. The world headquarters of the Brahma Kumari order of lady renunciates is also located here, as is the World Spiritual University of the same denomination. The Durga temple, Ambika Mata Temple lies in a cleft of rock in Jagat, just outside of Mount Abu.
Subscribe to:
Posts (Atom)
how to see xml preview in browser php
xml preview view in browser $xml = new DOMDocument('1.0', 'UTF-8'); $xml->preserveWhiteSpace = false; ...
-
Weather In Summer: 33.8 C (Max) - 23.3 C (Min) In winter: 20.3 C (Max) - 0 C (Min) Rainy Season : from July to Mid Sept, and very humid (Upt...
-
Open oracle virtual machine Open file preferences Click on left panel network Open tab host only network Right click on vboxnet0 Open d...
-
Android Studio menu -> tools -> Android -> Android Device Monitor open window dialog select Emulator Control Telephony Act...