mySQL my.cnf (moving default datadir) not working!
VERY FURASTRATED!!
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. Not. 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. |
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? |
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 [mysqld] datadir=/opt/mysqldata 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. Anyone? Thanks Magnus :Pengy: |
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! [client] #password = my_password port = 3306 socket = /var/run/mysqld/mysqld.sock [safe_mysqld] err-log = /var/log/mysql/mysql.err [mysqld] skip-innodb user = mysql pid-file = /var/run/mysqld/mysqld.pid 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 skip-locking set-variable = key_buffer=16M set-variable = max_allowed_packet=1M set-variable = thread_stack=128K # keep secure by default! bind-address = 127.0.0.1 port = 3306 # this can make it even more secure: #skip-networking [mysqldump] quick set-variable = max_allowed_packet=1M [mysql] #no-auto-rehash # faster start of mysql but no tab completition [isamchk] 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. |
try this and see if it works...
setsebool -P mysqld_disable_trans=1 |
All times are GMT -5. The time now is 04:36 PM. |