Set up phpmyadmin on Ubuntu 22.04
Install phpmyadmin on Ubuntu 20.04 to make managing MySQL databases easier for yourself.
12/10/23: UPDATED for 22.04 LTS
So you want to set up phpmyadmin on your VPS? Let's get started!
Prerequisites:
- Webserver (Apache2/nginx/caddy)
- MySQL or MariaDB
- PHP (along with ctype, JSON, mbstring & zip extensions)
The process itself is pretty straightforward if You have all of the prerequisites already installed on your server. You can set up a LAMP stack quickly & easily using this one-liner:
For security reasons, You should run the mysql_secure_installation
to make sure your mariadb server root user has a password and remote access is disabled. Now that we've got the basics out of the way, What comes next is the star of the show i.e. phpmyadmin
Installation
To install phpmyadmin
You'll need to run the following command:
During installation, it'll ask some questions. You should answer them appropiately. e.g. It'll ask which webserver you'd want to configure: You should select apache2
and enter.
Next it'll ask about database configuration, Select Yes and press enter.
Next, it'll ask for an administrative password. Enter a secure password and hit okay.
In the following menu, it'll ask for an administrative password, this will be the password You'll need to enter twice. This password will be used for login to phpMyAdmin later.
Now, Once the setup process is complete, You'll be able to access phpMyAdmin on your server at Your_Server_IP/phpmyadmin
If You want SSL and have a domain name, You can set up the domain in the apache2 vhost and use letsencrypt certbot to set up SSL for phpmyadmin.
Once You've done that, You can start using phpmyadmin using root
as username and Password that you set up earlier.