본문 바로가기

MySQL

[MySQL] 원격에서 Root(or user)로 접속허용 및 모든권한 설정 [MySQL] 원격에서 Root(or user)로 접속허용 및 모든권한 설정 [펌] egloos - http://egloos.zum.com/jonnychoe/v/5217253 # mysql -uroot -ppassword: ***** mysql>use mysql mysql>insert into user(host,user,password) values('접속허용할 호스트네임 or IP','root',password('패스워드')); mysql> grant all privileges on *.* to 'root'@'%' identified by '암호' with grant option; mysql> flush privileges mysql> select * from user where User = 'root.. 더보기
쿼리 // UPDATE JOIN 샘플update tbl_board as a inner join (select bno, count(rno) as replyCnt from tbl_reply group by bno) as bon a.bno = b.bnoset a.replycnt = b.replyCnt; 더보기
MySql Column Type 과 Java Type 샘플 테이블 쿼리 CREATE TABLE `columntype` ( `a1` bit(1) NOT NULL, `b2` tinyint(4) DEFAULT NULL, `c3` tinyint(2) DEFAULT NULL, `d1` smallint(6) DEFAULT NULL, `e1` smallint(3) DEFAULT NULL, `f1` mediumint(9) DEFAULT NULL, `g1` int(11) DEFAULT NULL, `h1` varchar(45) DEFAULT NULL, `i2` bigint(20) DEFAULT NULL, `j1` float DEFAULT NULL, `k1` double DEFAULT NULL, `l1` decimal(10,0) DEFAULT NULL, `o1` date DE.. 더보기
The last packet successfully received from the server was.... MySQL 8시간 동안 유휴상태에 있다가 DB작업을 시도하면 커넥션풀이 끊어져 나오는 에러 이다. 당연한 얘기지만 재시도하면 정상동작한다. 해결방법은 autoReConnector 옵션을 true로 주고 validationQuery를 넣어주면 된다. validationQuery 넣어주는 데 이유는 한번 커넥션이 끊어진다음 재시도를 하는 경우 문제가 있는 처음 한번의 시도는 에러가 나게 된다. 이때 넣어주는게 validationQuery로 모든 사용자쿼리를 실행 전에 한번 이 쿼리를 실행하게 된다.(그러므로 DB로서는 추가적인 부하가 됨) 쿼리가 한번 더 실행되는 것인 만큼 가장 간단한 쿼리여야 한다 org.springframework.transaction.CannotCreateTransactionExcep.. 더보기
DataBase, Table 정보 쿼리 [출처] - http://blog.beany.co.kr/archives/433SHOWSHOW VARIABLES;: 서버의 variables(설정사항) 출력 SHOW VARIABLES LIKE 'have_inno%';: 조건에 맞는 variables만 출력 SHOW DATABASES;: database 목록 SHOW TABLES;: 현재DB의 테이블목록(temporary table은 출력하지 않음) SHOW TABLES FROM db명;: 지정된 db명이 소유한 테이블목록 SHOW TABLES LIKE 'mem%';: 조건에 맞는 테이블목록만 출력 SHOW INDEX FROM 테이블명;: 인덱스 보기 SHOW COLUMNS FROM 테이블명;: 테이블구조(describe 테이블명, explain 테이블명).. 더보기