Mysql – Changing InnoDB data directory prevents MySQL service from starting

innodbMySQL

I have a MySQL instance installed on Windows 7 and I wanted to change the directory of InnoDB tables data.
I modified the "my.ini" adding the following line after "[mysqld]":

innodb_data_home_dir="/ibdata"

After that, I wasn't able to restart the MySQL. Looking at the log, it had the following entries:

130124 12:00:52 [Note] Plugin 'FEDERATED' is disabled.
130124 12:00:52 InnoDB: The InnoDB memory heap is disabled
130124 12:00:52 InnoDB: Mutexes and rw_locks use Windows interlocked functions
130124 12:00:52 InnoDB: Compressed tables use zlib 1.2.3
130124 12:00:52 InnoDB: Initializing buffer pool, size = 106.0M
130124 12:00:52 InnoDB: Completed initialization of buffer pool
130124 12:00:52  InnoDB: Operating system error number 3 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
InnoDB: File name \ibdata\ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.

I made sure I had created the directory "ibdata" under the MySQL data directory beforehand.
I've tried moving existing files I think are associated to InnoDB to the new directory (from the clue given by the log file) but the problem persisted.

Why mysql cannot start working with the new directory?

Best Answer

You mention that you are running on Windows. The path to Windows directories are not the same as UNIX ( you cannot just use /ibdata). Instead try setting it like:

innodb_data_home_dir="C:\path\to\ibdata"