# Connect to mysql database with ray

**URL:** https://discuss.ray.io/t/connect-to-mysql-database-with-ray/2887
**Category:** Ray Core
**Created:** [July 13, 2021, 10:27pm UTC](https://discuss.ray.io/t/connect-to-mysql-database-with-ray/2887 "2021-07-13T22:27:58Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![murat](https://avatars.discourse-cdn.com/v4/letter/m/bc8723/32.png) [@murat](https://discuss.ray.io/u/murat)
#### Post date: [July 13, 2021, 10:27pm UTC](https://discuss.ray.io/t/connect-to-mysql-database-with-ray/2887/1 "2021-07-13T22:27:59Z")

</div>

hi ,  
i want to connect mysql db with ray , is it possible ?

if is not , how can i access data on mysql db using ray ?

Thank you

---

<div class="post-metadata">

### Author: ![sangcho](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sangcho/32/425_2.png) [@sangcho](https://discuss.ray.io/u/sangcho)
#### Post date: [July 15, 2021, 5:29pm UTC](https://discuss.ray.io/t/connect-to-mysql-database-with-ray/2887/2 "2021-07-15T17:29:56Z")

</div>

It should be possible. But if you are using ray tasks, you might need to reinitiate the db connection whenever new tasks are spawned, so I’d recommend you to use an actor for this use case.

---

<div class="post-metadata">

### Author: ![murat](https://avatars.discourse-cdn.com/v4/letter/m/bc8723/32.png) [@murat](https://discuss.ray.io/u/murat)
#### Post date: [July 26, 2021, 7:26am UTC](https://discuss.ray.io/t/connect-to-mysql-database-with-ray/2887/3 "2021-07-26T07:26:49Z")

</div>

thank you sangcho , are there any articles for this ?

---

<div class="post-metadata">

### Author: ![sangcho](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sangcho/32/425_2.png) [@sangcho](https://discuss.ray.io/u/sangcho)
#### Post date: [July 28, 2021, 6:14pm UTC](https://discuss.ray.io/t/connect-to-mysql-database-with-ray/2887/4 "2021-07-28T18:14:40Z")

</div>

Hmm not that I now. @simon-mo do we have any document that shows this example? I think it is a pretty common use case for serve applications.
