일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- Open Source
- Spring Boot
- spring
- AJAX
- Python
- myBatis
- MySQL
- Eclipse
- MSSQL
- STS
- IntelliJ
- Thymeleaf
- Tomcat
- git
- Docker
- Core Java
- ubuntu
- PostgreSQL
- Source
- Exception
- jpa
- 오픈소스
- maven
- 설정
- JDBC
- 문서
- error
- JavaScript
- oracle
- SpringBoot
- Today
- Total
헤르메스 LIFE
[mysql] 토비의 Spring3.0 예제 DB 구축 본문
mysql 을 다운 받습니다. ( http://www.mysql.com/downloads/mysql/ )
개인적인 귀차니즘 때문에 설치버젼이 아닌 압축버젼을 받았습니다.
적당한 곳에 압축을 풀고, %MYSQL_HOME%/bin 폴더에서 실행합니다.
> mysqld
> mysql -u root -p mysql
# create database db명;
mysql> create database springbook;
# grant all privileges on db명.* to 계정명@"localhost" identified by '비밀번호';
mysql> grant all privileges on springbook.* to spring@'localhost' identified by 'book';
mysql> \s [또는 status]
--------------
mysql Ver 14.14 Distrib 5.5.23, for Win32 (x86)
Connection id: 7
Current database: mysql
Current user: root@localhost
SSL: Not in use
Using delimiter: ;
Server version: 5.5.23-log MySQL Community Server (GPL)
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
TCP port: 3306
Uptime: 1 min 12 sec
Threads: 4 Questions: 16 Slow queries: 0 Opens: 34 Flush tables: 1 Open tables: 27 Queries per second avg: 0.222
--------------
# Character Set 변경하기
mysql> SET character_set_server = utf8;
mysql> SET character_set_client = utf8;
mysql> SET character_set_results = utf8;
mysql> SET character_set_connection = utf8;
mysql> SET character_set_database = utf8;
mysql> SET character_set_filesystem = utf8;
mysql> ALTER DATABASE springbook DEFAULT CHARACTER SET utf8;
# 확인
mysql> show variables like 'c%';
character_set_client : utf8
character_set_connection : utf8
character_set_database : utf8
character_set_results : utf8
character_set_server : utf8
character_set_system : utf8
character_sets_dir : /usr/share/mysql/charsets/
collation_connection : utf8_general_ci
collation_database : utf8_general_ci
collation_server : utf8_general_ci
mysql> create table users (
-> id varchar(10) primary key,
-> name varchar(20) not null,
-> password varchar(10) not null
-> );
Query OK, 0 rows affected (0.05 sec)
mysql> show tables; : 각 항목들을 나열
+----------------------+
| Tables_in_springbook |
+----------------------+
| users |
+----------------------+
1 row in set (0.00 sec)
'Database' 카테고리의 다른 글
[SQLite] SQLite 설치 및 사용법 (0) | 2012.05.17 |
---|---|
[MySQL] MYSQL 많이 사용하는 명령어 (0) | 2012.05.13 |
[MySQL] DB 추가 및 사용자 추가 (0) | 2012.01.27 |
[MySQL] ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO) (0) | 2012.01.27 |
[MySQL] MySQL 설치 (0) | 2012.01.26 |