DB/Mysql
mysql 기본 Setting
WebDev
2013. 11. 5. 02:09
mysql 관련 기본 설정 방법입니다.
설치
# yum -y install mysql
# chkconfig --add mysqld
# chkconfig --level 2345 mysqld on
접속
# mysql -u root -p
Query
Version 확인
select version();
Database 확인
show databases;
Database 생성
create database db_name;
Table 생성
Create Table Table명(Table Colume)
ex)
Create Table Home
(
name Varchar(15)
, id Int
, address Varchar(30)
)
Table List 확인
Show Tables;
Table 구조 확인
Explain Table명;
사용할 Database 설정
Use Database 명
Table에 자료 입력
Insert Into Table명
Values(값1, 값2, 값3 ....);
ex)
Insert Into Home
Values('권준상', 1702, '금호동'), ('홍길동', 1000, '금호동);