728x90
1. Comman Line
docker run --detach
--env MYSQL_ROOT_PASSWORD=dummypassword
// to connect to the database from our application
--env MYSQL_USER=social-media-user
--env MYSQL_PASSWORD=dummypassword
--env MYSQL_DATABASE=social-media-database
--name mysql
--publish 3306:3306
mysql:8-oracle
2. application.properties
spring.datasource.url=jdbc:mysql://localhost:3306/social-media-database
spring.datasource.username=social-media-user
spring.datasource.password=dummypassword
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
3. gradle dependecy
implementation 'com.mysql:mysql-connector-j:8.0.33'
4. MySQL Shell
\connect social-media-user@localhost:3306
\use social-media-database
\sql select * from user_datails
728x90
'Tech > Docker' 카테고리의 다른 글
docker에 ubuntu 설치 및 nginx, php, mysql 웹 서버 개발환경 세팅 (0) | 2023.12.08 |
---|