Mysql Commands for CentOS/RHEL
By Anuket Jain On 24 April 2015 In Database
MySQL is a uninhibitedly accessible open source Relational Database Management System (RDBMS) that uses Structured Query Language (SQL). SQL is the most prevalent dialect for including, getting to and overseeing substance in a database. It is most noted for its brisk transforming, demonstrated unwavering quality, straightforwardness and adaptability of utilization.
MySQL is an open source database administration programming that helps clients store, compose, and recover information. It is an intense project with a great deal of adaptability this excercise will give the least complex prologue to MySQL.
# mysql -u techoism -p # mysql> show databases; # mysql> use techoism;Note:You will be in mysql console with database techoism chosen. # select id from user;
# mysql -u root -p techoism -e "SELECT id from user"
# mysql -u root -p -e "SELECT id from user" > data.txt
# mysqldump -u user_name -p database_name > backup.sql
Example: mysqldump -u techoism -p techosim > techosim.sql
# mysqldump -u user_name -p --skip-triggers database_name > backup.sql
# SELECT TABLE_NAME, table_rows, data_length, index_length, round(((data_length + index_length) / 1024 / 1024),2) "Size in MB" FROM information_schema.TABLES WHERE table_schema = "DATABASE_NAME" ORDER BY (data_length + index_length) DESC;
# SELECT TABLE_NAME from INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'DATABASE_NAME';
# SELECT TABLE_NAME from INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'DATABASE_NAME' AND ENGINE = 'ENGINE_TYPE';
Example: # SELECT TABLE_NAME from INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'techoism' AND ENGINE = 'InnoDB'; or # SELECT TABLE_NAME from INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'techoism' AND ENGINE = 'MyISAM';
NOTE: Case in-sensitive in above examples.
No Responses