Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mysql database location

Status
Not open for further replies.

juker

Programmer
Jun 28, 2004
2
US
i'm running mysql on mandrake 8.2. it was installed when i installed the O/S. how can i change the directory where databases are stored?

i have no my.cnf file. i'm using mysql 3.23.47-5
 
on *nix mysql will be happy to follow symbolic links, so you can effectively put the database directory anywhere, or you can use the --datadir(sp?) argument to specify where you want it from the mysqld startup file. ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
hi,

the --datadir= doesn't work for me. i changed it in both the /etc/rc.d/init.d/msyql and the /usr/share/mysql/mysql.server files and no luck.

how would i setup the symbolic link method?
 
These commands should do it:
mkdir /new/path/to/dbs
cp -R /old/path/to/dbs/* /new/path/to/dbs
rm -fr /old/path/to/dbs
ln -s /new/path/to/dbs /old/path/to/dbs
If you don't want to move your existing databases, leave out the cp command. //Daniel
 
hi

my way would be

# vi /etc/my.cnf
insert this into the new file/edit existing one
[mysqld]
datadir = /new/mysql/data/dir

# cp -R /old/mysql/data/dir/mysql /new/mysql/data/dir
# chown -R mysql.mysql /new/mysql/data/dir/mysql
# chmod 660 /new/mysql/data/dir/mysql/*
# /etc/init.d/mysql stop
# /etc/init.d/mysql start

u can copy/move also your own database files, but this one (mysql) is required

now - if the server is running you can delete the old datadir
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top