Run phpMyAdmin with php local dev server
sudo pacman -S php mariadb phpmyadmin
Maria Db part
- initialize the db (source):
sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
- start the mariadb service:
sudo systemctl start mariadb.service
- login to your db with your pc root credentials:
sudo mariadb -u root -p;
- create a new local database:
CREATE DATABASE someDbName;
- create a new regular user with password:
CREATE USER 'xyz'@'localhost' IDENTIFIED BY 'xyz123';
- grant new user access to db with same password:
GRANT ALL ON someDbName.* TO 'xyz'@'localhost' IDENTIFIED BY 'xyz123';
- 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
- go to phpmyadmin root installation dir, default is:
cd /usr/share/webapps/phpMyAdmin
- run php local webserver with a port of your choice:
php -S localhost:8001
- 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!