create table test(
id bigint(20) NOT NULL AUTO_INCREMENT,
content varchar(255) DEFAULT NULL,
PRIMARY KEY(id)
) ENGINE=InnoDB;
insert into test(content) values('테스트');
select * from test;
라고 쳐서 테이블만들기를 진행하는데
계속 이런식으로 에러가 났다. 에러의 원인을 파악해본 결과 에러메시지내용에서도 알수있듯이,
create table test( id bigint(20) not null AUTO_INCREMENT, content varchar(255) DEFAULT NULL, PRIMARY KEY(id) ) ENGINE=InnoDB Error Code: 1046. No database selected Select the default DB to be used by double-clicking its name in the SCHEMAS list in the sidebar. 0.011 sec
db를 선택하지 않아서다. 그래서 테이블을 만들기 전에
use 데이터베이스이름;
와같이 먼저 db를 선택한다.
그리고 나서 테이블을 만들자.