Bug #59043 Can't point mysql 5.5.8 datadir to be at another path then default
Submitted: 19 Dec 2010 18:58 Modified: 20 Dec 2010 21:48
Reporter: Neil Armstrong Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.5.8 OS:Linux (CentOS 5.5 64-bit)
Assigned to: CPU Architecture:Any

[19 Dec 2010 18:58] Neil Armstrong
Description:
Can't point mysql 5.5.8 datadir to be at another path then default (/usr/local/mysql/data)

How to repeat:
Clean CentOS 5.5 64-bit installation.
CMake 2.6.4 compiled from source (at /usr/local/cmake f.ex.). I've tried also with CMake 2.8.3, got the same result.

tar -zxvf mysql-5.5.8.tar.gz
cd mysql-5.5.8
chown -R root:root .
cmake -DMYSQL_DATADIR=/usr/local/mysql/var
make
make install

- gives us a datadir installed at /usr/local/mysql/data regardless of -DMYSQL_DATADIR option
[19 Dec 2010 20:22] Neil Armstrong
-DDEFAULT_CHARSET=utf8 and -DDEFAULT_COLLATION=utf8_general_ci
also don't work, stay as default latin1
[20 Dec 2010 11:10] Valeriy Kravchuk
With current mysql-5.5 tree I see the following:

openxs@ubuntu:/home2/openxs/bzr2/mysql-5.5$ cmake --version
cmake version 2.8.1
openxs@ubuntu:/home2/openxs/bzr2/mysql-5.5$ cmake -DMYSQL_DATADIR=/usr/local/mysql/var
-- MySQL 5.5.9
-- Looking for fdatasync
-- Looking for fdatasync - found
-- Configuring done
-- Generating done
-- Build files have been written to: /home2/openxs/bzr2/mysql-5.5
openxs@ubuntu:/home2/openxs/bzr2/mysql-5.5$ grep DATADIR include/config.h
#define MYSQL_DATADIR "/usr/local/mysql/var"

So, looks like this setting is taken into account. Please, check the results of the same commands in your case.

As for DEFAULT_CHARSET etc, this is a know bug #58991.
[20 Dec 2010 13:05] Neil Armstrong
[root@host mysql-5.5.8]# cmake --version
cmake version 2.8.3

[root@host mysql-5.5.8]# cmake -DMYSQL_DATADIR=/usr/local/mysql/var

[root@host mysql-5.5.8]# grep DATADIR include/config.h
#define MYSQL_DATADIR "/usr/local/mysql/var"

After that I "make" and "make install" and get datadir in /usr/local/mysql/data with "mysql" and "test" databases inside..
Looks like a bug?
[20 Dec 2010 21:48] Sveta Smirnova
Thank you for the feedback.

Wrong job of `make install` verified as described:

$grep DATADIR include/config.h
#define MYSQL_DATADIR "/users/ssmirnova/blade12/build/mysql-trunk/bug59043"

$make install
...

$ls /users/ssmirnova/blade12/build/mysql-trunk/bug59043
ls: /users/ssmirnova/blade12/build/mysql-trunk/bug59043: No such file or directory

$ls /users/ssmirnova/blade12/build/mysql-trunk/data
mysql  test