In: Computer Science
MySQL
Multiple Choice
Answer as soon as possible
1. Why is it important to check the replication
status regularly by running SHOW SLAVE STATUS on the slave?
(a) Running SHOW SLAVE STATUS cleans up the binary and relay logs
that are not in use.
(b) Running SHOW SLAVE STATUS syncs all tables where the data is
different from the Master and Slave.
(c) Replication can have an error at any time and if you don't run
SHOW SLAVE STATUS regularly you may not realize for a long
time.
(d) It is not important to run SHOW SLAVE STATUS to check
replication status.
2. Why is it important for an uptime monitoring
service to check your website from multiple servers around the
world, before considering your website down?
(a) Localized network errors may cause false alarms from individual
servers.
(b) You often only need to have your website available from
specific locations so you don't need to check it from locations
around the world.
(c) It is not important. Checking your website from fewer servers
will save greatly on electricity.
(d) It is not important. You can confirm a website is down from an
individual server accurately.
3. Which of the following are correct regaring
PHP's MySQLi and PDO connections to MySQL? (select all that
apply)
(a) MySQLi offers a procedural API.
(b) PDO works only with MySQL.
(c) PDO and MySQLi both offer object-oriented APIs.
(d) PDO has an exception class to handle any problems that may
occur in our database queries.
(e) Only PDO offers prepared statements.
(f) Both PDO and MySQLi offer protection against SQL Injection
Attacks.
1. (C)Replication can have an error at any time and if you don't run SHOW SLAVE STATUS regularly you may not realize for a long time.
This statement is to be run on a slave and provides status information on essential parameters of the replication slave threads. Minimize the problem of replication.
2. (a) Localized network errors may cause false alarms from individual servers.
Uptime tells you how much of a given time (usually a month) the website was up (available). It lets you verify the quality of the web hosting service you use.
3. (a) MySQLi offers a procedural API.
(c) PDO and MySQLi both offer
object-oriented APIs.
(d) PDO has an exception class to
handle any problems that may occur in our database queries.
(e) Only PDO offers prepared
statements.
(f) Both PDO and MySQLi offer
protection against SQL Injection Attacks.
Both MySQLi and PDO have their advantages:
PDO will work on 12 different database systems, whereas MySQLi will only work with MySQL databases.
So, if you have to switch your project to use another database, PDO makes the process easy. You only have to change the connection string and a few queries. With MySQLi, you will need to rewrite the entire code - queries included.
Both are object-oriented, but MySQLi also offers a procedural API.
Both support Prepared Statements. Prepared Statements protect from SQL injection, and are very important for web application security.
Hope this helps,
Software developer and computer enthusiastic.