Mysql Questions


Base on: Linux System Administrator/DevOps Interview Questions
This page contains ideas on how to answer questions. The answers are not absolutely accurate, please, consider to double-check yourself.

How do you create a user?

1CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'password';

How do you provide privileges to a user?

1GRANT ALL PRIVILEGES ON db_name.* to 'user_name'@'localhost';

What is the difference between a "left" and a "right" join?

The LEFT JOIN allows you to query data from two or more tables. Similar to the INNER JOIN clause, the LEFT JOIN is an optional clause of the SELECT statement, which appears immediately after the FROM clause.
RIGHT JOIN is similar to LEFT JOIN, except that the treatment of the joined tables is reversed.

Explain briefly the differences between InnoDB and MyISAM.

Describe briefly the steps you need to follow in order to create a simple master/slave cluster. progress

Why should you run "mysql_secure_installation" after installing MySQL?

To improve the security of your DB installation:

  • You can set a password for root accounts.
  • You can remove root accounts that are accessible from outside the local host.
  • You can remove anonymous-user accounts.
  • You can remove the test database, which by default can be accessed by anonymous users.

How do you check which jobs are running?


How would you take a backup of a MySQL database?

1mysqldump -u username -p -–all-databases | gzip > file.sql.gz