mysql_close

Close MySQL connection

&mysql.alternative.note;

- `mysqli_close`
- PDO: Assign the value of &null; to the PDO object

&reftitle.description; `bool` `mysql_close` `resource` `link_identifier` NULL

`mysql_close` closes the non-persistent connection to the MySQL server that's associated with the specified link identifier. If `link_identifier` isn't specified, the last opened link is used.

&mysql.close.connections.result.sets;
&reftitle.parameters;

&mysql.linkid-noreopen.description;
&reftitle.returnvalues;

&return.success;

&reftitle.examples;

### `mysql_close` example

    <?php
    $link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
    if (!$link) {
        die('Could not connect: ' . mysql_error());
    }
    echo 'Connected successfully';
    mysql_close($link);
    ?>

&example.outputs;

    Connected successfully

&reftitle.notes;

`mysql_close` will not close persistent links created by `mysql_pconnect`. For additional details, see the manual page on persistent connections.

&reftitle.seealso;

- `mysql_connect`
- `mysql_free_result`