Ubuntu: 22.04
XAMPP: xampp-linux-x64-8.2.12-0-installer
laravel: 10.x
php artisan migrate
エラーが表示される
Illuminate\Database\QueryException
could not find driver (Connection: mysql, SQL: select table_name as `name`, (data_length + index_length) as `size`, table_comment as `comment`, engine as `engine`, table_collation as `collation` from information_schema.tables where table_schema = 'mysql' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name)
解決方法
sudo apt install php-mysql
php-mysqlをインストール後、php artisan migrateを実行する。
その後、次のエラーが表示された場合の解決方法
SQLSTATE[HY000] [2002] No such file or directory ..................
解決方法
/opt/lampp/etc/my.cnfファイルのsocketの設定値を確認する
socket =/opt/lampp/var/mysql/mysql.sock
シンボリックリンクを作成する
sudo ln -s /opt/lampp/var/mysql/mysql.sock /tmp/mysql.sock