# 🛢️MySQL Connection String

***

Creating your connection string:

1. **Visit the MySQL String Generator Website:** [Here](https://brouznouf.github.io/fivem-mysql-async/)
2. Click `Next` twice until you are on `3: Configure the FXServer`.

<figure><img src="https://1879705341-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWNMt0AI0Q7rcNkVhKNa%2Fuploads%2FWuTy49n56Ua2Z3wRF2l0%2Fimage.png?alt=media&#x26;token=58a6faa9-8f5d-43d6-8492-00ec87235dd8" alt=""><figcaption></figcaption></figure>

3. **After you are on the 3rd page, scroll down until you see this:**

<figure><img src="https://1879705341-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWNMt0AI0Q7rcNkVhKNa%2Fuploads%2F5zANl66xfwWiYYRZaXhx%2Fimage.png?alt=media&#x26;token=ccc81fac-cdc7-46c3-beef-37c3e7f88db0" alt=""><figcaption></figcaption></figure>

4. **The following information will be required for your connection string to work:** (Some other things you can add will be: **acquireTimeout** and **connectTimeout** - These will make the string take longer before connecting / pushing an error.)

* User
* database
* host
* password

<figure><img src="https://i.imgur.com/I2hE9QE.png" alt=""><figcaption><p>Password only required if you created with a password</p></figcaption></figure>

5. **After filling out the info regarding your database and you should see a section called `FXServer Configuration`**
6. **Copy the line shown below from the website and paste it into your server.cfg and restart your server**

<figure><img src="https://1879705341-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWNMt0AI0Q7rcNkVhKNa%2Fuploads%2FYAi8HxxSx9kr0vdn35mm%2Fimage.png?alt=media&#x26;token=b4935ae0-4e98-49bf-85e3-41a7544f56c4" alt=""><figcaption></figcaption></figure>

## Ensuring oxmysql or mysql-async

Whether you use [oxmysql ](https://github.com/overextended/oxmysql)or [mysql-async](https://github.com/brouznouf/fivem-mysql-async) the way you ensure the it matters.

1. Put the following lines of code into your server.cfg below all the default resources required by FiveM.

```lua
set mysql_connection_string "host=localhost;user=root;database=fivem"
ensure mysql-async -- Only if using mysql-async
ensure oxmysql -- Only if using oxmysql
```

Congratulations, you connected your database to your FiveM Server!
