xDieTaube
xDieTaube

Reputation: 23

How to fix the error "unknown variable datadir" in mysql on raspbian?

I want to safe the Databases on an Usbstick and not on my RaspberryPi.

First I did:

which worked without problems

My my.cnf:

[client-server]

!includedir /etc/mysql/conf.d/

!includedir /etc/mysql/mariadb.conf.d/

datadir=/media/pi/EMTEC/mysql

When trying to restart the mysql service I receive:

mysql: unknown variable 'datadir=/media/pi/EMTEC/mysql'

How do I fix that error?

Upvotes: 1

Views: 7462

Answers (2)

Avinash kumar
Avinash kumar

Reputation: 1

The above solution didn't solve my problem.

I did move the datadir under [mysqld] but it was giving errors for other files, so I moved all below files under [mysqld].

like below and it fixed issues at my end.

[mysqld]
datadir=/var/lib/mysql
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Upvotes: 0

sun_jara
sun_jara

Reputation: 1815

Add datadir to [mysqld] section. datadir is a global variable to configure mysql server.

[mysqld]
datadir=/your/new/dir/

Upvotes: 2

Related Questions