My-Sql Interview Questions and Answers

What is MySQL ?

MySQL (pronounced 'my ess cue el') is an open source relational database management system (RDBMS) that uses Structured Query Language (SQL), the most popular language for adding, accessing, and processing data in a database. Because it is open source, anyone can download MySQL and tailor it to their needs in accordance with the general public license(http://www.gnu.org). its a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server.

how to list or view all databases from the mysql server?
mysql> show databases;
how to list or view all databases from the mysql server?
mysql> show databases;
How Switch (select or use) to a database?
mysql> use databasename;
How To see all the tables from a database of mysql server?
mysql> show tables;
What are some good ideas regarding user security in MySQL?
There is no user without a password. There is no user without a user name. There is no user whose Host column contains % (which here indicates that the user can log in from anywhere in the network or the Internet). There are as few users as possible (in the ideal case only root) who have unrestricted access.

Explain advantages of InnoDB over MyISAM?
Row-level locking, transactions, foreign key constraints and crash recovery.
Explain advantages of MyISAM over InnoDB?
Much more conservative approach to disk space management - each MyISAM table is stored in a separate file, which could be compressed then with myisamchk if needed. With InnoDB the tables are stored in tablespace, and not much further optimization is possible. All data except for TEXT and BLOB can occupy 8,000 bytes at most. No full text indexing is available for InnoDB.
The Main Features of MySQL?

The following list describes some of the important characteristics of MySQL: 
Fully multi-threaded using kernel threads. That means it can easily use multiple CPUs if available. 
C, C++, Eiffel, Java, Perl, PHP, Python and Tcl APIs. Works on many different platforms. 
Many column types: signed/unsigned integers 1, 2, 3, 4, and 8 bytes long, FLOAT, DOUBLE, CHAR, 
VARCHAR, TEXT, BLOB, DATE, TIME, DATETIME, TIMESTAMP, YEAR, SET, and ENUM types.
Very fast joins using an optimized one-sweep multi-join. Full operator and function support.
Very fast B-tree disk tables with index compression. Up to 32 indexes per table are allowed.
Written in C and C++. Tested with a broad range of different compilers.
A very fast thread-based memory allocation system. 
No memory leaks. Tested with a commercial memory leakage detector (purify). 
Includes myisamchk, a very fast utility for table checking, optimization, and repair.