Skip to content

Commit fd6d674

Browse files
authored
Merge pull request #8629 from tangix/update-db-docs-socket
docs: update database connection with information on how to connect to a MySQL server over a socket
2 parents b8adef6 + 2ae6628 commit fd6d674

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

user_guide_src/source/database/configuration.rst

+16
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,19 @@ Explanation of Values:
190190
etc.) not all values will be needed. For example, when using ``SQLite3`` you
191191
will not need to supply a username or password, and the database name
192192
will be the path to your database file.
193+
194+
MySQLi
195+
======
196+
197+
hostname
198+
--------
199+
200+
Configuring a Socket Connection
201+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
202+
203+
To connect to a MySQL server over a filesystem socket, the path to the socket should be specified in
204+
the ``'hostname'`` setting. CodeIgniter's MySQLi driver will notice this and configure the
205+
connection properly.
206+
207+
.. literalinclude:: configuration/011.php
208+
:lines: 11-18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Config;
4+
5+
use CodeIgniter\Database\Config;
6+
7+
class Database extends Config
8+
{
9+
// ...
10+
11+
// MySQLi over a socket
12+
public array $default = [
13+
// ...
14+
'hostname' => '/cloudsql/toolbox-tests:europe-north1:toolbox-db',
15+
// ...
16+
'DBDriver' => 'MySQLi',
17+
// ...
18+
];
19+
20+
// ...
21+
}

0 commit comments

Comments
 (0)