RELX Group Most Frequently Asked Latest MySQL Interview Questions Answers
Write a command to view the content of the table
To view all the data that is contained inside a table named sales use the select command. For example: to see the data of first row in a table using the command as:
If the database is created recently then it will give a blank listing, but after the data is being entered it will show the full listing in a tabular form.
Write a command to view the content of the table
To view all the data that is contained inside a table named sales use the select command. For example: to see the data of first row in a table using the command as:
mysql > select * from sales limit 1;
If the database is created recently then it will give a blank listing, but after the data is being entered it will show the full listing in a tabular form.
What is the procedure to configure the application of MYSQL?
The procedure to configure the application of MySQL is:
1. First create a database
2. Test the database by informing about the database name, IP address of database client server, username and password of application.
3. Edit the special application specific configuration file using a GUI or command line.
4. Configure the language with which MySQL will interact.
What are the applications required to support MYSQL?
The applications that are required to support MySQL are as follows:
1. php-mysql MySQL database is used specifically to support PHP
2. perl-DBI : provides generic Perl interface for interacting with relational databases
3. perl-DBD-MySQL database specific support for Perl
4. Web server is required to configure the database and its configuration
5. Programming language is required which supports MySQL.
RELX Group Most Frequently Asked Latest MySQL Interview Questions Answers |
Write a query to stop MYSQL in unix
The query to stop MySQL is quite useful when an error is occurred or when data has to be saved from any mishap. It is also used for retrieving the root password because it is either easily forgotten or misplaced. To stop the service the following command is required:
Stop MySQL
[root@ tmp]# service mysqld stop
Stopping MySQL: [ OK ]
[root@ tmp]#
[root@ tmp]# service mysqld stop
Stopping MySQL: [ OK ]
[root@ tmp]#
Write a query to MYSQL in safe mode and to change the root password
To start MySQL in safe mode, mysqld_safe command is used which allow it to run in the safe mode and it also doesn’t allow the reading of tables with the database passwords:
[root@ ]# mysqld_safe --skip-grant-tables --skip-networking &[1] 13007
[root@ ]# Starting mysqld daemon with databases from /var/lib/mysql
[root@ ]#
[root@ ]# Starting mysqld daemon with databases from /var/lib/mysql
[root@ ]#
After running the MySQL in safe mode the password protection gets removed and to use the password protection mechanism a command is used as follows:
mysql -u root command
[root@bigboy tmp]# mysql -u root
[root@bigboy tmp]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.16
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> [ a message is being shown which allow user to take the control of the root]
How to take MYSQL database backup?
To take the database backup use the following syntax:
mysqldump --add-drop-table -u [username] -p[password] [database] > [backup_file]
This command will take the database backup by knowing the username and password for the database connection and dropping any table which is being deleted or not in use. It is always a good practice to take the backup of mysql as it contains all the database information that a user can access. While using the command keep a note that there should not be any space between –p switch and password, if there is then you will get a syntax error.
Write a command with which MySQL table can be repaired
The command syntax with which mysql table can be repaired is as follows:
REPAIR TABLE tablename;
REPAIR TABLE tablename QUICK;
REPAIR TABLE tablename EXTENDED;
REPAIR TABLE tablename QUICK;
REPAIR TABLE tablename EXTENDED;
The command will just do as it says repair a specified table, but if QUICK or EXTENDED is used then the meaning of it changes. In case of QUICK it will repair only the index tree, whereas in case of EXTENDED it will create index row by row and repair it.
What are the different tables present in MySQL?
There are many tables that remain present by default. But, MyISAM is the default database engine used in MySQL. There are five types of tables that are present:
1. MyISAM
2. Heap
3. Merge
4. INNO DB
5. ISAM
What does the file with the extension: frm, myd, and myi contain?
MySQL default table type is MyISAM, where there are three kind of files that are stored inside MyISAM. The file names begin with the table name and have the extensions such as frm, myd and myi. The explanation of each file is given below:
.frm file consists of the table definition that are stored in the database
.myd is an extension that is used by a data file.
.myi is an extension that is used by index file.
What is the difference between MYSQL and SQL?
- SQL is known as standard query language, as the name implies it is the language which is used to interact with the database like MySQL.
- MySQL is a database that store various types of data and keep it safe. A PHP script is required to store and retrieve the values inside the database.
How database are managed?
Database is a collection of data and it is managed by a database server, which is a special program that is also known as MySQL database server. Application that you create usually communicates with the database server in the language which it can understand; mostly SQL language is used for communication. Database server in return interacts with the web server on same server or computer. Database server and web server result in the data which is being shown on the web.
What is required to create MYSQL database?
To create MySQL databse the first component which has to be present is a database server on which the queries of database will run and software tool through which you can access the applications. It also requires PHP scripts for communicating with the database using SQL commands.
What do you understand by MYSQL terminal?
MySQL terminal is used as a command line interface in many operating system. It provides a way to access the database and other resources using the SQL commands that are interpreted by the MySQL database server.
Post a Comment