DBMS/MySQL 8

[MySQL 5.6] 모르고 root@localhost를 삭제해서 shell이 접속되지 않는다 …!!!(mysqld_safe 모듈도 안될떄 )

모르고 root@localhost 를 삭제해서 shell접속도 안되고..구글링을 했을떄msqld_safe 모드로 들어가서 하려니msqyd_safe 모듈도 없어서 되지 않았다 유명한 mysqld_safe —skip-grant-tables —skip-networking & 모듈이 없음 ..이럴떄  systemctl set-environment MYSQLD_OPTS=”—skip-grant-tables” 휴 겨우 들어왔당들어가기전 systemctl stop mysqld 스탑필수들어오자마자 flush privileges 해준다 그래야 이후 비밀번호 및 설정 가능   root@localhost 다시 등록참고로 5.6이라고 grant all로 바로 등록 가능생겼고  설정 완료 해주고 ,다시 재접속 해본다나가서 sys..

DBMS/MySQL 2025.02.17

[MySQL] Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Client does not support authentication protocol requested by server; consider upgrading MySQL client 현상

mysql의 비밀번호 알고리즘때문이다나는 5.x 버전대의 소스인데mysql 8.x 버전대로 jdbc연결을 하려고한다 . 이럴 경우 8.x버전대 mysql들어가사ㅓSELECT Host,User,plugin,authentication_string FROM mysql.user;확인해보면 plugin 알고리즘이caching_sha2_password인데이것을 mysql_native_password 바꾸어 주면 된다ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '’asdasd’;해주면 변경 성공flush privileges; 까지해주면 커넥션 완료

DBMS/MySQL 2025.02.17

[MySQL] mysql 외부 접속시 connection locked 현상 (Unblock with 'mysqladmin flush-hosts

갑자기 이런 오류로 접속이 안되고 있다   증상.원격 서버에서 Mysql Server 로 단순 커넥션 한 뒤 close 하게 되면Mysql 은 비정상적인 접속으로 판단하여 해당 IP를 블럭킹하게 된다.이때 mysql의 비정상적인 접속 요청수를 카운트 하는데global max_connect_errors 에 지정된 값을 넘기면 자동 블럭킹처리 됨기본값은 10이며 필요한 경우 이 값을 변경해야 한다. 출처:https://sd23w.tistory.com/414[그러냐:티스토리]   select @@global.max_connect_errors;  select @@global.max_connections;  flush hosts;  set global max_connections=300;  set global m..

DBMS/MySQL 2025.02.17

[MySQL] 데이터베이스 테이블수 및 정보 조회, 컬럼 수 및 조회

테이블 test 이름이 들어간 테이블 조회SELECT * FROM information_schema.TABLES WHERE table_name LIKE CONCAT('%','test','%');  테이블 test 이름이 들어간 테이블 수SELECT count(*) FROM information_schema.TABLES WHERE table_name LIKE CONCAT('%','test','%');  test이름이 들어간 테이블의 컬럼 조회SELECT * FROM information_schema.columns WHERE table_name LIKE CONCAT('%','test','%');  test 이름이 들어간 테이블의 컬럼수 조회SELECT COUNT(*) FROM information_schem..

DBMS/MySQL 2025.02.17

[MySQL] 임의로 숫자 리스트 만들기 (예제, 년도 리스트 출력)

년도및, 날짜나, 시간별로 숫자 리스트를 임의로 만들어야 할 수도 있다.나는 예제로, 2018 부터 2021까지의 숫자 리스트를 만들려고 한다,  select year_list from ( select @year := @year - 1 as year_list from information_schema.tables a , information_schema.tables b , (select @year := 2022) c_year)year_ilst_cut where year_ilst_cut.year_list between '2018' and '2021';   또 다른 예select year_list, date_add('2021-01-01'..

DBMS/MySQL 2025.02.17