I’m posting after a 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 quite convincing to try Nginx before doing an upgrade on the 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 learned 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 the 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 the available plugins weren’t working for me and I was a bit confused with SSH command option because there are too many commands for the same job and I’m not that good at using Linux commands.
Finally, I came to know about a small PHP tool a tiny PHP file actually, called Adminer. I had never used the Adminer till then so thought to give it a try and I am glad that it worked like a charm, I was able to do almost all the jobs that I was doing on the phpMyAdmin.
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 a lightweight and perfect alternative to phpMyAdmin.
Here I’m going to brief about Adminer like how to import, export and execute SQL command without phpMyAdmin.
- Download Adminer PHP files from here.
- Upload the PHP file in your root web directory (eg. www/html/…).
- 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 will take the file name “adminer.sql.bz2” so make sure you have compressed in the right format and used the right file name.
- Open a browser and access the Adminer PHP file in browser eg. techinfobit.com/adminer.php
- Login with your credentials, you will see a window somewhat like phpMyAdmin home window.
- Now you can do all important work like export, import database, create new tables and run SQL commands.
- If you don’t have a backup SQL file and want to take it from old site upload Adminer to the old server and click on export it will create the backup of your database
- Now to import a database click on import
- If you have already uploaded the SQL file on the server then click on run file or click on choose file to upload old SQL file and click on execute.
- 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 similar solutions. Just leave a comment if you have any idea or suggestions to make this post better or if you have any query.