MySQL Session Management

Command Line Interface

Connect

Connect to the MySQL RDBMS via the mysql binary, specifying host oceanus and that you will authenticate with a password:


% mysql -h oceanus -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 828601
Server version: 8.0.21 Source distribution

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Show Databases

Show databases that you have permission to see.


mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| UBITname_db        |
| test               |
+--------------------+
3 rows in set (0.00 sec)

Select a Database


mysql> USE UBITname_db;
Database changed

Show Tables within the Selected Database


mysql> SHOW TABLES;
Empty set (0.00 sec)

mysql>

Change Your Password

When you get your new account, change your default password to a password only you know.


mysql> SET PASSWORD = 'auth_string';

Quit


mysql> QUIT
Bye

References

  1. https://dev.mysql.com/doc/refman/8.0/en/