MySQL Questions and Answers – Relocating Data Directory Contents

This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “Relocating Data Directory Contents”.

1. Symlink is an applicable relocation method for ______________
a) entire data directory
b) individual database tables
c) server PID file
d) log files
View Answer

Answer: b
Explanation: Symlink is an applicable relocation method for the individual database tables. However, the startup option is better suited relocation method for server PID file and the log files.

2. For which of these is the startup option best suited?
a) entire data directory
b) individual database tables
c) server PID file
d) individual database directories
View Answer

Answer: c
Explanation: The startup option is better suited relocation method for server PID file and the log files, while symlink is an applicable relocation method for the individual database tables.

3. Before relocation of database, the server should be stopped if running.
a) True
b) False
View Answer

Answer: a
Explanation: The server always looks for the database directories in the data directory. The only way to relocate a database is by the symlink method. The server should be stopped if running.
advertisement
advertisement

4. When relocating an individual table, the table to be relocated should be ______________
a) MyISAM
b) InnoDB
c) TRANSACTION
d) ENGINE
View Answer

Answer: a
Explanation: The relocation of an individual table is supported only under certain limited circumstances. When relocating an individual table, the table to be relocated should be a MyISAM table.

5. What is the special database that always exists after setting up MySQL on a computer?
a) sampdb
b) mysql
c) information_schema
d) readme_db
View Answer

Answer: c
Explanation: After installation of MySQL, ‘information_schema’ is the special database that always exists. ‘mysql’ can be seen depending on access rights. It holds the grant tables. ‘sampdb’ and ‘readme_db’ do not exist by default.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. What is InnoDB in the following MySQL code?

CREATE TABLE student (
		name CHAR(30),
		student_id INT,
		PRIMARY KEY (student_id)
	) ENGINE = InnoDB;

a) database name
b) table name
c) reference engine
d) storage engine
View Answer

Answer: d
Explanation: ‘InnoDB’ is the name of the ‘storage engine’ for the above table. The ‘ENGINE’ clause is used to specify the name of the storage engine that MySQL should use to handle the table being created. MySQL has several storage engines with its own properties.
advertisement

7. What is the table name in the following SQL code?

advertisement
INSERT INTO student VALUES('Kyle','M',NULL);

a) student
b) VALUES
c) Kyle
d) M
View Answer

Answer: a
Explanation: The ‘INSERT INTO’ clause here inserts a row in the table named ‘student’. The table has three fields. The first field or attribute value in the row/tuple is ‘Kyle’. The second attribute value is ‘M’ and the last attribute is set to NULL.

8. In which file are the statements entered in ‘mysql’ saved?
a) .mysql_queries
b) .queries
c) .mysql_history
d) .history
View Answer

Answer: c
Explanation: Statements entered in ‘mysql’ are stored in the file named ‘.mysql_history’. This file is located in the home directory itself. The SQL statements can be directly pasted into this file.

9. Mysql cannot be used to execute script files.
a) True
b) False
View Answer

Answer: b
Explanation: Mysql is capable of reading input from a file in batch mode. This is also known as the non-interactive mode. A lot of typing and time can be saved when commands are stored in a file and executed from a file.

10. Which command is used to make a script file ‘run_me.sh’ executable?
a) chmod +e run_me.sh
b) chmod +a run_me.sh
c) chmod +y run_me.sh
d) chmod +x run_me.sh
View Answer

Answer: d
Explanation: The command name ‘chmod’ stands for ‘change mode’. It is used to define the way a file can be accessed. To make the script file ‘run_me.sh’ executable, the chmod command is used.

Sanfoundry Global Education & Learning Series – MySQL Database.

To practice all areas of MySQL Database, here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.