I'm currently learning laravel and new to docker.
I have MySQL previously installed and wanted to run a server using docker and adminer with docker-compose.yml
below
version: "3.9"
services:
mysql:
image: mysql
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
adminer:
image: adminer
restart: always
ports:
- 8080:8080
I can successfully log in to localhost:8080 and able to create new database in adminer. But the problem is that I cannot have database from my previous project in locally installed MySQL.
I want to connect MySQL databases (or directory) in docker so it refers to MySQL installed in my computer.
I ran the server and try migrating from cli using php artisan migrate
with database name aan
, it created new database. However, the database is not showing in docker.
here's the output in cli and dbeaver as expected
mysql> SHOW DATABASES
-> ;
+--------------------+
| Database |
+--------------------+
| aan |
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)
mysql>
and here's the databases in adminer (I also tried creating test1
in adminer but it doesn't show in cli)
Edit1:
sorry I don't have enough amount of reputation point to post the images instead of links