Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update database connection with information on how to connect to a MySQL server over a socket #8629

Merged
merged 4 commits into from
Mar 18, 2024

Conversation

tangix
Copy link
Contributor

@tangix tangix commented Mar 15, 2024

Description
Added a section on how to connect to a MySQL server over a socket. I'm developing for Google Cloud Run / Cloud SQL and had to use the CodeIgniter source to understand how to connect to the Cloud SQL socket created with --add-cloudsql-instances parameter passed to gcloud deploy.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@tangix tangix changed the title Update database connection docs with information on how to connect to a MySQL server over a socket docs: update database connection with information on how to connect to a MySQL server over a socket Mar 15, 2024
@kenjis kenjis added the documentation Pull requests for documentation only label Mar 15, 2024
@kenjis
Copy link
Member

kenjis commented Mar 16, 2024

Thank you!

How about this?

--- a/user_guide_src/source/database/configuration.rst
+++ b/user_guide_src/source/database/configuration.rst
@@ -66,16 +66,6 @@ add the config variables as a query string:
     database character set), which are present in the rest of the configuration
     fields, CodeIgniter will append them.
 
-Configuring a MySQL socket connection
--------------------------------------
-
-To connect to a MySQL server over a filesystem socket, the path to the socket should be specified in 
-the ``'hostname'`` setting. CodeIgniter's MySQLi driver will notice this and configure the 
-connection properly.
-
-.. literalinclude:: configuration/011.php
-    :lines: 11-18
-
 Failovers
 ---------
 
@@ -200,3 +190,19 @@ Explanation of Values:
     etc.) not all values will be needed. For example, when using ``SQLite3`` you
     will not need to supply a username or password, and the database name
     will be the path to your database file.
+
+MySQLi
+======
+
+hostname
+--------
+
+Configuring a Socket Connection
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+To connect to a MySQL server over a filesystem socket, the path to the socket should be specified in
+the ``'hostname'`` setting. CodeIgniter's MySQLi driver will notice this and configure the
+connection properly.
+
+.. literalinclude:: configuration/011.php
+    :lines: 11-18

Before:
Screenshot 2024-03-16 9 41 37

After:
Screenshot 2024-03-16 9 43 08

@tangix
Copy link
Contributor Author

tangix commented Mar 16, 2024

@kenjis Hmmm... I seem to have messed up your changes and haven't found a way to undo that... Sigh.

@kenjis
Copy link
Member

kenjis commented Mar 16, 2024

What's wrong? It seems okay.

@tangix
Copy link
Contributor Author

tangix commented Mar 16, 2024

What's wrong? It seems okay.

Yeah, now... I haven't really understood the GitHub magic and my GitKraken client gives me a hard time.
I think all looks good now.

@kenjis kenjis merged commit fd6d674 into codeigniter4:develop Mar 18, 2024
8 checks passed
@kenjis
Copy link
Member

kenjis commented Mar 18, 2024

@tangix Thank you!

@kenjis kenjis added the database Issues or pull requests that affect the database layer label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database Issues or pull requests that affect the database layer documentation Pull requests for documentation only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants