Use bellow command
docker-compose exec mysql bash
- Get container name of mysql
docker-compose ps
# Result : crazytest-mariadb-1
docker exec -it crazytest-mariadb-1 mysql -p
Execute the command below :
You can found the password into the
docker-compose.yml
if you are using docker compose
mysql -u root -p
Execute the command below :
SHOW DATABASES;
Result :
MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| crazy_db |
| information_schema |
| mysql |
| performance_schema |
+--------------------+
Execute the command below :
USE crazy_db;
Result :
Database changed
MariaDB [crazy_db]>
Execute the command below :
SHOW TABLES;
Result :
MariaDB [crazy_db]> SHOW TABLES;
+--------------------+
| Tables_in_crazy_db |
+--------------------+
| Booking |
+--------------------+
Execute the command below :
DROP TABLE {table};
Result :
Query OK, 0 rows affected
Get schema of one table
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Booking';