mysql: often used commands

Display all tables of a database

mysql> SHOW TABLES FROM db_name;

Structure of a table

mysql> SHOW FIELDS FROM tbl_name;

Create view

 CREATE VIEW <view-vame> 
 [ ( <fields> ) ]
 AS <Select> ;
mysql> CREATE VIEW ulogd2view AS SELECT id, oob_time_sec, oob_time_usec, oob_prefix, oob_mark, oob_in, oob_out, ip_saddr, ip_daddr, ip_protocol, ip_tos, ip_ttl, ip_totlen, ip_ihl, ip_csum, ip_id, ip_fragoff, tcp_sport, tcp_dport, tcp_seq, tcp_ackseq, tcp_window, tcp_urg, tcp_urgp, tcp_ack, tcp_psh, tcp_rst, tcp_syn, tcp_fin, udp_sport, udp_dport, udp_len, icmp_type, icmp_code, icmp_echoid, icmp_echoseq, icmp_gateway, icmp_fragmtu, ahesp_spi, local_time FROM ulog;

Delete View

mysql> DROP view_name;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s