how to change the datadir,let data directory in another path? (no replies)

Submitted by programmer on Mon, 07/07/2008 - 11:48.

I has get client and server rmp, MySQL-client-community-5.1.25-0.rhel4.x86_64.rpm and MySQL-server-community-5.1.25-0.rhel4.x86_64.rpm.

and install on my computer succesfully.

(1)succefully install server and 3306 port is on

rpm -i MySQL-server-community-5.1.25-0.rhel4.x86_64.rpm

[omit some message .......]

Starting MySQL.[ OK ]

Giving mysqld 2 seconds to start

(2)successfully install mysql client and can connect to mysql server

rpm -i MySQL-client-community-5.1.25-0.rhel4.x86_64.rpm

warning: MySQL-client-community-5.1.25-0.rhel4.x86_64.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5

mysql

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.1.25-rc-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| test |

+--------------------+

3 rows in set (0.00 sec)

now I want change the datadir to another dictory such as /home/mysql, but failed.

i do as the following steps:

1.service mysql stop

2.cd /home; mkdir data

3. mv /var/lib/mysql/* /home/data/

4.cp /usr/share/mysql/my-medium.cnf /etc/my.cnf

5.vi my.cnf

socket = /home/data/mysql/mysql.sock

datadir = /home/data/mysql

6.chown -R mysql:mysql /home/data

chown -R mysql:mysql /home/data/mysql

chown -R mysql:mysql /home/data/mysql/*

7.restart mysql server but failed

service mysql start

Starting MySQL.Manager of pid-file quit without updating fi[FAILED]

now who can tell me how to change the mysql data directory or why failed .

much thanks to your contribution!

Post your Answer

  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options