I’m posting after really long time and in fact this is the first post after shifting my site to new Nginx based VPS. I was using apache earlier but apache was causing some database issues. Nginx is most popular with small server and WordPress so it was quit convincing to try Nginx before doing any upgrade in server. It’s been three days and my site is working perfectly fine with Nginx. So it seems there is no need to upgrade server near soon.
What I learnt during this whole process is that people should think twice before installing any extra plugins/packages if they have small VPS or shared hosting, because directly or indirectly it’s going to use your server resources. On my old server I have used DigitalOcean’s one click WordPress installation method, which comes with Ubuntu, apache, MySQL, PHP and WordPress. Being a beginner I have used tons of plugins and packages without having any second thought, but you shouldn’t make those mistakes. Install only necessary plugins and packages, it will keep your server fast and healthy. I followed these methods while configuring my new server and that’s why I searched options to import database without installing phpMyAdmin. I have found few commands and few plugins also but plugin didn’t worked for me and I was bit confused with SSH command option because there are too many commands for same job and I’m not that good at using linux commands. Finally I came to know about a small PHP tools a tiny PHP file actually, called Adminer. I’ve never heard about this so far but it worked like a charm for me.
So What Is Adminer ?
It is a tool to manage contents in MySQL database, formerly known as phpMinAdmin. Adminer is a single tiny PHP file(around 300KB in Size). It is light weight and perfect alternative to phpMyAdmin.
Read More details about Adminer on Wikipedia
Here I’m going to brief about Adminer like how to import, export and execute SQL command without phpMyAdmin.
1. Download Adminer PHP files from here.
2. Upload the PHP file in your root web directory (eg. www/html/…).
3. You can either zip & upload your SQL file to directory where you uploaded the Adminer.php or you can browse and upload directly from the Adminer page later. Remember by default Adminer taking file name “adminer.sql.bz2” so make sure you have compressed in right format and used right file name.
4. Open browser and access the Adminer PHP file in browser eg. techinfoBiT.com/adminer.php
5. Login with your credential and you will see a window somewhat phpMyAdmin home window.
6. Now you can do all important work like dump, import database, create new tables and run SQL commands.
7. If you don’t have backup SQL file and want to take it from old site Upload Adminer to old server and click on dump it will create the backup of you database
8. Now to import database click on import
9. If you have already uploaded the SQL file on server then click on run file or click on choose file to upload old SQL file and click on execute.
10. You can run SQL command according to your need by just clicking on SQL Command. You will have a text field to execute the SQL command.
There is also a WordPress plugin called Adminer but I’m recommending to use the Adminer PHP file. I’ve tried both and found that Adminer PHP file works more smoothly. For those who don’t have the FTP/SFTP access can use the plugin.
Note:- You can delete the Adminer if you are not going to access your database regularly or if you don’t want to reveal database access option.
I hope it will help someone like me who may be looking for the solution like this. Just leave a comment if you have any idea or suggestions to make this post better.