Jump to content

How do I store MySQL data directory on separate partition?


Fluffy Convict

Recommended Posts

I installed MySQL on C:\Program Files\xampp\mysql and moved and renamed the data directory from C:\Program Files\xampp\mysql\data to D:\mysql.

 

Then I opened up C:\Program Files\xampp\mysql\bin\my.ini and changed the datadir value to D:\mysql. However, trying to run my (local) website gives me a "Can't connect to MySQL server on 'localhost' (10061)" error. This makes sense, because since I've made these changes MySQL refuses to run. I don't know why - I tried to enable error logging in my.ini but it doesn't work.

 

I've copied my entire my.ini file underneath. I normally would only post relevant pieces but since I'm stuck the full 61 lines. I'm sorry - in advance :-)

 

Does anybody know why:

- error logging doesn't work (the file isn't being created)?

- MySQL gives me a "can't connect" error?

 

Any help would be greatly appreciated!

 

[client] 
port   = 3306 
socket = "C:/Program Files/xampp/mysql/mysql.sock"

[mysqld]
port    = 3306
socket  = "C:/Program Files/xampp/mysql/mysql.sock"
basedir = "C:/Program Files/xampp/mysql" 
tmpdir  = "C:/Program Files/xampp/tmp" 
datadir = "D:/mysql"

skip-locking

key_buffer              = 16M
max_allowed_packet      = 1M
table_cache             = 64
sort_buffer_size        = 512K
net_buffer_length       = 8K
read_buffer_size        = 256K
read_rnd_buffer_size    = 512K
myisam_sort_buffer_size = 8M

log_error = "D:/mysql/mysql_error.log"

skip-federated

server-id = 1

# Comment the following if you are using InnoDB tables
#skip-innodb
innodb_data_home_dir            = "D:/mysql"
innodb_data_file_path           = ibdata1:10M:autoextend
innodb_log_group_home_dir       = "D:/mysql"
innodb_buffer_pool_size         = 16M
innodb_additional_mem_pool_size = 2M
innodb_log_file_size            = 5M
innodb_log_buffer_size          = 8M
innodb_flush_log_at_trx_commit  = 1
innodb_lock_wait_timeout        = 50

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

I don't know xampp but look in the process (task manager) if mysql is there. If it's run as a service, click start->run->services.msc and look if it started or not.

 

Try to run it if it don't or restart it if it run.

 

Did you copy the database in the new folder ? MySQL need the 'mysql' database to store the username/password. Stop mysql or the service first before copy it, then restart it.

 

If that don't work try to find the xampp/mysql version you are using and any error message when mysql start.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.