LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-26-2007, 06:35 AM   #1
BarryLinux
LQ Newbie
 
Registered: Nov 2006
Posts: 7

Rep: Reputation: 0
Mysql two inastance on same server


Hello,
I am trying to create two instances of mysql on the same server. I am running fedora core 6 mysql 5.0.22. I have amended the my.cnf, but both instances are not running. It creates the mysql tables in the default /var/lib/mysql ignoring the my.cnf file. Can anyone tell what I should add to my.cnf to get 2 instances of mysql on the same server in /var/lib/mysql1 and /var/lib/mysql2

my.cnf :-

[mysqld_multi]
mysqld = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
user = mysql

[mysqld1]
socket = /var/lib/mysql1/mysql.sock1
port = 3307
pid-file = /var/lib/mysql1/mysql.pid1
datadir = /var/lib/mysql1/data
basedir = /var/lib/mysql1
user = mysql

[mysqld2]
socket = /var/lib/mysql2/mysql.sock2
port = 3308
pid-file = /var/lib/mysql2/mysql.pid2
datadir = /var/lib/mysql2/data
basedir = /var/lib/mysql2
user = mysql

ps info :-

root 7458 1 0 11:59 pts/3 00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my.cnf --pid-file=/var/lib/mysql2/mysql.pid2 --log-error=/var/log/mysqld.log
mysql 7482 7458 1 11:59 pts/3 00:00:00 /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql2/mysql.pid2 --skip-locking

thanks
Barry
 
Old 01-26-2007, 11:04 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Would getting a second instance running give you anything that creating 2 databases in the one instance wouldn't? It's a simple process to create a second database...
 
Old 01-30-2007, 03:43 AM   #3
BarryLinux
LQ Newbie
 
Registered: Nov 2006
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks for reply steve. We are trying to create a test and a live environment. The apache web server has two virtual host a dev and live url. The live url I want to point to the live instance. ie port 3307 datadir /var/lib/mysql1/data. The second instance is used by the test url ie port 3308 /var/lib/mysql2/data.

Has anyone setup anything like this before?
 
Old 05-01-2007, 04:30 AM   #4
BarryLinux
LQ Newbie
 
Registered: Nov 2006
Posts: 7

Original Poster
Rep: Reputation: 0
We got the 2 mysql instances working in the end. Instead of using two port numbers. We decided to use a virtual IP. If anyone else has the same problem, below is our new my.cnf which works fine.

[mysqld_multi]
mysqld = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
user = mysql

[mysqld1]
socket = /var/lib/mysql1/mysql.sock1
bind-address = 10.10.1.5
pid-file = /var/lib/mysql1/mysql.pid1
datadir = /var/lib/mysql1/data

[mysqld2]
socket = /var/lib/mysql2/mysql.sock2
bind-address = 10.10.2.5
pid-file = /var/lib/mysql2/mysql.pid2
datadir = /var/lib/mysql2/data
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 17 09-17-2014 02:13 PM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock welery Linux - Software 19 03-06-2014 07:19 AM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. suziecorbett Linux - Software 8 10-09-2008 01:52 AM
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) sunlinux Linux - Software 1 11-07-2006 12:08 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration