[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

MySQL Problems With a New Data Directory



I'm using MySQL 4.0.24-10 on Sarge.  I had a setup of a program I've been 
working on for several years that is on a RAID.  I changed MySQL's data 
directory so it will be on the same RAID and backed up, along with all my 
other data and programs.  Originally this was set up under a Debian-based 
distro that was based on the testing and unstable branches of Debian.  Before 
putting the server into production, I wanted to change it to Sarge for 
safety.

So I backed up all the data on the RAID, wiped the original boot/system drive, 
installed Debian Sarge, did an fsck on the RAID, found errors, wiped it out, 
restored the original data, including the MySQL db files.  When I installed 
MySQL on the re-done system, it worked.  When altered the line 
in /etc/mysql/my.cnf from:

datadir = /var/lib/mysql

to:

datadir = /thresh/tNet/db

and restarted MySQL with /etc/init.d/mysql start, I get the following:

Starting MySQL database server: mysqld.
Checking for crashed MySQL tables in the background.
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'debian-sys-maint@localhost' (Using password: 
YES)'
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'debian-sys-maint@localhost' (Using password: 
YES)'

However, after I got this, I entered "mysql" and got a connection.  The 
databases and tables seemed intact.

I checked, and it turned out that somewhere in the backup/restore process the 
ownership of the files was changed.  I went through and changed the ownership 
of /thresh/tNet/db to mysql:mysql and changed the ownership 
of /thresh/tNet/db/mysql to mysql:root.  Basically, I changed the ownership 
of the files in the new data directory to match what I found 
in /var/lib/mysql, then I stopped and restarted MySQL.  I still got the same 
error messages.

While MySQL is working, I don't want to do anything with it because I'm not 
clear why debian-sys-maint needs access, as opposed to just the user mysql.  
To test, I made sure all the files from the db directory on down were set for 
all to read and write and all directories set for all to read, write, and 
execute.  That doesn't help.

So what is wrong, what do I need to do, and why didn't I get this error when 
using the same database directory before?

Thanks for any help!

Hal



Reply to: