I
I
Ivan Melnikov2018-05-18 15:55:43
MySQL
Ivan Melnikov, 2018-05-18 15:55:43

How to change location of database files in MySQL 8.0?

My computer has MySQL 8.0 server installed. A separate HDD was allocated for the database files. How can I make sure that the files of this database are on a new separate hard drive, and the MySQL server itself remains on the old drive? It is necessary that ONLY the database files without any garbage lie on the new disk.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Melkij, 2018-05-18
@immelnikoff

- correctly stop the database
- make sure that the database is not running
- copy the entire datadir (see the mysql configuration file) to a new location
- change the datadir in the config to a new location
- start the database
- check the success and demolish the old datadir

A
Alex McArrow, 2018-05-18
@AlexMcArrow

File my.cnf
datadir=/data/mysql - write the path where you need

R
Rsa97, 2018-05-18
@Rsa97

Option --datadir , it is also in the config file. datadir
system variable

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question