본문 바로가기

이것저것IT

Ubuntu Docker 설치 & mysql pull & spring boot batch실행

1. sudo apt-get update

2. sudo apt-get install ca-certificates curl gnupg lsb-release

3.curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

4. sudo apt-get install docker-ce docker-ce-cli containerd.io

5. docker --version 

    버전 정상 확인

6. sudo docker pull mysql:latest

    mysql 이미지 가져오기

7. sudo docker run --name mysql -e MYSQL_ROOT_PASSWORD=pwd -d -p 3306:3306 mysql:latest

8. sudo docker ps -a

   이미지 컨테이너 실행 확인

 

9. sudo docker exec -i -t mysql bash

   mysql bash 접속 (계정 생성을 위해)

 

10. mysql -u root -p

   mysql 접속 (패스워드는 위에 입력한 pwd로 입력한다.)

bash-4.4# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.2.0 MySQL Community Server - GPL

Copyright (c) 2000, 2023, 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> use mysql;
mysql> show tables
    -> ;
+------------------------------------------------------+
| Tables_in_mysql                                      |
+------------------------------------------------------+
| columns_priv                                         |
| component                                            |
| db                                                   |...

 

 

11. 계정 생성

mysql> create user 'test1'@'localhost' identified by 'test1';             //내부 IP접근
Query OK, 0 rows affected (0.01 sec)

mysql> create user 'test2'@'%' identified by 'test2';                        //외부 IP접근
Query OK, 0 rows affected (0.00 sec)

 

 

spring batch 구동 시 

Caused by: java.sql.SQLSyntaxErrorException: Table 'mysql.BATCH_JOB_INSTANCE' doesn't exist

오류 발생 ->

spring.batch.initialize-schemadeprecated 되었음 spring boot 2.5에서~

spring.batch.jdbc.initialize-schema = ALWAY  <- 이렇게 정의해줘야함

 

 

'이것저것IT' 카테고리의 다른 글

인텔리제이 유용한 팁  (0) 2020.01.05
intelliJ 단축키 정리  (0) 2019.12.08
[2013.08.25~2013.08.31]IT용어 15개  (1) 2013.08.25