# Error after changing datadir

**URL:** https://forums.percona.com/t/error-after-changing-datadir/5830
**Category:** Percona Server for MySQL 5.6
**Created:** [August 30, 2017, 8:44am UTC](https://forums.percona.com/t/error-after-changing-datadir/5830 "2017-08-30T08:44:22Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![phiber](https://avatars.discourse-cdn.com/v4/letter/p/5f9b8f/32.png) [@phiber](https://forums.percona.com/u/phiber)
#### Post date: [August 30, 2017, 8:44am UTC](https://forums.percona.com/t/error-after-changing-datadir/5830/1 "2017-08-30T08:44:22Z")

</div>

I added 2 SSDs in RAID 1 configuration and mounted them as /ssd.  
At first, it was very important that two tables from a single database are moved to faster drives so I used the pt-online-schema-change tool to change their datadir to /ssd/mysql

After some time (about 24 hrs) we were able to bring the server down for a couple of minutes so I:

1. stopped the server
2. copied /var/lib/mysql to /ssd/mysql, keeping file and directory ownership of the mysql user
3. changed the datadir in my.cnf to /ssd/mysql
4. started the server and got errors on tables that were previously moved with pt-online-schema-change

Here is the error log:  
2017-08-30 12:55:22 2384 [ERROR] InnoDB: A tablespace for dbname/table\_name has been found in multiple places;  
2017-08-30 12:55:22 2384 [ERROR] InnoDB: Default location; ./dbname/table\_name.ibd, LSN=0, Space ID=806060, Flags=1024  
2017-08-30 12:55:22 2384 [ERROR] InnoDB: Dictionary location; /ssd/mysql/dbname/table\_name.ibd, LSN=0, Space ID=806060, Flags=1024  
2017-08-30 12:55:22 2384 [ERROR] InnoDB: Will not open the tablespace for ‘dbname/table\_name’  
2017-08-30 12:55:22 7f8967ff2700 InnoDB: cannot calculate statistics for table “dbname”.“table\_name” because the .ibd file is missing. For help, please refer to [url][http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html[/url]](http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html%5B/url%5D)  
2017-08-30 12:55:23 7f8967ead700 InnoDB: cannot calculate statistics for table “dbname”.“table\_name2” because the .ibd file is missing. For help, please refer to [url][http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html[/url]](http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html%5B/url%5D)

and so on.

what should I do? Move those tables back to the original location with pt-online-schema-change and repeat the steps above?

---

<div class="post-metadata">

### Author: ![modern\_zoro](https://avatars.discourse-cdn.com/v4/letter/m/c0e974/32.png) [@modern\_zoro](https://forums.percona.com/u/modern_zoro)
#### Post date: [September 26, 2017, 1:49pm UTC](https://forums.percona.com/t/error-after-changing-datadir/5830/2 "2017-09-26T13:49:06Z")

</div>

Hi,  
did you checked ownership of new dir ?  
try  
chown -p mysql:mysql /ssd/\*
