Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to check the MySQL server version.
MySQL
SELECT [1](); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using NOW() returns the current date and time, not the version.
Using USER() returns the current user, not the version.
✗ Incorrect
The VERSION() function returns the MySQL server version.
2fill in blank
mediumComplete the command to start the MySQL server on Linux.
MySQL
sudo systemctl [1] mysql Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using stop will turn off the server.
Using status only shows the server status.
✗ Incorrect
The command sudo systemctl start mysql starts the MySQL server.
3fill in blank
hardFix the error in the command to log into MySQL as root user.
MySQL
mysql -u [1] -p Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using admin or user will cause login failure if those users don't exist.
Using mysql as username is incorrect.
✗ Incorrect
The root user is the default administrative user in MySQL, so use -u root.
4fill in blank
hardFill both blanks to create a new MySQL user with password.
MySQL
CREATE USER '[1]'@'localhost' IDENTIFIED BY '[2]';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using root or admin as new user names can cause conflicts.
Leaving password blank will cause errors.
✗ Incorrect
This command creates a user named newuser with password password123.
5fill in blank
hardFill all three blanks to grant all privileges on a database to a user.
MySQL
GRANT [1] ON [2].* TO '[3]'@'localhost';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using SELECT instead of ALL PRIVILEGES limits permissions.
Using wrong database or username causes errors.
✗ Incorrect
This command grants all privileges on the database mydatabase to user newuser.