Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 06-25-2003, 04:59 PM   #1
LQ Newbie
Registered: Sep 2002
Posts: 15

Rep: Reputation: 0
Angry mySQL my.cnf (moving default datadir) not working!


I've setup mySQL and it tested as working as it was defaulted. I'm working on a system that has more than 4Gigs of ram so I installed the default my-huge.cnf con fig file with sql's 2.3 my.cnf file in /etc/my.cnf

using /usr/libexec/mysqld –help
I ensured everything was set up as specified in the redhat bible 7.3. Then I used
mysqladmin variables
to check on what it's status was. Everything checked out ok there.

I used
chkconfig mysqld on
so the service would start on startup.

I have also created a .my.cnf file specifying the password so I wouldn't have to retype it each time I tried to do admin work on the database

Since this I have added a line which the origional my-huge.cnf did not have, that is specifying a new directory where the database is actually to be installed. I have set permissions on this directory and copied all the files that would copy from /var/lib/mysql/ and placed them in this new directory as I had noted on other sites I should be able to include the simple variable datadir = /abc2/genomeDB to reflect this change and hopefully it would work.


Now the service refuses to shutdown for a change. & when I try to perform any my mysqladmin functions it does not work:

[root@genome root]# mysqladmin variables | grep datadir
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!

So now I'm stuck. /usr/libexec/mysqld –help shows the directory is back at it's default, however mysqladmin will not work and so I assume the mySQL is no longer functioning correctly even though it says it can restart the service.

I simply want to know how to get the setting to reflect the default again and how to relocate the default directory for the data files.

I am assuming there is a problem with the socket communication but, as I'm very new at this I'm not certain at all.
Old 06-25-2003, 05:24 PM   #2
LQ Newbie
Registered: Sep 2002
Posts: 15

Original Poster
Rep: Reputation: 0
ARGH... I just looked for /var/lib/mysql/myspl.sock
though when I do a locate for mysql.sock it says it's in that directory.
I perform ls -la on /var/lib/mysql and it's not there.

Do I need to completly reinstall mySQL from the disks or something?
Old 01-26-2004, 10:39 AM   #3
LQ Newbie
Registered: Aug 2003
Posts: 10

Rep: Reputation: 0
I am having a similar problem. I installed MySQL 4.0.17 from the RPM's on the mysql website. I am running RH Fedora Core 1. They installed and work fine. When I try to change the default data directory so that it points to a directory on another hard drive (MORE SPACE) I am getting teh same socket error.

This is what I have in the /etc/my.cnf file

THATS IT!!! If I remove the /etc/my.cnf file, then MySQL starts, shutsdown, and runs properly. As soon as I stop it, change the datadir and then start it, it no longer functions properly.



Old 01-26-2004, 02:49 PM   #4
Registered: Oct 2003
Distribution: Gentoo rules them all
Posts: 279

Rep: Reputation: 31
here's mine as an example:
gene@linux gene $ cat /etc/mysql/my.cnf
# /etc/mysql/my.cnf: The global mysql configuration file.
# $Header: /home/cvsroot/gentoo-x86/dev-db/mysql/files/my.cnf-4.0.14-r1,v 1.1 2003/08/11 10:40:38 robbat2 Exp $
# This file can be simultaneously placed in three places:
# 1. /etc/mysql/my.cnf to set global options.
# 2. /var/lib/mysql/my.cnf to set server-specific options.
# 3. ~/.my.cnf to set user-specific options.
# One can use all long options that the program supports.
# Run the program with --help to get a list of them.
# The following values assume you have at least 32M RAM!

#password = my_password
port = 3306
socket = /var/run/mysqld/mysqld.sock

err-log = /var/log/mysql/mysql.err

user = mysql
pid-file = /var/run/mysqld/
socket = /var/run/mysqld/mysqld.sock
log-error = /var/log/mysql/mysqld.err
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
set-variable = key_buffer=16M
set-variable = max_allowed_packet=1M
set-variable = thread_stack=128K
# keep secure by default!
bind-address =
port = 3306
# this can make it even more secure:

set-variable = max_allowed_packet=1M

#no-auto-rehash # faster start of mysql but no tab completition

set-variable = key_buffer=16M

I've been able to move the data dir as long as i kept the sock file where it was. basically there will be 2 directories on the hd, one with mysql.sock file in default location and one with all the databases.

Last edited by Mikhail_16; 01-26-2004 at 02:55 PM.
Old 02-09-2006, 07:15 PM   #5
LQ Newbie
Registered: Feb 2006
Posts: 9

Rep: Reputation: 0
try this and see if it works...

setsebool -P mysqld_disable_trans=1


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
Start MySQL with a non-default datadir nifflerX Linux - Enterprise 9 02-28-2006 05:42 AM
Setting up the my.cnf for MySQL Server wbuik Linux - Software 1 09-24-2005 04:33 PM
how to config the mysql my.cnf? treotan Linux - General 1 09-14-2005 11:05 AM
Moving mySQL database subnet_rx Linux - Software 12 06-30-2004 04:41 PM
MySQL server & my.cnf hct224 Linux - Newbie 0 04-02-2004 01:03 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:56 PM.

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