Database is an essential part of any web based application for saving records and user data. Previously, I’ve written about how you can setup MySQL on debian based servers. MySQL is actually a part of LAMP/LEMP stack, both of which form an integral part of PHP applications. Hence, once you install MySQL on any web hosting for PHP, you can carry out your job using MySQL commands in terminal.
Developers can perform all the above mentioned tasks easily. They can easily find and run commands on the terminal to work with MySQL queries. But sometimes, there are non-tech people too who do not want to go in technical details to perform some simple database operations. This is where PHPMyAdmin comes into play as a handy tool for them to work with pre-defined MySQL queries. The platform gives you the ease to perform complex database operations in just a few clicks and write queries with debugging.
Let’s see how you can install PHPMyAdmin on debian based cloud servers. The process is quite easy followed by some commands. I’m assuming here that you have already installed MySQL on your hosting server.
Host Your PHP Apps With Us For 10x Faster Performance
Don’t Let Your Customers Run Away With The Downtimes. Deploy With Us Today!
Installing PHPMyAdmin on Debian
There are not only non-techie people who want a better GUI to handle complex database functions, but developers too need such a kind of platform to save their precious time. That’s why the best platform recommended for handling database jobs is PHPMyAdmin. It’s is an open source GUI which helps in managing MySQL database. Let’s first setup an SSL with Apache, so that our password isn’t sent in plain text form. Type the following command to install an SSL with Apache server.
apt-get install mcrypt
Now, restart your Apache server with the following command.
service apache2 restart
Now, install PHPMyAdmin by typing the following command.
apt-get install phpmyadmin
During the installation process, a prompt will open which will ask you about the web server you are using. Select Apache and press the Enter key. After that it will ask about the root user password. Enter the password and press Enter, once again.
PHPMyAdmin will be installed in /usr/share/phpmyadmin. We will create its symlink inside the public_html folder. Type the following commands to route to public_html folder and create a symlink:
cd /var/www/public_html ln -s /usr/share/phpmyadmin
Now type ‘ls’ to verify whether the symlink has been created or not. Once verified, open this in browser through [server ip address]/phpmyadmin where you’ll see that it is installed. Now, let’s secure it by creating a .htaccess file using vim file inside PHPMyAdmin folder and allow only your server IP to access it.
order allow,deny allow from <your server ip>
Now, you can easily use PHPMyAdmin and work with databases.
But, the next question is how this tool can be installed on Cloudways managed servers? To do that you need to follow some steps.
Install PHPMyAdmin on Cloudways
You can install PHPMyAdmin on the app you are using or can launch a new PHP stack application.
Once you have launched the PHP stack application, follow the following steps in order to install PHPMyAdmin.
Step 1: Launch SSH Terminal
Login to Cloudways Platform, launch SSH terminal and login using Master Credentials.
After successful login, head to the application folder where you want to download PHPMyAdmin by using the following command.
cd applications/<folder name>/public_html
Step 2: Downloading And Installing PHPMyAdmin
Now go to PHPMyAdmin website and copy the download URL of the latest version of PHPMyAdmin (zipped format)
Now go to SSH Terminal, type the following command and paste the download URL.
Press Enter and let the server download the file.
Once the file has been downloaded, run the following command to unzip it.
Wait for the command to finish its process.
Once done, run the following command to delete the zip.
Let’s rename the folder so that we can access it easily by running the following command.
mv phpMyAdmin-4.6.3-english phpmyadmin
Note: Go here to know more about useful SSH commands .
Now head to the application URL and add /phpmyadmin at the end of URL. You will see that PHPMyAdmin has been installed and you will see its login page.
Now login using the database credentials.
Once you have logged in with your database credentials, you can successfully access PHPMyAdmin page.
You have successfully installed PHPMyAdmin. You can use it to access all your applications’ databases on the server on which it is installed.
Launch PHP websites without the worry of Server Management.
Pre-Installed Optimized Stack with Git, Composer & SSH
Ahmed was a PHP community expert at Cloudways - A Managed PHP Hosting Cloud Platform. He is a software engineer with extensive knowledge in PHP and SEO. He loves watching Game of Thrones is his free time. Follow Ahmed on Twitter to stay updated with his works. You can email him at firstname.lastname@example.org