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

xDieTaube

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

First I did:

  • service mysql stop

  • mkdir /media/pi/EMTEC/mysql

  • nano /etc/mysql/my.cnf and changed datadir=/media/pi/EMTEC/mysql

  • cp -Rv /var/lib/mysql/* /media/usb4/mysql/

  • chown -R mysql:mysql /media/usb4/mysql/

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?

sun_jara

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

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

Collected from the Internet

Please contact javaer1[email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Cannot export database with mysqldump: unknown variable 'datadir=/var/lib/mysql'

MYSQL error 1064 ,how to fix it?

How can I fix MySQL error #1064?

How to fix this MySql syntax error in PHP?

How to fix join error in mysql update query

How to fix error with MySQL because of timezone change?

how to fix "MySQL 1064 error Syntax Workbench"

How to fix mysql query syntax error

how can fix error 1064 mysql

How to fix this mysql create table syntax error

How do I fix this MYSQL//Phpmyadmin error?

How to update apache, mysql, phpmyadmin and php on Raspbian?

How to Fix "A Database Error Occurred" in Codeigniter for IF condition in MySQL?

How to fix SQL syntax error using liquibase and mysql to create trigger

How do I fix the error when updating information in a MySQL table?

How to fix 'Can't connect to MySQL server on 'localhost:3306' error

How to fix duplicate key error while SET in MySQL

How to fix "mbind: Operation not permitted" in mysql error log

How to fix the error coming pip install MySQL-python

How to fix the the error in migration when migrating in mysql in django

How to fix error when dropping a Foreign key in MySQL table?

How to fix ‘bind_param() ’ error in PHP with PDO mysql conection

how to fix mysql 2003 timed out error on ubuntu server?

How to fix MySQL 8 error codes : 1525 and 1292?

How do I fix this error with creating a virtual table in MySQL?

How can I fix this syntax error on my PHP MySQL query

How to fix error in this emulator?

How to fix "StringIndexOutOfBoundsException" error?

Theme Error - how to fix?