Skip to content

Commit 176a50f

Browse files
committed
Update connection docs with information on how to connect to a MySQL server over a socket.
1 parent bbb9542 commit 176a50f

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

user_guide_src/source/database/configuration.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ add the config variables as a query string:
6666
database character set), which are present in the rest of the configuration
6767
fields, CodeIgniter will append them.
6868

69+
Configuring a MySQL socket connection
70+
-------------------------------------
71+
72+
To connect to a MySQL server over a filesystem socket, the path to the socket should be specified in
73+
the ``'hostname'`` setting. CodeIgniter's MySQLi driver will notice this and configure the
74+
connection properly.
75+
76+
.. literalinclude:: configuration/011.php
77+
:lines: 11-18
78+
6979
Failovers
7080
---------
7181

Lines changed: 21 additions & 0 deletions
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)