I have uploaded my Laravel 5.5 project to the centOS7 server. Now I am facing the following error when I am running "php artisan migrate" for the first time to load database table.
Here is my .env db section
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=event
DB_USERNAME=root
DB_PASSWORD=testpass
I have created the DB in the MySQL.
[root@li129-226 event_management]# php artisan migrate
In Connection.php line 664:
SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = event and table_name = migrations)
In Connector.php line 67:
SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client
In Connector.php line 67:
PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]
What I did that worked really well was to just alter the root user to have a password. Log in to mysql on the terminal then do this command:
ALTER USER 'user'@'address' IDENTIFIED WITH mysql_native_password BY 'yourpassword'
for the user, I used 'root'@'localhost'
You may want to use a different user.
Then, replace DB_PASSWORD=yourpassword
with the password you chose in the command above and save the file.
That allowed me to run php artisan migrate
and everything worked great!