installing mysql, php8 on debian 11 amd64

php

sudo dpkg -l | grep php | tee packages.txt

sudo apt install apt-transport-https lsb-release ca-certificates wget -y
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg 
sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
sudo apt update

# Expand the curly braces with all extensions necessary.
sudo apt install php8.2 php8.2-cli php8.2-{bz2,curl,mbstring,intl}

sudo apt install php8.2-fpm
# OR
# sudo apt install libapache2-mod-php8.2

sudo a2enconf php8.2-fpm

# When upgrading from older PHP version:
sudo a2disconf php8.1-fpm

## Remove old packages
sudo apt purge php8.1*

more

 mysql

sudo apt-get install default-mysql-server

  • create a new user so you don't need to sudo + laravel can use
CREATE USER 'avi'@'localhost' IDENTIFIED BY 'avi123';

GRANT ALL PRIVILEGES ON *.* TO 'avi'@'localhost' WITH GRANT OPTION;

FLUSH PRIVILEGES;
  • to grant all priviliges from anywhere...

GRANT ALL PRIVILEGES ON *.* TO 'avi'@'%' IDENTIFIED BY 'avi123' WITH GRANT OPTION;