Mysql Questions
Overview
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.
https://www.guru99.com/joins.html
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.
...in 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.
https://mariadb.com/kb/en/mysql_secure_installation/
How do you check which jobs are running?
1SHOW FULL PROCESSLIST;
How would you take a backup of a MySQL database?
1mysqldump -u username -p -–all-databases | gzip > file.sql.gz