2009-07-04 3 views
3

동일한 컴퓨터의 두 개의 다른 포트에서 MySQL 서버를 사용하고 싶습니다. 두 개의 별도 설정 파일을 만들었습니다. 내가 정의한 두 번째 포트에서 MySQL 서버에 연결하려고하면 연결할 수 없습니다. MySQL을 실행하는 OS는 Windows Vista입니다. 또한 포트를 지정한 후 명령 줄에서 mysqld을 시작하려고했습니다. 또한 명령에 다른 datadir (데이터베이스 파일이 들어있는 즉, 디렉토리)를 지정해야합니다mysql에서 다중 mysql 인스턴스를 실행하십시오.

# CLIENT SECTION 
# ---------------------------------------------------------------------- 
# 
# The following options will be read by MySQL client applications. 
# Note that only client applications shipped by MySQL are guaranteed 
# to read this section. If you want your own MySQL client program to 
# honor these values, you need to specify it as an option during the 
# MySQL client library initialization. 
# 
[client] 

port=3306 

[mysql] 
mysql-path="C:\Program Files\MySQL\MySQL Server 5.1\bin" 
default-character-set=latin1 

[client] 

port=3307 

[mysql1] 
mysql1-path="C:\Program Files\MySQL2\MySQL Server 5.1\bin" 
default-character-set=latin1 

# SERVER SECTION 
# ---------------------------------------------------------------------- 
# 
# The following options will be read by the MySQL Server. Make sure that 
# you have installed the server correctly (see above) so it reads this 
# file. 
# 
[mysqld] 
mysqld-path="C:\Program Files\MySQL\MySQL Server 5.1\bin\" 

# The TCP/IP Port the MySQL Server will listen on 
port=3306 

#Path to installation directory. All paths are usually resolved relative to this. 
basedir="C:/Program Files/MySQL/MySQL Server 5.1/" 

#Path to the database root 
datadir="C:/ProgramData/MySQL/MySQL Server 5.1/Data/" 
# 
server_id=1 

[mysqld1] 
# The TCP/IP Port the MySQL Server will listen on 
port=3307 
server_id=2 
mysqld1-path="C:\Program Files\MySQL2\MySQL Server 5.1\bin\" 

#Path to installation directory. All paths are usually resolved relative to this. 
basedir="C:/Program Files/MySQL2/MySQL Server 5.1/" 

#Path to the database root 
datadir="C:/ProgramData/MySQL2/MySQL Server 5.1/Data/" 
# 
# The default character set that will be used when a new schema or table is 
# created and no character set is defined 
default-character-set=latin1 

# The default storage engine that will be used when create new tables when 
default-storage-engine=INNODB 

# Set the SQL mode to strict 
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" 
+0

이럴 더러운 해킹은 mysql_multi에게 CONFIGS의 http://www.pythian.com/blog/using-mysqld_multi-to-manage-multiple-servers/

사본을 사용하려면 (데이터베이스 자체의 세트와 함께 각)이 개 MySQL의 인스턴스를 실행하고 싶은, 또는 한 있습니까? – BryanH

+0

네 자신의 데이터베이스 집합을 가지고 각각 mysql 인스턴스를 실행하고 싶습니다 –

+0

@MySQLDBA, http://serverfault.com에 있지 않아야합니까? – Pacerier

답변

0

:

나는 두 개의 서로 다른 포트에서 읽을 MySQL 서버에 대한 샘플 파일 변경된다 -선. 서로 잠그거나 데이터 손상을 일으킬 수 있으므로 서로 다른 인스턴스에서 동일한 데이터베이스를 열 수 없습니다.

+0

안녕하세요, 나는 같은 데이터베이스를 열고 싶지 않습니다. 하지만 난 두 인스턴스를 만들 수 없습니다 다른 datadir .. 내가 이것을 위해 할 필요가 지정입니다. 나는 기본 파일 외에도 --default-extra-file을 추가 할 필요가 있다는 것을 의미한다. –

2

더 나은

+0

+1! 굉장히 유용하다. 블로그 게시물은 매우 신속하고 도움이되었습니다. 나는 모든 종류의 conf 편집과 mysqld_safe를 시도했지만 mysql은 한 가지 이유나 다른 이유로 인해 계속 충돌했다. – user1652054