# Closing MySQL connection?

**URL:** <https://forum.kirupa.com/t/closing-mysql-connection/310641>\
**Category:** programming\
**Created:** [June 15, 2010, 4:04pm UTC](https://forum.kirupa.com/t/closing-mysql-connection/310641 "2010-06-15T16:04:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jany](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jany](https://forum.kirupa.com/u/jany)\
**Post date:** [June 15, 2010, 4:04pm UTC](https://forum.kirupa.com/t/closing-mysql-connection/310641/1 "2010-06-15T16:04:02Z")

</div>

Hi there,

I am new to PHP and have a little question. I know how to close a MySQL connection if I open that connection within the very PHP file from which I am trying to close it.

Consider my main PHP file called MAIN.php:

What if I do this though:

```php
include_once "connect_to_mysql.php";

```

So there my connection is opened, as it goes to that PHP file and opens it.

Now, what if I wanted to close it from MAIN.php?

```php
mysql_close();

```

Do I just do that?

Thank you!:hobbes:
