MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Adrien Saladin Date:July 24 2004 3:18pm
Subject:specify database dir
View as plain text  

I'm quite new to mysql so I apologize if my question seems stupid. I hope it 
is the right mailing list for that question. 

I'm using the mysql embedded library (libmysqld) with a small c++ program. 
This program created a new database in its directory and I would like to use 
this database like any other normal database. 

I found a complicated way to do this by copying the /var/lib/mysql/mysql 
directory and files to my program's directory, changing owner and group to 
'mysql' and then runnig mysqld with "--datadir=."
It seems to work fine except for this message:
mysql> use dbtest;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

As you can see it is quite complicated. When I need to run my program, I have 
to change the owner and group for the database again. 

I tried  at least to make mysqld use the database without changing its owner 
like this: 

mysqld --user adrien --datadir=.  &
[1] 6633
root@omicron:/home/adrien/c++/mysqltest# Warning: Ignoring user change to 
'adrien' because the user was set to 'mysql' earlier on the command line
mysqld: ready for connections.
Version: '4.0.20-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 0
but I cannot use the database:
mysql> use ;
Can't read dir of './dbtest/' (Errcode: 13)
Database changed
mysql> show tables;
ERROR 12: Can't read dir of './dbtest/' (Errcode: 13)

Could somebody tell me a better way to use the local database "dbtest" ?


specify database dirAdrien Saladin24 Jul
  • Re: specify database dirMichael Stassen25 Jul