GithubHelp home page GithubHelp logo

Spring JPA MySQL 연동 about dayco HOT 2 CLOSED

yanghun0070 avatar yanghun0070 commented on June 23, 2024
Spring JPA MySQL 연동

from dayco.

Comments (2)

yanghun0070 avatar yanghun0070 commented on June 23, 2024
docker pull mysql
docker run --name dayco-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password -v /Users/yanghun007/dayco/mysql:/var/lib/mysql -e MYSQL_USER=daycouser -e MYSQL_PASSWORD=daycouser mysql
docker exec -it dayco-mysql /bin/bash
mysql -u root -p
use mysql
select host, user, authentication_string from user;
create user daycouser;
create user daycouser@localhost identified by 'daycouser';
create user 'daycouser'@'%' identified by 'daycouser';  // '%' 의 의미는 외부에서의 접근을 허용
drop user 'daycouser'@'localhost'; // 계정 삭제

show databases;
create schema daycodb default character set utf8;
drop database daycodb;

grant all privileges on daycodb.* to 'daycouser'@localhost identified by 'daycouser';
grant select, insert, update on daycodb.* to 'daycouser'@localhost identified by 'daycouser';

grant select, insert, update on daycodb.* to 'daycouser'@'%' identified by 'daycouser';

//user 에게 uaadb 데이터베이스 모든 테이블에 select, insert, update 권한 부여
grant select, insert, update on daycodb.* to 'daycouser'@localhost;   // 패스워드는 변경없이 권한만 부여하는 경우

mysql> grant all privileges on *.* to 'daycouser'@'%' with grant option;

flush privileges;   // 변경된 내용을 메모리에 반영(권한 적용)

revoke all on daycodb.* from daycouser;     // 모든 권한을 삭제


docker inspect dayco-mysql

from dayco.

yanghun0070 avatar yanghun0070 commented on June 23, 2024

build.gradle

	implementation 'org.springframework.boot:spring-boot-starter-jdbc'
	implementation group: 'mysql', name: 'mysql-connector-java', version: '8.0.15'

application.yml

spring:
  jpa:
    show-sql: true
    properties:
      hibernate:
        format_sql: true
    database: mysql
    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
    generate-ddl: true
  application:
    name: dayco-uaa
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/uaadb?useSSL=false
    username: uaauser
    password: uaauser

from dayco.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.