LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 04-22-2009, 11:34 PM   #1
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Rep: Reputation: 55
how to create a new data directory for mysql server 5.1.31


hi all....

I am new to linux...I have a mysql server 5.0 version on my system ....I installed a new mysql server 5.1.31 but the problem is that if i do any changes in the database by starting new mysql server...Its is getting reflecting when i start the old server and see the database....i have to change the data directory path from /var/lib/mysql to somwhere..where i need to change this...

can any one help me please...

thanks in advance...
 
Old 04-23-2009, 12:05 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,907

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
Assuming that you are not going to run both servers simultaneously, that you can edit the start script of the 2nd mysqld, and use a different "--datadir=..." option. Of course that directory must exist and be ownned by the mysql user.
If you want both servers to run together you can follow these instructions.
 
Old 04-23-2009, 12:30 AM   #3
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Original Poster
Rep: Reputation: 55
i tried but iam getting error..

[root@localhost scripts]# mysql_install_db --datadir=/usr/local/mysql/data/mysql/
Installing MySQL system tables...
ERROR: 1 Can't create/write to file '/usr/local/mysql/data/mysql/mysql/db.MYI' (Errcode: 13)
090423 10:57:38 [ERROR] Aborting

090423 10:57:38 [Note] /usr/libexec/mysqld: Shutdown complete

Installation of system tables failed!

Examine the logs in /usr/local/mysql/data/mysql/ for more information.
You can try to start the mysqld daemon with:
/usr/libexec/mysqld --skip-grant &
and use the command line tool
/usr/bin/mysql to connect to the mysql
database and look at the grant tables:

shell> /usr/bin/mysql -u root mysql
mysql> show tables

Try 'mysqld --help' if you have problems with paths. Using --log
gives you a log in /usr/local/mysql/data/mysql/ that may be helpful.

The latest information about MySQL is available on the web at
http://www.mysql.com
Please consult the MySQL manual section: 'Problems running mysql_install_db',
and the manual section that describes problems on your OS.
Another information source is the MySQL email archive.
Please check all of the above before mailing us!
And if you do mail us, you MUST use the /usr/bin/mysqlbug script!
 
Old 04-23-2009, 12:47 AM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,907

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
From your commands, I guess (since you didn't say) that you are trying to use the binary mysql from www.mysql.com. If that's correct, make sure that no mysqld is running and use this:
Code:
/usr/local/mysql/scripts/mysql_install_db --datadir/usr/local/mysql/data
Since you're running it as root, you must after that chown the datadir to the user/group that mysqld will run (usually mysql/mysql)
After that try to start the new server using
Code:
/usr/local/mysql/suport-files/mysql.server.start
 
Old 04-23-2009, 01:55 AM   #5
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Original Poster
Rep: Reputation: 55
Thank you sir..
server is starting but if i try to type mysql -u root -p
and enter it is giving the error

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
 
Old 04-23-2009, 02:49 AM   #6
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,907

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
This is because you're not using the full path to the new mysql installation. Using just "mysql -u root -p" will run the old mysql binary that is in your PATH, thus it will try to connect to the old mysqld server.
You have to run
Code:
/usr/local/mysql/bin/mysql -u root -p
Not also that you have to define a different my.cnf file for the new mysql installation, so you don't use the default /etc/my.cnf. To do this you have to add the "--defaults-file=/path/to/new-my.cnf" in both mysqld and mysql options.
 
Old 04-23-2009, 03:15 AM   #7
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Original Poster
Rep: Reputation: 55
Thanks a lot its working...
 
  


Reply

Tags
mysql


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
How to Move the data directory of Mysql to different Location lakshmi4linux Linux - Newbie 1 03-31-2009 06:25 AM
MySql Data directory SlacUser Linux - Software 5 06-19-2007 10:48 AM
How can I create a MySQL server without password? [KIA]aze Programming 3 06-01-2007 03:01 PM
The postgresql data directory content in the pgsql directory is lost (empty data dir) kisembo Linux - Software 1 02-13-2006 01:11 PM
MySQL Data Directory Hamma Linux - Software 1 05-28-2003 02:30 PM


All times are GMT -5. The time now is 07:20 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration