Simple Tutorials for Smart Learning
To see all available databases in your MySQL server, log in to the MySQL command-line interface and run:
SHOW DATABASES;
Example Output:
+--------------------+ | Database | +--------------------+ | information_schema | | my_database | | test | +--------------------+
To start working with a specific database, use the USE command followed by the database name:
USE
USE database_name;
Example:.
USE my_database;
Output:
Database changed
Once the database is selected, all subsequent SQL commands will target this database.
You can confirm the currently active database by running:
SELECT DATABASE();
+----------------+ | DATABASE() | +----------------+ | my_database | +----------------+
Launch MySQL WorkbenchOpen MySQL Workbench and connect to your MySQL server.
List All Databases
Open a Database
Verify Active DatabaseRun this query in the SQL Editor to confirm the active database:
Use Descriptive NamesOrganize databases with clear, descriptive names for easier identification.
Avoid Using RootAlways use a MySQL user with specific permissions for database operations.
Secure Your DataRegularly back up your databases and restrict access to sensitive dat
Minimize PermissionsOnly the necessary privileges for security are granted to users.