FIXED.

For those that don't know go through the searchable archive of this mailing 
list (http://lists.mysql.com) ... I should have done in the first case!

Anyway, if ever you get the socket error described below it's just a case 
of setting your permissions correctly.
chmod 700 datadir (e.g chmod 700 /var/lib/mysql )

So, below is an idiots guide to moving a database somewhere else (on same 
host). Which is where all my problems originally started. All actions 
performed from the root user account (steady kids).

1. Make a directory on the filesystem  where you want to put the database 
(in my case the /x filesystem)

                 mkdir /x/mysql
                 mkdir /x/mysql/testdb   {testdb = name of database}

2. Change ownership on the directories:         { mysql = username of MySQL 
admin account)

                 chown mysql /x/mysql
                 chown mysql /x/mysql/testdb

3. Change protection mode on above directories:

                 chmod 700 /x/mysql
                 chmod 660 /x/mysql/testdb
                 chgrp mysql /x/mysql/testdb

4. Shutdown mysql server

                 mysqladmin -p shutdown

5. Copy database files from original directory to new directory

                 cp -rp /var/lib/mysql/testdb   /x/mysql

6. Check permissions (see 2 + 3 above)

7. Rename original database directory to something "safe" as a backup.

                 mv /var/lib/mysql/testdb   /var/lib/mysql/testdb.sav

8. Create symbolic link:

                 ln -s /x/mysql/testdb /var/lib/mysql/testdb

9. Restart Server:

                 /etc/init.d/mysql start  (or your usual method)

Hey Tesco, everything should work. (This process worked for me on a REd Hat 
7.0 machine - intel ). Mind you, this is only a test machine with a small 
database. On a larger production database you would probably want to make a 
dump of the database first as an additional safeguard  - all I've done here 
is to preserve the original database directory (renamed ..../testdb to 
..../testdb.sav)

Hope this is of some use to somebody.

rgds
Neil.

At 10:54 31/07/01, Neil Barnes wrote:
>Hi Guys,
>
>         Ahem...er, I've dropped a clanger! I tried to move my 
> datadirectory to another device with more room. And yes, I know NOW that 
> I should have created symbolic links for the databases in question 
> but...well, the rest is history...
>*********************
>First Tech info: Red Hat Linux v7.0, Intel.
>
>Latest version of MySQL = 3.23.39
>
>6049585 Jul 11 10:29 MySQL-3.23.39-1.i386.rpm
>   698022 Jul 11 13:31 MySQL-bench-3.23.39-1.i386.rpm
>1772486 Jul 11 11:08 MySQL-client-3.23.39-1.i386.rpm
>   232649 Jul 11 11:03 MySQL-shared-3.23.39-1.i386.rpm
>
>
>So:
>
>1. Shutdown server.
>2. Copied datadir (/var/lib/mysql) to new directory in its entirity 
>(/x/mysql).
>3. Edited startup script (/etc/init.d/mysql) and changed the entry 
>"datadir=/var/lib/mysql" to "datadir=/x/mysql"
>4. Restarted server - server came up OK but I couldn't connect to it.
>5. Shutdown server.
>6. Edited startup script back as normal (/var/lib/mysql)
>7. COULD NOT RESTART SERVER  (see my error log below).
>
>It seems that there is a file called mysql.sock which is causing the problems.
>Any ideas anyone?
>
>**** datadirectory
>(/var/lib/mysql) = drwxr-xr-x    6 root     root         1024 Jul 31 09:23 
>mysql
>
>**** extract from /etc/init.d/mysql
># Set some defaults
>datadir=/var/lib/mysql
>basedir=
>pid_file=
>
>*** extract from my error log (the first bit must be when I shut down and 
>there was idle users connected).
>
>010725 15:08:56  Aborted connection 311 to db: 'norasia' user: 'adminit' 
>host: `localhost' (Got an e
>rror reading communication packets)
>010731  8:52:14  Aborted connection 555 to db: 'unconnected' user: 'root' 
>host: `localhost' (Got an
>error writing communication packets)
>010731  8:52:14  /usr/sbin/mysqld: Normal shutdown
>
>010731  8:52:14  /usr/sbin/mysqld: Shutdown Complete
>
>010731 08:52:14  mysqld ended
>
>010731 08:59:06  mysqld started
>010731  8:59:06  /usr/sbin/mysqld: Can't create/write to file 
>'/x/mysql/mail.dcaliner.co.uk.pid' (Er
>rcode: 13)
>/usr/sbin/mysqld: ready for connections
>010731 09:07:12  mysqld ended
>010731 09:16:51  mysqld started
>010731  9:16:51  Can't start server : Bind on unix socket: Permission denied
>010731  9:16:51  Do you already have another mysqld server running on 
>socket: /var/lib/mysql/mysql.s
>ock ?
>010731  9:16:51  Aborting
>
>010731  9:16:51  /usr/sbin/mysqld: Shutdown Complete
>
>010731 09:16:51  mysqld ended
>
>010731 09:19:04  mysqld started
>010731  9:19:04  Can't start server : Bind on unix socket: Permission denied
>010731  9:19:04  Do you already have another mysqld server running on 
>socket: /var/lib/mysql/mysql.s
>ock ?
>010731  9:19:04  Aborting
>
>010731  9:19:04  /usr/sbin/mysqld: Shutdown Complete
>
>010731 09:19:04  mysqld ended
>
>
>Neil Barnes, Systems Manager
>DCA Liner Limited
>4 Pennine Way,
>Saltley Business Park,
>Saltley,
>Birmingham B8 1JW
>
>T:      +44 121 325 7527
>F:      +44 121 328 2552
>E:      [EMAIL PROTECTED]
>
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>   http://www.mysql.com/manual.php   (the manual)
>   http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <[EMAIL PROTECTED]>
>To unsubscribe, e-mail <[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>

Neil Barnes, Systems Manager
DCA Liner Limited
4 Pennine Way,
Saltley Business Park,
Saltley,
Birmingham B8 1JW

T:      +44 121 325 7527
F:      +44 121 328 2552
E:      [EMAIL PROTECTED]



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to