Bug #68938 Datadir shows as blank
Submitted: 12 Apr 2013 0:15 Modified: 12 Apr 2013 5:28
Reporter: Todd Farmer (OCA) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Options Severity:S3 (Non-critical)
Version:5.6.10 OS:Any
Assigned to: CPU Architecture:Any

[12 Apr 2013 0:15] Todd Farmer
Description:
When started without an explicit --datadir option (at least on Windows), SHOW GLOBAL VARIABLES shows a blank datadir:

mysql> show global variables like 'data%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| datadir       |       |
+---------------+-------+
1 row in set (0.00 sec)

That's pretty useless - it should show the actual datadir that's being used, even if it's implicit.  This would then mirror the behavior of basedir, which doesn't show as blank, even when it's not explicitly defined:

mysql> show global variables like 'base%';
+---------------+------------------------+
| Variable_name | Value                  |
+---------------+------------------------+
| basedir       | D:\mysql-5.6.10-win32\ |
+---------------+------------------------+
1 row in set (0.00 sec)

How to repeat:
* Start MySQL (on Windows) without specifying a datadir
* SHOW GLOBAL VARIABLES LIKE 'datadir';

Suggested fix:
Show actual datadir being used by mysqld.
[12 Apr 2013 5:28] MySQL Verification Team
Duplicate of:
Bug 12546953 - "SHOW VARIABLES LIKE 'DATADIR';" RETURN EMPTY.

Fixed in 5.6.11.

mysql> show global variables like 'datadir';
+---------------+------------------------------+
| Variable_name | Value                        |
+---------------+------------------------------+
| datadir       | D:\build\mysql-5.6\sql\data\ |
+---------------+------------------------------+
1 row in set (0.00 sec)

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.6.12    |
+-----------+
1 row in set (0.00 sec)