Skip to main content

Posts

Showing posts from May, 2012

MySQL Commands to real time monitoring and usage

$ mysqldump db_name my_table $ mysqldump db_name my_table > output.sql $ mysqldump --no-data db_name my_table > dump_table_name.sql $ mysqldump --add-drop-table db_name my_table > dump_table_name.sql $ mysqladmin create db_name $ mysqladmin drop db_name $ mysqladmin flush-privileges $ mysqladmin ping $ mysqladmin reload $ mysqladmin kill ps_id,ps_id... $ mysqladmin --user=root shutdown $ mysqladmin variables $ mysqlimport db_name file_name ... $ safe_mysqld $ myisamchk table_name.MYI mysql> GRANT ALL ON db_name TO user_name@localhost IDENTIFIED BY 'password' mysql> GRANT ALL ON db_name TO user_name@'%' IDENTIFIED BY 'password' $ mysql --help | less $ mysqld --help $ mysqlshow --help | less $ mysqldump --help | less $ mysqlshow      - show all databases. $ mysqlshow db_name - all tables in particular database. $ mysqlshow db_name BA* - all tables which start from BA letters. mysql> \? m...

MySQL load table data using dot SQL file on command line

$ vi create_table.sql ( open new file ) --------------------- drop table if exists my_table; create table my_table (ID int not null primary key, l_name         varchar(20) not null, f_name varchar(20)); insert into my_table values (1,"Frost",'Robert'); insert into my_table (ID,l_name) values (2,'Smith'); select * from my_table; :wq ( save file ) ----------------- $ mysql db_name < create_table.sql $ mysql db_name -t < create_table.sql > output.sql mysql> \. create_table.sql

MySQL CRUD Operations Creating Table Read Update and Drop

mysql> drop table if exists my_table; mysql> create table my_table (ID int not null primary key, l_name     -> varchar(20) not null, f_name varchar(20)); Query OK, 0 rows affected (0.08 sec) mysql> describe my_table; +--------+-------------+------+-----+---------+-------+ | Field   | Type         | Null | Key | Default | Extra | +--------+-------------+------+-----+---------+-------+ | ID      | int(11)      |       | PRI | 0        |        | | l_name | varchar(20) |       |      |          |        | | f_name | varchar(20) | YES   |      | NULL     |        | +--------+-------------+----...