1

Need: To store / accesses dbTable data from a separate drive not the default

I was using MySQL 5.7 so far & as specified in the solution - Link1 I added the my.ini file with the info as stated & it worked fine.

I now uninstalled MySQL 5.7, installed MySQL 8, created a my.ini file & specified the info as stated in this solution Link2. But when I check it still points to the default C:\ drive & hence unable to access data from the existing database stored in E:\ drive

SHOW GLOBAL VARIABLES LIKE 'datadir';

shows

C:\ProgramData\MySQL\MySQL Server 8.0\Data\

The new my.ini file which I have created as below in

C:\Program Files\MySQL\MySQL Server 8.0 

[mysqld]
datadir = E:/MySqlData
secure-file-priv="E:/MySqlData/Uploads"

Hope the issue faced is clear, await inputs.

Edit:

I found this input - Link Could anyone let me know if this could be a reason ? Also any known hex editors for Windows 10 ?

Update: Even after removing the hex characters, the server still does not start if I point the parameter datadir in my.ini file to my database folder in another drive

0

Assuming you specified my.ini location when you created the service, then you can open services, right click MySQL service, and choose properties. open my.ini file and check datadir location.

installed MySQL without specify my.ini location, navigate to mysql\bin directory using PowerShell or CMD. then execute the following command

.\mysqld --help --verbose > \output\location\out.txt
 notepad \output\location\out.txt

then search for Default options are read from the following files in the given order: this should specify my.ini location. and locate it from their.

and change datadir based inside the used my.ini

  • Thanks,what baffles me is that after specifying the file path in my.ini in C:\Program Files\MySQL\MySQL Server 8.0\my.ini to point to E:\ drive & also updating the Windows Redistry, the server does not start. This behavior I notice in Ver 8, while it was working fine while using Ver 5.7. Anything else I need to check ? – iCoder Jul 3 at 5:26
  • would you please provide me with changes you did to registry? and the error you got when you try to start the SID using CL – Ahmad Abuhasna Jul 3 at 5:55
  • The changes done to registry as per the solution provided (Step-3) in Link 2 cited in my query above. When I open Services.msc, right click on MySQL80 & click start services it takes a long time & at the end says cannot start. But if the 'datadir' points to the default drive, then the server starts immediately. – iCoder Jul 3 at 7:43
  • stop your SID service then open powershell, then execute the following command as administrator copy-item C:\ProgramData\MySQL\MySQL Server 8.0\Data\ E:\Data. after that open ini file and edit datadir to e:\Data then try to start the service. – Ahmad Abuhasna Jul 3 at 8:24
0

Try to save as your my.ini to ANSI. MySQL's default encoding of my.ini now is UTF-8. It should be ANSI, then restart the mysql server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.