I found the reason why the connection was not working, it was because the connection was trying to connect to port 8888, when it needed to connect to port 8889.
$conn = new PDO("mysql:host=$servername;port=8889;dbname=AppDatabase", $username, $password);
This fixed the problem, although changing the server name to localhost still gives the error.
Connection failed: SQLSTATE[HY000] [2002] No such file or directory
But it connects successfully when the IP address is entered for the server name.
Related Posts:
- PHP Connection failed: SQLSTATE[HY000] [2002] Connection refused
- How to use mysqli_query() in PHP?
- PDOException SQLSTATE[HY000] [2002] No such file or directory
- PDOException SQLSTATE[HY000] [2002] No such file or directory
- PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP
- what does “/index.php?admin/admin_dashboard” in my url mean
- PDO with INSERT INTO through prepared statements
- PDO bindParam() with prepared statement isn’t working
- How can I prevent SQL injection in PHP?
- SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
- SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax — PHP — PDO [duplicate]
- Call to a member function on null?
- How to create a foreign key in phpmyadmin
- ERROR: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it
- What is the advantage of using try {} catch {} versus if {} else {}
- Deprecated: mysql_query() [duplicate]
- If variable equals value php [duplicate]
- PHP date() format when inserting into datetime in MySQL
- MySQL – count total number of rows in php
- PHP Warning: mysqli_error(): Couldn’t fetch mysqli in
- Foreach only outputs if id is 0
- Simple SQL Query in wordpress
- Apache Redirect based on WordPress permissions
- Passed variable gets undefined variable error on insert on next page
- directorypress theme error mysql_error() [closed]
- How to set up an auto delete post?
- Saving custom term value to the database in new table
- #1115 – Unknown character set: ‘utf8mb4’
- Add value to array in database
- Stop my loop to register data twice
- WordPress upload images not displaying
- MySQL queries in WordPress
- SQL error on restoring database
- MySQL database gives blank page (white screen of death)
- two wordpress sites, two themes, one database, same content
- how to check for wordpress Query errors
- MySQL errors after a WordPress clone
- Datatabase error: Commands out of sync
- Insert double entry in DB
- `#1215 – Cannot add foreign key constraint
- How to Import Multiple Values in custom field
- How to restore: Database intact but folders deleted
- Second completely independent and disposable WordPress installation in subdirectory?
- Making CURDATE() recognize current_time()
- get_results suddenly not working on a single table
- How to connect database table to each registered wordpress user.
- retrieve wordpress post-meta using php not wordpress functions
- Splash pages on a high traffic site
- wp_postmeta – lot of meta fields
- Using the same shortcode to show any table from the database
- Splitting One Big WordPress Site into Multiple Small Sites
- optimise SQL wordpress call
- XML RPC post produces immediate revision with odd post_date_gmt
- MYSQL Join on meta key value?
- Let users register weight each day and save it in DB
- Get data from 3rd table
- why is $wpdb->update() causing a DB error from within wp_set_password()
- MySql Query for WordPress
- Internal error (500) on local & Fatal error on live when trying to access post type edit screen
- Query sql for truncate post_content in wp_posts table
- MySQL database migration to WordPress
- How should I troubleshoot a database serialization issue with a WordPress migration
- Woocommerce: Grab total revenue of a product over all orders
- Running WordPress from MySQL Cluster with HAPRoxy
- How WP decide to show or not to show in admin panel the pop-up window with hint? Need a fix
- Cannot Upload Custom Header Image into WordPress Dashboard
- Global MySQL replacing of text patterns/matches
- Custom query_posts() parameter
- MySQL update text field with ‘
- Delete posts with word count less than x number of words
- MySQL: get post_tag items that are tags (not SEO keywords)
- Complicated MySQL Query
- SQL – Pull products of particular category from a remote WordPress woocommerce db
- Efficiently loop over huge number of posts
- How to pass username into form that sends data to database
- How to edit the default database of WordPress [closed]
- Query Concatenation
- Using queries in and i see 7000+queries?
- how to search through plugin in wordpress cimy-user-extra-fields?
- problem with quotes on new post
- $wpdb->get_var returns 0
- cannot log in to the mysql server (wamp and wordpress)
- “Error 1064” when importing msql database after updating wordpress version to 4.2.1
- SQL command to export post_content from wp_posts using phpMyAdmin
- SQL Database Lost
- Predefine Magazine Style Layouts
- I am unable to fetch json data from wp_db
- WP_Query with LIKE returns strange query
- Submit cf7 form to cfdb as pdf/BLOB [closed]
- Parse error: syntax error, unexpected ‘}’ in C:\xampp\htdocs\admin\products.php on line 148 [closed]
- Your PHP installation appears to be missing the MySQL … After deleting and restarting from cpanel
- How to send push notification in android using php? [closed]
- PHP Creating a formula from mysql db values and db stored math operator
- Display total count of products in orders of a specific order status
- Why can’t I connect to imported WP DB on local MAMP?
- How to set variable to specific field when querying
- How to get a database field value from a WordPress table? [closed]
- Need SQL query to find&replace image URL
- Where other than wp-config can database access details be defined?
- Getting invalid user ID error when creating a new user with wp_insert_user