MySQL Server Installation
MySQL Server Installation
9. After the installation is completed, the MySQL will start automatically. You can check the status
of MySQL server by typing this command:
$sudo systemctl status mysql
16. To create a new user named ‘user1’@’localhost’ with the password ‘dbms’, type:
17. To verify the user was created, type:
18. To grant all privileges to allow the user ‘user1’ to manage the database ‘lab2’, type:
21. Type ‘dbms’ for the password and switch to use the database ‘lab2’, type:
22. Type the command to show all tables in the database ‘lab2’
…………………………………………………………..
23. To create a table TODOS with the following structure:
24. Type command to shows all tables in the database lab2:
…………………………………………………………..
25. To show the structure of the table todos, type:
By default, MySQL runs with autocommit mode enabled. This means that as soon as you execute
a statement that modifies (insert/update/delete) a table. Thus, you do not need to use the commit
command to save the modified data.
27. Write a SQL statement to show all rows in the table todos.
………………………………………………………………..
28. Write SQL statement(s) to insert the row no 2 and 3.
………………………………………………………………..
………………………………………………………………..
29. Write a SQL statement to show all rows in the table todos.
………………………………………………………………..
30. Query the todos data and show only completed data (completed with ‘Y’)
By default, MySQL queries are not case-sensitive. Try to change the WHERE clause from
complete='Y' to completed='y'. However, Oracle queries are case-sensitive. You cannot find any
row when you use the expression “completed='y'” in the WHERE clause.
31. Write a SQL statement to modify all data by setting the column completed to ‘Y’ in the table
todos.
………………………………………………………………..
32. Write a SQL statement to show all modified rows in the table todos.
………………………………………………………………..
33. To exit the mysql program , type: