Warning: mysqli_connect(): (HY000/1049): Unknown database in mac terminal only
Is your PHP environment the same as your browsers PHP? command line php.ini can differ from, for example, your XAMP or other installed webserver
I would recommend checking this first
for me this did the trick
edit your .bash_profile file like
export PATH=/Applications/MAMP/bin/php/php7.1.1/bin:$PATH
edit the path to your PHP bin from your XAMP
Laravel SQLSTATE[HY000] [1049] Unknown database 'previous_db_name'
It clearly mentions that there's no such database named previous_db_name.
From what it seems the database.php file is not where the variable is from.
Check the .env file in your Laravel installation folder to see if that's the database name that you have wrongly specified.
php mysqli_connect: authentication method unknown to the client [caching_sha2_password]
As of PHP 7.4, this is no longer an issue. Support for caching_sha2
authentication method has been added to mysqlnd.
Currently, PHP mysqli extension do not support new caching_sha2 authentication feature.
You have to wait until they release an update.
Check related post from MySQL developers: https://mysqlserverteam.com/upgrading-to-mysql-8-0-default-authentication-plugin-considerations/
They didn't mention PDO, maybe you should try to connect with PDO.
PHP Warning: mysqli_connect(): (HY000/2002): Connection refused
In case anyone else comes by this issue, the default port on MAMP for mysql is 8889
, but the port that php expects to use for mysql is 3306
. So you need to open MAMP, go to preferences, and change the MAMP mysql port to 3306
, then restart the mysql server. Now the connection should be successful with host=localhost, user=root, pass=root.
Related Topics
Tell Composer to Use Different PHP Version
How to Run a PHP Script in the Background After a Form Is Submitted
How to Use Two Foreach to Insert Data in Database
How to Store Values from Foreach Loop into an Array
Patch and Put Request Does Not Working With Form-Data
Laravel 5.5 Http Error 500 Unable to Handle This Request
Encoding CSV File With Arabic Content
How to Sort a Multi-Dimensional Array by Value
How to Parameterize the Table Name in a Prepared Statement
How to Get Username from Facebook Id
Convert Svg Image to Png With PHP
Check If Class Property Is Not Null Before Calling Any Public Class Method
How to Pass an Array Within a Query String
Codeigniter Session Is Not Working on PHP 7
Display Text(Html) Saved in Database Using Ckeditor