본문 바로가기

MySQL

(23)
워크밴치 Schemas 조회 워크밴치 테이블명 조회 *. [테이블명] *.* [테이블명]
You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column. To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect. 0.032 sec You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column. To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect. 0.032 sec ① [File] > [Perferences...] ② SQL Editor > 제일 하단 "Safe Updates (rejects UPDATEs and DELETEs with no restrictions)" 해제
MYSQL auto_increament 초기화 MYSQL auto_increament 초기화 auto_increament 초기화 > ALTER TABLE tablename AUTO_INCREMENT=1; 하지만, 초기화 하더라도 해당 값보다 큰 값이 있으면 그 다음값부터 증가됨 > ALTER TABLE tablename AUTO_INCREMENT=1; SET @COUNT = 0; UPDATE tablename SET seqid = @COUNT:=@COUNT+1
MYSQL DB 덤프 배치파일 만들기 @ECHO OFF Rem 경로 저장 디렉토리 지정 set DBDIR=C:\BackUp\DB\%date% Rem 파일중에서 하루가 경과한 파일은 삭제. forfiles /P C:\BackUp\DB /D -1 /C "cmd /c rmdir /s /q @file" Rem 파일이 디렉토리에 파일이 존재하지 않을경우 생성 . IF NOT EXIST %DBDIR% (MD %DBDIR%) Rem Mysql 덤프파일 명령진행 ( 모든 데이터 베이스 덤프 Export) 진행 mysqldump --login-path=backup --all-databases > C:\BackUp\DB\%date%\database_%date%.sql ※ 참고 Rem → 배치파일 내에서의 Comment 기능. 실행시 무시 :: → 배차파일 내..
MYSQL 비밀번호 설정 MYSQL 5.0 버전이후 DB 덤프시에 비밀번호 직접 입력 불가 Warning: using a password on the command line interface can be insecure. mysqldump -u root -p비밀번호 --all-databases > C:\BackUp\DB\%date%\database_%date%.sql > 위명령어서 실행되지 않는다. CMD 창에서 mysql_config_editor set --login-path=이름 --host=주소 --user=root --port=3306 --password 비밀번호 설정이후에 EX) mysql_config_editor set --login-path=backup --host=localhost --user=root --port..
[MYSQL] Authentication method 'caching_sha2_password' not supported by any of the available plugins. , mysql can't connect to mysql server on 'localhost' (10061) MYSQL 설치시 위와 같은 에러가 발생 mysql can't connect to mysql server on 'localhost' (10061) : MYSQL 서비스가 실행되지 않아서 생긴 에러 내가 서비스가 실행되지 않았던 이유는 (Authentication method 'caching_sha2_password' not supported by any of the available plugins.) 해당 에러로 실행되지 않음. 버전 8에서 보안 이슈등으로 생긴 이슈 MYSQL my.ini 폴더에서 default_authentication_plugin=mysql_native_password 한줄 추가 (위 my.ini폴더에서 위 한줄 추가시 utf-8 로 저장시 이슈가 있어 anai로 변경 후 서비스 재..
[Mysql] Function 에러 : This function ha none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and bin... Mysql Version 5에서 8로 버전 업데이트시 위와 같은 에러가 이슈가 났음. SHOW global variables LIKE 'log_bin_trust_function_creators'; 로 조회후 value 값이 OFF 일 경우 SET GLOBAL log_bin_trust_function_creators = ON; ON 상태값으로 변경
[Mysql] 덤프 IMPORT, EXPORT Mysql 설치 파일 bin폴더로 이동 후 [IMPORT] mysql -u아이디 -p비밀번호 디비명 덤프 내보낼 위치.sql;
[MYSQL] UPDATE SELECT 같은 TABLE의 수정 SELECT * FROM TABLE1 t1 WHERE 1=1 [ TABLE1 ] seq name value etc 1 num1 1 null 2 num2 2 null TABLE1 의 name 값이 num1일때 → value 값을 "11"로 name 값이 num2일때→ value 값을 "22"로 변경시 UPDATE TABLE1 t1, (SELECT seq, (CASE WHEN name = 'num1' THEN 11 WHEN name = 'num2' THEN 22 ELSE 0 END) AS new_value FROM TABLE1 ) t2 set t1.value = t2.new_value where t1.seqid = t2.seqid
CHARACTER_LENGTH select * from table where CHARACTER_LENGTH(colum) = 8