Freelance Web Programmer, Android, Php 5, java, MySql, JQuery, Symfony framework, Smarty template, facebook application, googlemap application
Friday, May 27, 2011
How to recover / change the root password on RedHat Linux based systems
How to recover / change the root password on RedHat Linux based systems
Power on, or reboot as needed.
and press 'tab' key
Now you should press 'e' and you will get this screen.
plz select kernel option
now press 'e'
Insert an space and the number one '1'.
After that press ENTER and 'b' and ENTER again.
Now you can change the password like this
#passwd
enter new password
then
give
#chmod u+s /bin/su
and
#exit
Power on, or reboot as needed.
and press 'tab' key
Now you should press 'e' and you will get this screen.
plz select kernel option
now press 'e'
Insert an space and the number one '1'.
After that press ENTER and 'b' and ENTER again.
Now you can change the password like this
#passwd
enter new password
then
give
#chmod u+s /bin/su
and
#exit
Tuesday, April 19, 2011
Enable Remote Access To Mysql Database Server
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
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
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
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...