0
0
MySQLquery~10 mins

MySQL CLI and Workbench - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to connect to a MySQL server using the CLI.

MySQL
mysql -u [1] -p
Drag options to blanks, or click blank then click option'
Aroot
Bpassword
Clocalhost
Dmysql
Attempts:
3 left
💡 Hint
Common Mistakes
Using the password directly after -u instead of the username.
Confusing hostname with username.
2fill in blank
medium

Complete the command to show all databases in MySQL CLI.

MySQL
[1];
Drag options to blanks, or click blank then click option'
ASHOW TABLES
BSHOW SCHEMAS
CSHOW DATABASES
DLIST DATABASES
Attempts:
3 left
💡 Hint
Common Mistakes
Using SHOW TABLES; which only shows tables in the current database.
Using LIST DATABASES; which is not valid MySQL syntax.
3fill in blank
hard

Fix the error in the command to select a database named 'shop'.

MySQL
USE [1];
Drag options to blanks, or click blank then click option'
Ashops
Bshop
CShop
DSHOP
Attempts:
3 left
💡 Hint
Common Mistakes
Using a plural or capitalized version of the database name.
Forgetting the semicolon at the end.
4fill in blank
hard

Fill both blanks to create a new user 'alice' with password 'mypassword' in MySQL CLI.

MySQL
CREATE USER '[1]'@'localhost' IDENTIFIED BY '[2]';
Drag options to blanks, or click blank then click option'
Aalice
Bmypassword
Croot
Dpassword123
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping username and password positions.
Omitting quotes around username or password.
5fill in blank
hard

Fill all three blanks to grant all privileges on database 'shop' to user 'alice' in MySQL CLI.

MySQL
GRANT [1] ON [2].* TO '[3]'@'localhost';
Drag options to blanks, or click blank then click option'
AALL PRIVILEGES
Bshop
Calice
DSELECT
Attempts:
3 left
💡 Hint
Common Mistakes
Using SELECT instead of ALL PRIVILEGES for full access.
Forgetting the database name or using wrong username.