> For the complete documentation index, see [llms.txt](https://bpmflow.gitbook.io/project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bpmflow.gitbook.io/project/orbeon-integration/orbeon-persistence-layer-for-gemstone-s/migration-from-relational-database-to-gemstone-s/migration-from-mysql.md).

# Migration from MySQL

It is possible to migrate all forms stored in **MySql** to **GemStone/S**.\
\
In this section the migration process is described.

### MySql and GemStone/S on the same host

Create the file structure to store attachments, for example:

```
mkdir orbeonAttachments
mkdir orbeonAttachments/temp
mkdir orbeonAttachments/drafts
mkdir orbeonAttachments/instances
mkdir orbeonAttachments/definitions
mkdir orbeonAttachments/definitions/saved
mkdir orbeonAttachments/definitions/published
```

To migrate an application named 'myApp' and the form defitition named 'myFirstForm' execute the following:

```
OrbeonApiConfiguration default baseAttachmentPath: '/orbeonAttachments/'.
(OrbeonMySQLMigrator forApplicationNamed: 'myApp') migrateFormDefinitionNamed: 'myFirstForm'.
```

### MySql and GemStone/S on different hosts

Clone the file structure of **GemStone/S** host in the **MySql** host:

```
mkdir orbeonAttachments
mkdir orbeonAttachments/temp
mkdir orbeonAttachments/drafts
mkdir orbeonAttachments/instances
mkdir orbeonAttachments/definitions
mkdir orbeonAttachments/definitions/saved
mkdir orbeonAttachments/definitions/published
```

To migrate an application named 'myApp' and the form defitition named 'myFirstForm' execute the following:

```
OrbeonApiConfiguration default baseAttachmentPath: '/orbeonAttachments/'.
(OrbeonMySQLMigrator forApplicationNamed: 'myApp') migrateFormDefinitionNamed: 'myFirstForm'.
```

Copy the directory structure from **MySql** host to **GemStone/S** host.\
\
**NOTE**\
It is possible that **MySql** does **not** have permissions to dump the attachments to the configured path. To avoid this on:\
\* **MySql** on **Centos** (for more information search Enhanced Security system SELinux)

```
chown mysql:mysql /orbeonAttachments 
chcon -Rv --type=tmp_t /orbeonAttachments
```

* MySql on Ubuntu (search for AppArmor):
