Thursday, December 24, 2009

Cisco PIX - Useful Commands

Useful Commands:

show config

show blocks

show checksum

show conn

show cpu usage

show history

show memory

show processes

show routing

show running-config

show startup-config

show tech-support

show tcpstat

show traffic

show uauth/clear uauth

show version

show xlate/clear xlate

Wednesday, December 23, 2009

Cisco PIX - Commands Supported in CLI

 
Command Mode
Command
Command Description
User Mode
enable
To change the mode from User to Enable mode.
help  
Displays the help description in the Modes.
exit
To log out from the CLI client.
logout
To log out from the CLI client.
show clock
To show the clock time of the CLI agent in the network.
show history
To display the History of the connected terminal.
show snmp  
To show the SNMP status of the device in the network.
show version
To show the version of the device.
Enable Mode
clock set
Sets the Clock with Date and Time in the firewall device
configure terminal
Change the mode to Configuration Mode
disable
Change the mode to user mode from Enable mode.
ping
Send echo messages
show access-list
Displays the access-list configurations
show blocks
To show the system buffer usage
show conn
To show the number of connections in use
show failover
To show the failover status
show memory
To show the free memory available
show nameif
To show the current names and security levels of each interface
show clock
Display clock time of the CLI agent in the network.
show history
Displays the History of the connected terminal.
show version
Displays the IOS Version and its details of the CLI agent.
Config Mode
access-group in interface
Binds the access list to the inside interface.
access-list host
Creates the standard access list entry
access-list /
Creates the standard access list entry
exit
Change the mode from Configuration to Enable mode.
hostname
Updates the given value as the host name.
snmp-server enable traps
Enables all the supported trap types
snmp-server host [host-addr] [community-string]
To specify the recipients of the SNMP notification operatio
route [metric]
Set the inside/outside default route to the router attached to the Internet.
no number
To remove a specific access-list
no snmp-server enable traps
Disables all the supported trap types
no snmp-server host
Removes a specific recipient of the SNMP notification operation

Tuesday, December 22, 2009

MySQL - Change Root Password

How do I change MySQL root password under Linux, FreeBSD, OpenBSD and UNIX like operating system over ssh / telnet session?


Setting up mysql password is one of the essential tasks. By default root user is MySQL admin account. Please note that the Linux / UNIX login root account for your operating system and MySQL root are different. They are separate and nothing to do with each other (indeed some admin removes root account and setup admin as mysql super user).

mysqladmin command to change root password

If you have never set a root password for MySQL, the server does not require a password at all for connecting as root. To setup root password for first time, use mysqladmin command at shell prompt as follows:
$ mysqladmin -u root password NEWPASSWORD
However, if you want to change (or update) a root password, then you need to use following command
$ mysqladmin -u root -p'oldpassword' password newpass
For example, If old password is abc, and set new password to 123456, enter:
$ mysqladmin -u root -p'abc' password '123456'
 
keep note = no spacebar between -p'abc' 

Change MySQL password for other user

To change a normal user password you need to type (let us assume you would like to change password for vivek):
$ mysqladmin -u vivek -p oldpassword password newpass

Changing MySQL root user password using MySQL sql command

This is another method. MySQL stores username and passwords in user table inside MySQL database. You can directly update password using the following method to update or change password for user vivek:
1) Login to mysql server, type following command at shell prompt:
$ mysql -u root -p
2) Use mysql database (type command at mysql> prompt):
mysql> use mysql;
3) Change password for user vivek:
mysql> update user set password=PASSWORD("NEWPASSWORD") where User='vivek';
4) Reload privileges:
mysql> flush privileges;
mysql> quit

MySQL - Restore database

There are 2 ways to restore your MySQL database from sql dump file.


1st way to restore mysql database from sql dump file is using mysql web control panelphpMyAdmin
- Log into phpMyAdmin.
- Select your preference database on the left database navigation drop down list.
- Click on Import tab on the top.
- Select your sql dumb file at File to import
- Then select your mysql database charset (ex: Latin1, utf-8)
- and click GO and it’s done!

Do not use phpMyAdmin to import or restore your MySQL database if your MySQL database file is large. This is because, phpMyAdmin has limit on total upload size which depend on php setting. Besides, there is also maximum execution time which may cause browser to time out.

The solution to restore large mysql database from sql dump file is using unix/linux shell command.

To restore mysql database from a dump file, just type the command below:-

mysql -u #username# -p #database# < #dump_file#

Of course you need to replace #username# to your database username and #database# to your target database. and rename #dump_file# to your dump file file name (Ex: dump.sql) Once you enter the command, the linux/unix shell will prompt you for your database user password, just key in your database password and you are done.


Referring from:
http://www.techiecorner.com/31/how-to-restore-mysql-database-from-sql-dump-file/

Tuesday, December 15, 2009

MySQL - Create database

The command is simple just write mysqladmin in a CLI followed by the database name you want to create


# mysqladmin -u root -p create building
# mysql


 Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.82-log Source distribution

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

mysql> SHOW databases;
+----------+
| Database |
+----------+
| mysql    |
| building|
| test     |
+----------+
2 rows in set (0.00 sec)
mysql>


You can also type the query in mysql> prompt like this

mysql> CREATE database building;
Query OK, 1 row affected (0.00 sec)

To show available databases in mysql use the command show databases on mysql> prompt.
Now use the database by typing USE building and then type SHOW tables to see what tables are available in the database

mysql> USE building;
Database changed

mysql> SHOW tables;
Empty set (0.00 sec)

Tuesday, November 17, 2009

Linux CLI - How to broadcast a message to all users - using wall

1. As the main input of wall is a file, we will first create our message file.Type :

$ echo 'Please note that in two more hours, and for one hour, you will not be able to use the SQL database, please save all your job before, and quit any application using it'> message.txt

2. OK, now we have our message ready, it is time to send it to the users

$ wall < message.txt

 Try yourself!!!

This Week [47] Motivation

If you're still hanging onto a dead dream of yesterday,
laying flowers on its grave by the hour,
you cannot be planting the seeds for a new dream to grow today.