Search code examples
xamppubuntu-18.04php-7.4

xampp installed in ubuntu but php and mysql shows not found


I have installed XAMPP version 7.4 in UBUNTU OS,

now when I go to the terminal and type php -v command,

it shows

root@roy:/opt/lampp/htdocs/magento242# php -v

Command 'php' not found, but can be installed with:

apt install php7.4-cli

also when i type mysql -u root -p it shows like below,

root@roy:/opt/lampp/htdocs/magento242# sudo mysql -u root -p
sudo: mysql: command not found
root@roy:/opt/lampp/htdocs/magento242# mysql -u root -p

Command 'mysql' not found, but can be installed with:

apt install mysql-client-core-8.0     # version 8.0.23-0ubuntu0.20.04.1, or
apt install mariadb-client-core-10.3  # version 1:10.3.25-0ubuntu0.20.04.1

I don't understand that what is the problem exactly.

but when I run localhost/phpmyadmin then phpmyadmin is open. so what is the problem with that?

please provide me some suggestions on that, thanks.


Solution

  • You need to start Lampp first then mysql. Follow these steps:

    1. Open up terminal using CTRL+ALT+T

    2. type

    sudo /opt/lampp/lampp start

    3.Switch to the XAMPP installation directory. Type in

    cd /opt/lampp

    4.Then you just need to type this command in order to run lampp properly

    sudo ./manager-linux-x64.run
    

    if you need to use mysql in terminal do the next step

    5.cd /opt/lampp/bin

    ./mysql -u root