본문 바로가기

DB/mySQL

CentOS6(x86_64)에서 MySQL 설치에서 원격까지

홈페이지에서 MySQL을 다운받는다. 웃긴 것은 한국Url보다 일본 Url의 속도가 빠르다....
MySQL 다운로드 사이트: http://dev.mysql.com/downloads/mysql/
속도가 빠른 일본 사이트에서 다운을 받아보자.

$ wget http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-5.5.17-1.linux2.6.x86_64.tar/from/http://ftp.jaist.ac.jp/pub/mysql/

 위 Url은 사이트에서 다운 받을 때나오는 Url이다. wget으로 간단하게 받을 수 있다. 사이트에서 받을 때는 Downloads > MySQL Community Server 메뉴의 화면 아래쪽에 Select Platform에서 linux-generic을 선택하고 받자.이제 다운을 받았으면 압축을 풀어보자

$ tar xvf MySQL-5.5.17-1.linux2.6.x86_64.tar

MySQL-client-5.5.17-1.linux2.6.x86_64.rpm

MySQL-devel-5.5.17-1.linux2.6.x86_64.rpm

MySQL-embedded-5.5.17-1.linux2.6.x86_64.rpm

MySQL-server-5.5.17-1.linux2.6.x86_64.rpm

MySQL-shared-5.5.17-1.linux2.6.x86_64.rpm

MySQL-test-5.5.17-1.linux2.6.x86_64.rpm 


 압축을 풀면 위처럼 MySQL파일들이 나올 것이다. 여기서 client와 server 2개만 있으면 된다. 그러니 따로 받고 싶은 사람은 아래처럼 원하는 파일만 받자.

$ wget http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-client-5.5.17-1.linux2.6.x86_64.rpm/from/http://ftp.iij.ad.jp/pub/db/mysql/

$ wget  http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-server-5.5.17-1.linux2.6.x86_64.rpm/from/http://ftp.jaist.ac.jp/pub/mysql/


다운 받았으니 설치해보자.

# rpm -ivh MySQL-server-5.5.17-1.linux2.6.x86_64.rpm
# rpm -ivh MySQL-client-5.5.17-1.linux2.6.x86_64.rpm


설치가 끝나면 서비스를 띄어보자.

# /usr/bin/mysqld_safe &

111027 12:27:07 mysqld_safe Logging to '/var/lib/mysql/ezshop.hitel.net.err'.

111027 12:27:07 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 


이제 DB에 접속할 수 있을 것이다.

#mysql -u root -p

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.5.17 MySQL Community Server (GPL)


Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> 

 패스워드를 물어보는데 바로 엔터를 누르면 들어가진다.

원격을 위해 사용자 정보를 만들어보자.

>use mysql;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A


Database changed

mysql> create user '아이디'@'접속주소' identified by '비번';

Query OK, 0 rows affected (0.00 sec)


mysql> create database DB이름;

Query OK, 1 row affected (0.00 sec)

 grant all on DB이름.* to '아이디'@'접속주소' identified by '비번';  

Query OK, 0 rows affected (0.00 sec)


mysql>quit

# lokkit -p 3306:tcp 

 위와 같이 하면 원격으로 접속이 가능하다. 참고로 lokkit는 포트를 열어주는 명령이다.

본인은 SQLGAte2010 for MySQL을 이용하여 접속해보았다.

 

'DB > mySQL' 카테고리의 다른 글

windows에서 mysql 압축파일로 설치하기  (0) 2017.03.02
MySQL, mysql workbench 설치  (0) 2015.08.29
mySQL 환경 설정  (0) 2011.08.03
mysql 계정 생성  (0) 2011.08.03
mysql 설치  (0) 2011.08.03