# Custum datadir is being ignored after a upgrade

**URL:** https://forums.percona.com/t/custum-datadir-is-being-ignored-after-a-upgrade/13531
**Category:** General Questions
**Created:** [December 17, 2021, 12:16am UTC](https://forums.percona.com/t/custum-datadir-is-being-ignored-after-a-upgrade/13531 "2021-12-17T00:16:43Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![MasterCATZ](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@MasterCATZ](https://forums.percona.com/u/MasterCATZ)
#### Post date: [December 17, 2021, 12:16am UTC](https://forums.percona.com/t/custum-datadir-is-being-ignored-after-a-upgrade/13531/1 "2021-12-17T00:16:43Z")

</div>

all of these instruction were followed and working for years

> **[How To Move a MySQL Data Directory to a New Location on Ubuntu 16.04 |...](https://www.digitalocean.com/community/tutorials/how-to-move-a-mysql-data-directory-to-a-new-location-on-ubuntu-16-04)**
>
> Whether you’re adding more space for data or evaluating ways to optimize database performance, this tutorial will guide you through relocating MySQL’s data d…

I just did an upgrade from Ubuntu 20.04 to 22.04 and now mysql keeps using the default datadir

any idea’s what has changed the config files all seem to be pointing where I wanted them to ?

Server version: 5.7.29-32 Percona Server  
Ubuntu 22.04

/etc/apparmor.d/usr.sbin.mysqld

/etc/apparmor.d/tunables/alias

/etc/mysql/mysql.conf.d/mysqld.cnf

/etc/mysql/my.cnf

are all still pointing to my datadir

mysql config files

> **[mysqlconfigs.zip](https://drive.google.com/file/d/15z3WWWs-ZjlIQh9egnPehSq5lEdy_bMf/view?usp=sharing)**
>
> Google Drive file.

[mysqlstrace.txt](https://forums.percona.com/uploads/short-url/A6mBaCnUvI391yrn4DsUa0Jsajh.txt) (369.6 KB)

---

<div class="post-metadata">

### Author: ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)
#### Post date: [December 17, 2021, 4:51am UTC](https://forums.percona.com/t/custum-datadir-is-being-ignored-after-a-upgrade/13531/2 "2021-12-17T04:51:39Z")

</div>

Run the following to see if mysql is actually picking up your settings:

```
# mysqld --print-defaults

```

If you don’t see `--datadir=` in the output, then mysql is not picking up your config files. Check `# update-alternatives --query my.cnf` to see if the OS changed anything.

---

<div class="post-metadata">

### Author: ![MasterCATZ](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@MasterCATZ](https://forums.percona.com/u/MasterCATZ)
#### Post date: [December 17, 2021, 9:44am UTC](https://forums.percona.com/t/custum-datadir-is-being-ignored-after-a-upgrade/13531/3 "2021-12-17T09:44:36Z")

</div>

thanks for participating , unfortunately I get empty results

aio@aio:~$ mysqld --print-defaults  
mysqld would have been started with the following arguments:

aio@aio:~$

aio@aio:~$ update-alternatives --query my.cnf  
Name: my.cnf  
Link: /etc/mysql/my.cnf  
Status: auto  
Best: /etc/mysql/mariadb.cnf  
Value: /etc/mysql/mariadb.cnf

Alternative: /etc/mysql/mariadb.cnf  
Priority: 500

Alternative: /etc/mysql/my.cnf.fallback  
Priority: 100

Alternative: /etc/mysql/percona-server.cnf  
Priority: 300  
aio@aio:~$

and everyone of those files has the datadir set to a custom path that is being ignored

---

<div class="post-metadata">

### Author: ![CTutte](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ctutte/32/1341_2.png) [@CTutte](https://forums.percona.com/u/CTutte)
#### Post date: [December 17, 2021, 12:29pm UTC](https://forums.percona.com/t/custum-datadir-is-being-ignored-after-a-upgrade/13531/4 "2021-12-17T12:29:48Z")

</div>

Hi!

Check if /etc/my.cnf file exists and/or any other !include directive that might be trying to include another cnf file that overrides existing paths

---

<div class="post-metadata">

### Author: ![MasterCATZ](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@MasterCATZ](https://forums.percona.com/u/MasterCATZ)
#### Post date: [December 18, 2021, 1:51am UTC](https://forums.percona.com/t/custum-datadir-is-being-ignored-after-a-upgrade/13531/5 "2021-12-18T01:51:14Z")

</div>

well their was not a  
/etc/my.cnf file  
so I created one and now its working
