How do I locate my new mySQL database where I want it? -
i'm on windows using mysql workbench when absolutely have to, otherwise ado.
i'm experienced jet databases create mdb file, put wherever want whenever want, , open database ado connection string containing path database.
now i've got wretched mysql thing ... reason don't understand there's data directory databases go , can't change when creating database(?).
so create database shell (1 junk table deleted later, no records) , it's stuck in worthless data directory. want copy/paste shell want it, , start working on through ado create "real" database ... doesn't work; ado connection string contains new path , connection opens no errors, operations change copy in data directory.
yes have searched topic, , "solutions" see change default data directory in ini file ... seems silly , unworkable; if want create database , put somewhere else?
can please shed light here?
once connect mysql database user can create databases, root
user after install, can write:
create database my_database;
and database created on machine that's running mysql server process in datadir
mysql using. there default locations these things, won't need worry them. don't need worry files end going first commenter says.
here information finding my.cnf file on windows. once find file, update datadir
location want this:
datadir="c:\new data\path"
and stop mysql server , move files. restart mysql server after copy of files in current datadir it. can find current datadir
following command (connected server root
user):
show variables '%datadir%';
make sure stop server before moving files.
the create table documentation shows can create table in tablespace
that's outside of datadir
. first create tablespace following:
create tablespace my_tablespace add datafile 'c:\my_space';
which needs single file if want use innodb engine. can create tables in table space specifying in table's creation like:
create table new_table (a int) tablespace my_tablespace;
i haven't done before, should work.
Comments
Post a Comment