Linux

Run phpMyAdmin with php local dev server

sudo pacman -S php mariadb phpmyadmin

Maria Db part

  1. initialize the db (source):
    sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
  2. start the mariadb service:
    sudo systemctl start mariadb.service
  3. login to your db with your pc root credentials:
    sudo mariadb -u root -p;
  4. create a new local database:
    CREATE DATABASE someDbName;
  5. create a new regular user with password:
    
    CREATE USER 'xyz'@'localhost' IDENTIFIED BY 'xyz123';
  6. grant new user access to db with same password:
    GRANT ALL ON someDbName.* TO 'xyz'@'localhost' IDENTIFIED BY 'xyz123';
  7. exit mariadb administration:
    exit;

Other useful db commands

verify granted access:

SHOW GRANTS FOR 'xyz'@'localhost';

show user privileges:

SHOW GRANTS FOR 'xyz'@'localhost';

remove access from db:

REVOKE ALL PRIVILEGES ON someDbName.* FROM 'xyz'@'localhost';

delete user:

DROP USER 'xyz'@'localhost';

show all available DBs:

show databases;

PhpMyAdmin part

  1. go to phpmyadmin root installation dir, default is:
    cd /usr/share/webapps/phpMyAdmin
  2. run php local webserver with a port of your choice:
    php -S localhost:8001
  3. login with new db user credentials:
  • usr: xyz (=> without @locahlost!)
  • pwd: xyz123

Your webapp

Go to your webapp root dir and run another php local webserver with a different port than phpmyadmin, eg:

php -S localhost:8000

There you go!