List:General Discussion« Previous MessageNext Message »
From:Lou Olsten Date:May 28 2004 6:20pm
Subject:Re: location of created database
View as plain text  
From the docs at:

"Databases in MySQL are implemented as directories containing files that
correspond to tables in the database. Because there are no tables in a
database when it is initially created, the CREATE DATABASE statement only
creates a directory under the MySQL data directory (and the `db.opt' file,
for MySQL 4.1.1 and up). "

You can change the data directory with the datadir parameter.

To change after the fact, I think you'll want to stop the server, move the
directories, change the datadir to the new location, then restart... I've
not done this, so someone else may want to confirm.


----- Original Message ----- 
From: "Bono, Saroj AA R62" <saroj.bono@stripped>
To: <mysql@stripped>
Sent: Friday, May 28, 2004 10:52 AM
Subject: location of created database

When I created a database (directly in mysql) from some random dir where
I started mysql, I found that it got created in the /var/lib/mysql dir.
I ran mysql from a dir where my C++ program is. I wanted to create a
database using mysql_query so I did mysql_query( &mysql, "CREATE
DATABASE IF NOT EXISTS abc"). THis didnt create anything. If it did
would it be created in the /var/lib location ?I want to create it in my
local dir (when I do get my syntax to work!). How do I tell mysql to
make the database in some specific location?

location of created databaseSaroj AA R62 Bono28 May
  • Re: location of created databasegerald_clark28 May
  • Re: location of created databaseLou Olsten28 May