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
- Fatal error: Call to undefined function mysql_connect()
- mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in
- Not unique table/alias
- Install mysql-python (Windows)
- Select from multiple tables without a join?
- SQL Query Where Field DOES NOT Contain $x
- Mysql command not found in OS X 10.7
- Fatal error: Call to a member function bind_param() on boolean [duplicate]
- MySQL – UPDATE query based on SELECT Query
- Access denied; you need (at least one of) the SUPER privilege(s) for this operation
- PHP with MySQL 8.0+ error: The server requested authentication method unknown to the client
- How do I change the data type for a column in MySQL?
- Cannot connect to Database server (mysql workbench)
- mysqld: Can’t change dir to data. Server doesn’t start
- Can you do a For Each Row loop using MySQL?
- How to properly create composite primary keys – MYSQL
- Data is not constantly loading from custom wordpress table
- How to cache/speed WordPress queries for logged in users?
- $wpdb->delete column values IN ARRAY()?
- How to disable `SQL_CALC_FOUND_ROWS` [duplicate]
- “#1067 – Invalid default value for ‘post_date'” when trying to reset AI after backup
- Custom SQL query to get List of posts with featured image url
- Delete post revisions on post publish
- Problems migrating WordPress to localhost
- error importing localhost export file to server
- WordPress Deadlock Error
- How to do a MySQL dump from production site without using a search and replace script for local development?
- How to bulk edit canonical url’s in SQL?
- Concurrent / simultaneous MySQL connections
- How to check for empty and not a failure
- How many ‘wp_insert_post’ calls can be performed in one shot, in a very long ‘for’ loop?
- Best settings for MySQL to speed up site? [closed]
- How to write one comment and publish on every post using database or plugin?
- Can’t find my wordpress DB in phpmyadmin
- Deprecated: mysql_connect():
- How to simultaneously access the same MySQL database in the main column and sidebar of WordPress?
- WordPress php mysql errors – errcode: 13 permission denied
- get_posts() and WP_query limits ‘AND’ conditions to a maximum of 6 for meta value queries in WordPress
- $wpdb select all meta for each post
- Calculate average crossing post categories
- Replacing link URL ending strings via MySQL
- SQL command to convert all tags in lowercase?
- Problem with admin login after deployment
- Is it possible to create a WordPress table using array and loop?
- How to stop $wpdb from prepending database name
- Error missing MySQL extension
- How can I add a new row in a separate database when someone registers via WordPress?
- How to use mysql LIKE with wpdb?
- Best approach for a custom database filling in WP custom post types
- speed up pagination for huge database
- How to use AJAX in WordPress in MYSQL query?
- Processing ajax call to php to insert into mysql database
- WordPress Custom Query: Combining Two Functions
- SQL statement using placeholder is not returning results
- Passing in MySQL prepare statement parameter separately throwing error
- How to optimize and reduce excessive database queries
- Store GA Client ID in User DB
- update multiple rows in mysqli table base on two values
- PHP 7.2.18 | Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- Need help with format of nested array in MySQL
- How can I verify WordPress nonce from the following code?
- How to write in MySQL more characters in user_nicename
- Inserting other fields to existing registration form in a WordPress theme
- Splitting table data to pages with numbers
- Site doesnt work once PHP changed to 7.1
- WordPress WPDB::insert 13th param is always blank (only if format)
- Ajax not updating to database
- can’t delete a row from post_meta table
- MySQL query in WordPress with AJAX
- What is the cron doing?
- SQL error on restoring database
- MySQL database gives blank page (white screen of death)
- retrieve wordpress post-meta using php not wordpress functions
- why is $wpdb->update() causing a DB error from within wp_set_password()
- Global MySQL replacing of text patterns/matches
- remove wordpress post links
- SQL get last entry of a specific gravity form
- mysqldump to a tar.gz
- running an existing WordPress site from Visual Studio Code?