today i am going to show how to get mysql backup and also how to restore it. example - all database full backup mysqldump -u root -p --all-databases > all.sql only one(database name -kasun) database mysqldump -u root -p kasun > kasun.sql restore database mysql -u root -p kasun < kasun.sql mysql -u root -p --all-databases < all.sq thaz for all..:)
Friday, November 18, 2011
mysql database backup and restore
Thursday, November 10, 2011
How to load an IOS into a Cisco router using the rommon mode
- Start the TFTP server (make sure the file path is correct and that you allow both transfer and receive)
- Connect to the router via Ethernet cable (an Ethernet cable is preferred due to the large size of the file and the maximum speed that data can travel over the console cable)
- At the rommon prompt enter the following commands (commands are case sensitive, and the use of the directional arrows and tab auto complete function is not allowed):
IP_ADDRESS=IP address of the Ethernet port
IP_SUBNET_MASK=subnet mask of the Ethernet port
DEFAULT_GATEWAY=the default gateway
TFTP_SERVER=the IP of the TFTP server (your local computer)
TFTP_FILE=the file name of the IOS file
tftpdnld
- The router will then issue a warning message:
WARNING: all existing data in all partitions on flash will be lost!
Do you wish to continue? y/n: [n]: y
- Enter y, and the IOS will load
- Once loaded you must boot up the new IOS by issuing the boot command
- Connect to the router using the light blue Cisco console cable (make sure the RJ-45 connector is plugged into the console port on the router) using the 9600-8-N-1 settings. The next two steps (changing the console baud rate) are optional.
- In ROMmon mode, change the baud rate to 15200 using the confreg command.
Configuration Summary
enabled are:
break/abort has effect
console baud: 9600
boot: the ROM monitor
enable "diagnostic mode"? y/n [n]:
enable "use net in IP bcast address"? y/n [n]:
enable "load rom after netboot fails"? y/n [n]:
enable "use all zero broadcast"? y/n [n]:
disable "break/abort has effect"? y/n [n]:
enable "ignore system config info"? y/n [n]:
change console baud rate? y/n [n]: y
enter rate: 0 = 9600, 1 = 4800, 2 = 1200, 3 = 2400
4 = 19200, 5 = 38400, 6 = 57600, 7 = 115200 [0]: 7
change the boot characteristics? y/n [n]:
Configuration Summary
enabled are:
break/abort has effect
console baud: 115200
boot: the ROM Monitor
You must reset or power cycle for new config to take effect.
- When you reset the router in your console window you will see characters that you cannot read. You have to stop the session and set your baud rate to 115200. This will let you increase the speed that you use to transfer the file.
- At the rommon prompt enter xmodem -c {filename}
- When prompted, enter y to continue
- From your hyperterminal prompt, click on transfter then send file
- Select the IOS image then change the protocol to xmodem via the dropdown box then click send.
- After the IOS has been downloaded, change the boot order by using the confreg 0x2102 command.
Tuesday, November 8, 2011
Recover MySQL root Password
don't think about that . you can use following command to recover that password.
1: Stop the MySQL server process.
# /etc/init.d/mysql stop
(output - Stopping MySQL database server: mysqld. )
2: Start the MySQL (mysqld) server/daemon process with the --skip-grant-tables option so that it will not prompt for password.
# mysqld_safe --skip-grant-tables &
3: Connect to mysql server using mysql client:
# mysql -u root
4: setup new password
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
5: Stop MySQL Server:
# /etc/init.d/mysql stop
6: start mysql server
# /etc/init.d/mysql start
# mysql -u root -p
finally apply your new password and get some fun..
thank you.....:)
Thursday, November 3, 2011
Typical Linux boot process
These days lot of people interest in Linux OS. but some of them don't know about boot process of Linux OS.so that i try to give you brief idea of boot process in Linux.I think thats better help for you.
The following are the 6 high level stages of a typical Linux boot process.
1. BIOS
- BIOS stands for Basic Input/Output System
- Performs some system integrity checks
- Searches, loads, and executes the boot loader program.
- It looks for boot loader in floppy, cd-rom, or hard drive. You can press a key (typically F12 of F2, but it depends on your system) during the BIOS startup to change the boot sequence.
- Once the boot loader program is detected and loaded into the memory, BIOS gives the control to it.
- So, in simple terms BIOS loads and executes the MBR boot loader.
2. MBR
- MBR stands for Master Boot Record.
- It is located in the 1st sector of the bootable disk. Typically /dev/hda, or /dev/sda
- MBR is less than 512 bytes in size. This has three components 1) primary boot loader info in 1st 446 bytes 2) partition table info in next 64 bytes 3) mbr validation check in last 2 bytes.
- It contains information about GRUB (or LILO in old systems).
- So, in simple terms MBR loads and executes the GRUB boot loader.
3. GRUB
- GRUB stands for Grand Unified Bootloader.
- If you have multiple kernel images installed on your system, you can choose which one to be executed.
- GRUB displays a splash screen, waits for few seconds, if you don’t enter anything, it loads the default kernel image as specified in the grub configuration file.
- GRUB has the knowledge of the filesystem (the older Linux loader LILO didn’t understand filesystem).
- Grub configuration file is /boot/grub/grub.conf (/etc/grub.conf is a link to this). The following is sample grub.conf of CentOS.
#boot=/dev/sda default=0 timeout=5 splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu title
CentOS (2.6.18-194.el5PAE) root (hd0,0) kernel /boot/vmlinuz-2.6.18-194.el5PAE
ro root=LABEL=/
initrd /boot/initrd-2.6.18-194.el5PAE.img
4. Kernel
- Mounts the root file system as specified in the “root=” in grub.conf
- Kernel executes the /sbin/init program
- Since init was the 1st program to be executed by Linux Kernel, it has the process id (PID) of 1. Do a ‘ps -ef | grep init’ and check the pid.
- initrd stands for Initial RAM Disk.
- initrd is used by kernel as temporary root file system until kernel is booted and the real root file system is mounted. It also contains necessary drivers compiled inside, which helps it to access the hard drive partitions, and other hardware.
5. Init
- Looks at the /etc/inittab file to decide the Linux run level.
- Following are the available run levels
- 0 – halt
- 1 – Single user mode
- 2 – Multiuser, without NFS
- 3 – Full multiuser mode
- 4 – unused
- 5 – X11
- 6 – reboot
- Init identifies the default initlevel from /etc/inittab and uses that to load all appropriate program.
- Execute ‘grep initdefault /etc/inittab’ on your system to identify the default run level
- If you want to get into trouble, you can set the default run level to 0 or 6. Since you know what 0 and 6 means, probably you might not do that.
- Typically you would set the default run level to either 3 or 5.
6. Runlevel programs
- When the Linux system is booting up, you might see various services getting started. For example, it might say “starting sendmail …. OK”. Those are the runlevel programs, executed from the run level directory as defined by your run level.
- Depending on your default init level setting, the system will execute the programs from one of the following directories.
- Run level 0 – /etc/rc.d/rc0.d/
- Run level 1 – /etc/rc.d/rc1.d/
- Run level 2 – /etc/rc.d/rc2.d/
- Run level 3 – /etc/rc.d/rc3.d/
- Run level 4 – /etc/rc.d/rc4.d/
- Run level 5 – /etc/rc.d/rc5.d/
- Run level 6 – /etc/rc.d/rc6.d/
- Please note that there are also symbolic links available for these directory under /etc directly. So, /etc/rc0.d is linked to /etc/rc.d/rc0.d.
- Under the /etc/rc.d/rc*.d/ direcotiries, you would see programs that start with S and K.
- Programs starts with S are used during startup. S for startup.
- Programs starts with K are used during shutdown. K for kill.
- There are numbers right next to S and K in the program names. Those are the sequence number in which the programs should be started or killed.
- For example, S12syslog is to start the syslog deamon, which has the sequence number of 12. S80sendmail is to start the sendmail daemon, which has the sequence number of 80. So, syslog program will be started before sendmail.
Tuesday, November 1, 2011
configure Phpmyadmin
PhpMyAdmin is a nice database management and administration tool, it is easy to install it, but some people are having problems making it work under apache, that’s because it needs configuration. if you want to more know about Lamp installation you can use my past blogs.
Just in case you haven’t installed phpMyAdmin yet, type the following line in the Terminal:apt-get install phpmyadmin
To set up under Apache all you need to do is include the following line in /etc/apache2/apache2.conf, first type the following command to open up this file:gksudo gedit /etc/apache2/apache2.conf
Add the following line of code inside apache2.conf:
Include /etc/phpmyadmin/apache.conf
Now restart Apache:sudo /etc/init.d/apache2 restart
get some fun with phpmyadmin.....:)