Wednesday, August 17, 2011

File Backup Commands

   Here the list of commands which are normally used in creation of file backup.

bzip2             A block-sorting file compressor.
cdrecord       Record audio or data Compact Disks from a master.
dd                 Convert and copy a file
fdformat       Low-level formats a floppy disk.
gpg               Encrypt and decrypt data.
gzip               Compress or expand files.
mcopy          Copy MSDOS files to/from UNIX.
mdir              Display an MSDOS directory.
mformat       Add an MSDOS file system to a low-level formatted floppy disk.
mkbootdisk   Creates a stand-alone boot floppy for the running system.
mount           Mount a file system (integrate it with the current file system     
                     by connecting it to a mount point).
rsync             Synchronize directories.
tar                 Tape archiving utility, also used for making archives on disk
                     instead of on tape.
umount         Unmount file systems.

Sunday, August 7, 2011

How to Set and Reset Mysql Root Password

    MySQL root password is the essential task for securing DB. Here i have given some of the ways to set and reset the root password.

1.To set root password for first time:

root@debian:/home/mughil# mysqladmin -u root password NEWPASSWORD

2.To change or update the password:

root@debian:/home/mughil# mysqladmin -u root 'OLDPASSWORD' password 'NEWPASSWORD'

3.To change mysql password for other user:

root@debian:/home/mughil# mysqladmin -u user 'OLDPASSWORD' password 'NEWPASSWORD';

        However, If you forget the root password and login into mysql without username and password to reset the password as follow.

1.First you have to ensure whether mysql is stopped or not:

root@debian:/home/mughil# /etc/init.d/mysql stop
Stopping MySQL database server: mysqld.

2.After the mysql is stopped, you have to start in safe mode:

root@debian:/home/mughil# mysqld_safe --skip-grant-tables &

3.You can login into the mysql and set the password as follow:

root@debian:/home/mughil# mysql --user=root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.49-3 (Debian)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> update user set Password=PASSWORD('23534')  WHERE User='root';
Query OK, 3 rows affected (0.08 sec)
Rows matched: 3  Changed: 3  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.04 sec)

mysql> exit

      Now, you just need to stop the server, so that you can go back to running a secure MySQL.

Tuesday, August 2, 2011

How to get Hard-Disk serial number using Hdparm?

Hdparm ( get/set hard disk parameters ) can be used to find hard drive serials. If you have several hard drives installed and if you want to list all the model and serial numbers of the installed drive. You can retrieve them using

# hdparm -I /dev/sd? | grep -E “Number|/dev”