Use the following command to dump and restore mysql database
mysqldump -u root -p dbName > /var/www/dbBackup.sql
mysql -u root -p dbName < /var/www/dbBackup.sql
Friday, December 17, 2010
Monday, December 13, 2010
SCP command to transfer files using putty or shell
transfer the files from user localhost machine to remote server
$scp -r /home/myfolder/* root@remote server ip:/root/myfolder
if remote server running on different port
$scp -r -P remoteserverportnumer /home/myfolder/* root@remote server ip:/root/myfolder
$scp -r /home/myfolder/* root@remote server ip:/root/myfolder
if remote server running on different port
$scp -r -P remoteserverportnumer /home/myfolder/* root@remote server ip:/root/myfolder
Monday, November 29, 2010
install clamAV on httpd server
We need to check following
php-devel and clamav-devel.
To check for the software, use the commands below:
If nothing is returned from either rpm command, you will need to install the devel for the appropriate version.
If not installed the php-devel and clamav-devel install using yum
like
CODE
yum install php-devel
extract the library
Note: /usr/lib/php/modules is my modules directory. Your module directory may be different. Search /etc/php.ini for extension_dir to get yours.
Edit /etc/php.ini (Make sure you make a backup!)
Add the following under the "Dynamic Extensions" section:
Note: My clamav.dbpath may be different than yours. Do a simple locate main.cvd for the db directory.
Test to see if it works:
[PHP] echo cl_info() . "
";
$file = "/tmp/eicar.com";
cl_scanfile_ex($file, CL_SCAN_STDOPT, $virus, $retcode);
if ($retcode == CL_VIRUS)
echo $file . " returns: " . cl_pretcode($retcode) . " virus name: " . $virus . "
";
else
echo $file . " returns: " . cl_pretcode($retcode) . "
";
?>[/PHP]
Go to http://www.phpclamavlib.org/ for more information on the functions included with this module.
Good luck!
php-devel and clamav-devel.
To check for the software, use the commands below:
CODE
rpm -q php-devel
CODE
rpm -q clamav-devel
If nothing is returned from either rpm command, you will need to install the devel for the appropriate version.
If not installed the php-devel and clamav-devel install using yum
like
CODE
yum install php-devel
extract the library
CODE
tar xvzf php-clamavlib-0.12a.tar.gz
CODE
cd php-clamav-0.1
CODE
phpize
CODE
./configure --with-clamav
CODE
make
CODE
cp modules/clamav.so /usr/lib/php/modules
Note: /usr/lib/php/modules is my modules directory. Your module directory may be different. Search /etc/php.ini for extension_dir to get yours.
Edit /etc/php.ini (Make sure you make a backup!)
Add the following under the "Dynamic Extensions" section:
CODE
extension=clamav.so
[clamav]
clamav.dbpath="/var/clamav"
clamav.maxreclevel=0
clamav.maxfiles=0
clamav.archivememlim=0
clamav.maxfilesize=0
clamav.maxratio=0
[clamav]
clamav.dbpath="/var/clamav"
clamav.maxreclevel=0
clamav.maxfiles=0
clamav.archivememlim=0
clamav.maxfilesize=0
clamav.maxratio=0
Note: My clamav.dbpath may be different than yours. Do a simple locate main.cvd for the db directory.
Test to see if it works:
[PHP] echo cl_info() . "
";
$file = "/tmp/eicar.com";
cl_scanfile_ex($file, CL_SCAN_STDOPT, $virus, $retcode);
if ($retcode == CL_VIRUS)
echo $file . " returns: " . cl_pretcode($retcode) . " virus name: " . $virus . "
";
else
echo $file . " returns: " . cl_pretcode($retcode) . "
";
?>[/PHP]
Go to http://www.phpclamavlib.org/ for more information on the functions included with this module.
Good luck!
Mysql dump and restore database
To dump and restore all database of mysql server use following command
mysqldump -u root -psecret --all-databases > /var/www/backup.sql
mysql -u root -psecret < /var/www/backup.sql
mysqldump -u root -psecret --all-databases > /var/www/backup.sql
mysql -u root -psecret < /var/www/backup.sql
Thursday, November 18, 2010
mysql access denied for user 'root@localhost' using password yes
we are getting the comman error for phpmyadmin login
or doing the new set of mysql and trying to connect mysql
mysql access denied for user 'root@localhost' using password yes
Solution
or doing the new set of mysql and trying to connect mysql
mysql access denied for user 'root@localhost' using password yes
Solution
root@localhost$ mysqladmin -u root password NEWPASSWORD OR you want to update root@localhost$ mysqladmin -u root -p 'OLDPASSWORD' password NEWPASSWORD
issue get resolved... if still issue try to do following... 1) Restart mysql service myqsql restart
if still issue do following
1) execute following command$ mysqlmysql > use mysqlmysql >UPDATE mysql.user SET Password=PASSWORD("*******")WHERE User="root"; mysql > FLUSH PRIVILEGES;
mysql > quit;
Update the root password for mysql database
To update the password of mysql database for root user
1) Login in into mysql prompt.
mysql>UPDATE mysql.user SET Password=PASSWORD("*******") WHERE User="root";
mysql>FLUSH PRIVILEGES;
done.
1) Login in into mysql prompt.
mysql>UPDATE mysql.user SET Password=PASSWORD("*******") WHERE User="root";
mysql>FLUSH PRIVILEGES;
done.
Wednesday, November 17, 2010
check/repair file system - Linux
Use fsck command to check/repair file system in linux
e.g
1) if file system is ext3 and you want to check the disk mounted on sda1 then use following command
fsck -t ext3 /dev/sda1
1) if file system is ext4 and you want to check the disk mounted on sda2 then use following command
fsck -t ext4 /dev/sda2
How to check which file system is installed.
Run following command
mount
How to check the mounted file system,
Run following command
fdisk -l
e.g
1) if file system is ext3 and you want to check the disk mounted on sda1 then use following command
fsck -t ext3 /dev/sda1
1) if file system is ext4 and you want to check the disk mounted on sda2 then use following command
fsck -t ext4 /dev/sda2
How to check which file system is installed.
Run following command
mount
How to check the mounted file system,
Run following command
fdisk -l
Subscribe to:
Posts (Atom)