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
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- MySQL Error “Operand should contain 1 column”
- How to use MySQL DECIMAL?
- MySQL ERROR 1290 (HY000) –secure-file-priv option
- MySQL server startup error ‘The server quit without updating PID file’
- Invalid column count in CSV input on line 1 Error
- MySQL ERROR 1045 (28000): Access denied for user ‘bill’@’localhost’ (using password: YES)
- How do I quickly rename a MySQL database (change schema name)?
- What does SQL Select symbol || mean?
- Setting up foreign keys in phpMyAdmin?
- phpMyAdmin: secret passphrase?
- MySQL error code: 1175 during UPDATE in MySQL Workbench
- Access denied; you need (at least one of) the SUPER privilege(s) for this operation
- PDO closing connection
- How to find MySQL process list and to kill those processes?
- MySQL Server on MAMP-Windows Will Not Start
- SQL statement not working – “Operand type clash: date is incompatible with int’
- How can I output MySQL query results in CSV format?
- importing a CSV into phpmyadmin
- How can I rebuild indexes and update stats in MySQL innoDB?
- select * from table where column = something or, when unavailable, column = something else
- Differences between utf8 and latin1
- There can be only one auto column
- What’s a good strategy for planning WordPress DB growth?
- How to get the list of WooCommerce product image of a certain category from database?
- WordPress will not operate correctly
- tag search using WP_Query
- Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- Error: MySQL shutdown unexpectedly. XAMPP local conf running WordPress
- How can I SQL update a meta_value to remove the dollar signs that were entered with the value? (so just the value remains)
- if statement on database query
- Is the regular ajax request method safe or I should use admin-ajax.php?
- How can I make wordpress suppress mysql errors?
- Styling images coming from another blog
- How to convert objects into arrays
- Ajax $wpdb not returning table data
- Set meta_key and meta_value for all registered user in wordpress using sql query [closed]
- Can’t get wp_insert_post to work
- Connect another DB and fetch records from some tables
- mysql query from wordpress page using custom table
- PHP Fatal error: Uncaught mysqli_sql_exception: Table doesn’t exist in wordpress/wp-includes/wp-db.php
- How to check if a meta value has already been assigned to any user?
- Error: MySQL shutdown unexpectedly [closed]
- Not connecting to database in file with multiple MySQL connections
- Way to bulk make all my tags lowercase?
- $Wpdb post meta query is not working with mutliple meta keys and values? [closed]
- Defining the same price to all WooCommerce Products
- pagination on data fetched using SQL query
- Database Structure on Different Servers
- Using ‘mysqli_connect’ ‘crashes’ WordPress client-side
- email alert for product availability
- How to set MYSQLI_OPT_INT_AND_FLOAT_NATIVE option
- How do I prepare strings for insertions as values into a MySQL table?
- How to insert dash (-) into database using wpdb and new_to_publish hook?
- MySQL: How to change url in posts from xxx.com to yyy.org?
- How to fetch all meta_key and meta_value using post_id wihout duplication of post meta using sql query
- Upgrade DB Loop – WordPress DB Version Conflict
- WordPress & MySQL , problem with use many array in meta_query
- WordPress low speed after migrating to new host
- Button writing to MYSQL database
- MySQL ‘duplicate entry’ error
- WP Function does not trigger on Webhook API Call
- How to edit content in WordPress and the Polylang – plugin? – with demosite
- WordPress Dutch characters encoding problem
- How to show result of sql query in a page?
- Select latest 2 articles, but only from given category
- CONCAT_WS in custom sql query
- Ordering topics by most replies in X days using MYSQL statement
- Conditional statement within WP SQL query
- WordPress upload images not displaying
- MySQL database migration to WordPress
- Running WordPress from MySQL Cluster with HAPRoxy
- Custom query_posts() parameter
- Query Concatenation
- SQL command to export post_content from wp_posts using phpMyAdmin
- Display total count of products in orders of a specific order status
- mysqldump to a tar.gz
- Where is my mysql log on OS X?
- running an existing WordPress site from Visual Studio Code?