phpMyAdmin setup on Raspberry PiΒΆ
phpMyAdmin is a free and open-source tool written in PHP that allows you to manage MySQL and MariaDB databases through a web interface. It provides an easy-to-use graphical interface for performing database operations such as creating, editing, and deleting databases, tables, and records.
In this guide, we will show you how to set up phpMyAdmin on your Raspberry Pi. This will allow you to manage your MySQL and MariaDB databases through a web browser.
PrerequisitesΒΆ
Before you begin, you will need the following:
- A Raspberry Pi with Raspbian installed
- Access to the terminal on your Raspberry Pi
- MySQL or MariaDB installed on your Raspberry Pi
If you have not already installed MySQL or MariaDB, you can follow our guides on how to install MySQL on your Raspberry Pi or how to install MariaDB on your Raspberry Pi.
InstallationΒΆ
Step 1: Install phpMyAdminΒΆ
The first step is to install phpMyAdmin on your Raspberry Pi. You can do this by running the following command:
1 |
|
During the installation process, you will be prompted to select the web server that you are using. If you are using Apache, select apache2
by pressing the Space
key, then press Tab
to select OK
and press Enter
to continue.
You will also be prompted to configure the database for phpMyAdmin. Select Yes
and enter the root password for your MySQL or MariaDB server when prompted.
Step 2: Configure phpMyAdminΒΆ
After installing phpMyAdmin, you will need to configure it to work with your web server. You can do this by running the following command:
1 |
|
During the configuration process, you will be prompted to select the web server that you are using. If you are using Apache, select apache2
by pressing the Space
key, then press Tab
to select OK
and press Enter
to continue.
You will also be prompted to configure the database for phpMyAdmin. Select Yes
and enter the root password for your MySQL or MariaDB server when prompted.
Step 3: Access phpMyAdminΒΆ
Once you have installed and configured phpMyAdmin, you can access it through a web browser. Open a web browser on your computer and enter the IP address of your Raspberry Pi followed by /phpmyadmin
in the address bar.
For example, if the IP address of your Raspberry Pi is 145.92.8.132/phpmyadmin
, you would enter http://145.92.8.132/phpmyadmin
in the address bar.
You will be prompted to enter the username and password for your MySQL or MariaDB server. Enter root
as the username and the root password that you set during the installation process.
You should now see the phpMyAdmin login page, where you can log in and start managing your databases. If not, you may need to restart the Apache web server by running the following command:
1 |
|
Check phpMyAdmin Configuration: Ensure that phpMyAdmin is correctly configured in Apache2. There should be a phpMyAdmin configuration file in the /etc/apache2/conf-enabled/ directory named phpmyadmin.conf. If it's not there, you can create a symbolic link to it with:
1 |
|
Step 4: Log in to phpMyAdminΒΆ
Once you have restarted the Apache web server, you can log in to phpMyAdmin using the username root
and the root password that you set during the installation process.
You should now see the phpMyAdmin dashboard, where you can manage your MySQL or MariaDB databases through a web interface.
If not you may need to change the port number in the phpMyAdmin configuration file. You can do this by editing the config.inc.php
file located in the /etc/phpmyadmin
directory:
1 |
|
Find the line that starts with $cfg['Servers'][$i]['host']
and add the port number after the host name. For example, if your MySQL or MariaDB server is running on port 3306
, the line should look like this:
1 |
|
Save the file and restart the Apache web server by running the following command:
1 |
|
You should now be able to log in to phpMyAdmin using the username root
and the root password that you set during the installation process.
ConclusionΒΆ
You have successfully set up phpMyAdmin on your Raspberry Pi. You can now use phpMyAdmin to manage your MySQL or MariaDB databases through a web interface. If you have any questions or run into any issues, feel free to refer to the phpMyAdmin documentation for more information.