note 112656 deleted from mysqli.quickstart.dual-interface by sobak
| From: | sobak@php.net | Date: | Thu, 08 Dec 2016 17:54:32 +0000 |
| Subject: | note 112656 deleted from mysqli.quickstart.dual-interface by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208285@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
After significant searching with no success finding a solution I was able to figure out the
following to error 2005 where the connection could not find the host. While I am hosted on 1&1 I
saw numerous posts with similar problems.
The solution turned out to be as follows:
<?php
$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT, DB_UNIX_SOCKET);
I added the DB_PORT and DB_UNIX_SOCKET
/** name of the database. please note: database and database table are not the same thing! */
define("DB_NAME", "YOUR DB NAME");
/** user for your database. the user needs to have rights for SELECT, UPDATE, DELETE and INSERT.
/** By the way, it's bad style to use "root", but for development it will work */
define("DB_USER", "YOUR DB USER");
/** The password of the above user */
define("DB_PASS", "YOUR DB PWORD");
/** The unix socket for 1&1 dedicated */
define("DB_UNIX_SOCKET", "/tmp/mysql5.sock");
/** The db port, replace with yours */
define("DB_PORT", 3306);
?>