MySQL Datadir under rhel6

MySQL Datadir under rhel6

am 24.05.2011 13:08:41 von Mario Deng

Hi Folks,

I am trying to change the datadir for mysql. For this I performed the =
following steps:

1: Create a new location for my datadir, e.g.: /media/spare/databases
2: Changed the ownership and permissions of this directory, e.g. "chown =
-R mysql:mysql /media/spare/databases" and "chmod -R 755 =
/media/spare/databases"
- All upper directories have x permission, to go through
3: Stop mysqld, e.g. "/etc/init.d/mysqls stop"
4: Edit the /etc/my.cnf, wait... there was no my.cnf, also not under =
"/etc/mysql/my.cnf". So I created "/etc/my.cnf" using defaults (got them =
from another rhel installation).
5: Start server, e.g. "/etc/init.d/mysqld start", worked fine and =
/etc/my.cnf was loaded without errors or warning, also not in the logs
- Stopped server again
6: Copied all files from "/var/lib/mysql" to "/media/spare/databases", =
except logfiles and checked the permission again - everything fine
7: Changed the datadir entry to "/media/spare/databases", trying to =
start the server it crashed, no error on the console, nothing in the =
logs

After some tries a gave up and tried another method:

1: Changes everything back to default
2: Created a symlink for my database under "/var/lib/mysql" pointing to =
"/media/spare/databases"
3: chown, chmod for the link and the target dir
4: Using mysql console, trying to create the db, I got an error (code =
13), so I can't create a db, with the same name as the symlink (in =
my.cnf symlinks are enabled)
5: Deleted the link, created the db, stopped mysqld, copied the content =
from "/var/lib/mysql/myDB" to "/media/spare/databases/myDB", checked =
permission etc.
6: Deleted the myDB directory and created a symlink for myDB to =
"/media/spare/databases/myDB".
7: mysqld starts now, but myDB isn't found

Any ideas from your side?

With best from GER
__
Mario Deng

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

Re: MySQL Datadir under rhel6

am 24.05.2011 13:55:46 von Johan De Meersman

This may be entirely down the wrong path, but I seem vaguely to remember that RedHat has the datadir and stuff (semi-) hardcoded in /etc/init.d/mysql.



----- Original Message -----
> From: "Mario Deng"
> To: mysql@lists.mysql.com
> Sent: Tuesday, 24 May, 2011 1:08:41 PM
> Subject: MySQL Datadir under rhel6
>
> Hi Folks,
>
> I am trying to change the datadir for mysql. For this I performed the
> following steps:
>
> 1: Create a new location for my datadir, e.g.: /media/spare/databases
> 2: Changed the ownership and permissions of this directory, e.g.
> "chown -R mysql:mysql /media/spare/databases" and "chmod -R 755
> /media/spare/databases"
> - All upper directories have x permission, to go through
> 3: Stop mysqld, e.g. "/etc/init.d/mysqls stop"
> 4: Edit the /etc/my.cnf, wait... there was no my.cnf, also not under
> "/etc/mysql/my.cnf". So I created "/etc/my.cnf" using defaults (got
> them from another rhel installation).
> 5: Start server, e.g. "/etc/init.d/mysqld start", worked fine and
> /etc/my.cnf was loaded without errors or warning, also not in the
> logs
> - Stopped server again
> 6: Copied all files from "/var/lib/mysql" to
> "/media/spare/databases", except logfiles and checked the permission
> again - everything fine
> 7: Changed the datadir entry to "/media/spare/databases", trying to
> start the server it crashed, no error on the console, nothing in the
> logs
>
> After some tries a gave up and tried another method:
>
> 1: Changes everything back to default
> 2: Created a symlink for my database under "/var/lib/mysql" pointing
> to "/media/spare/databases"
> 3: chown, chmod for the link and the target dir
> 4: Using mysql console, trying to create the db, I got an error (code
> 13), so I can't create a db, with the same name as the symlink (in
> my.cnf symlinks are enabled)
> 5: Deleted the link, created the db, stopped mysqld, copied the
> content from "/var/lib/mysql/myDB" to "/media/spare/databases/myDB",
> checked permission etc.
> 6: Deleted the myDB directory and created a symlink for myDB to
> "/media/spare/databases/myDB".
> 7: mysqld starts now, but myDB isn't found
>
> Any ideas from your side?
>
> With best from GER

--
Bier met grenadyn
Is als mosterd by den wyn
Sy die't drinkt, is eene kwezel
Hy die't drinkt, is ras een ezel

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org