Moving Beyond SSH: phpMyAdmin and SFTP

Published on Mar 12, 2009   //  Development
Off

Moving Beyond SSH

This week we’ll be going over installing phpMyAdmin and talking about SFTP. We’ll also go through in a few tips on migrating your sites to your new server.

phpMyAdmin

phpMyAdmin is a PHP application that provides a web-based interface to managing MySQL databases. It allows you to add, edit, manage and view your databases and tables. It’s the industry standard for MySQL web interfaces. Installing phpMyAdmin is fairly simple, and configuration is done via a web interface.

Start out by downloading phpMyAdmin to your server and untarring it to a web accessible part of your server (rename the folder to “phpmyadmin”). Since phpMyAdmin is just a PHP application, it needs to be somewhere within your web server directory, just as any other PHP app would. Now, we need to prepare it for the configuration:

cd phpmyadmin
mkdir config
chmod o+rw config

Now, visit /phpmyadmin/setup in your browser, prepending the domain or IP address the files are accessible via. Click the New server button. Change Authentication type to http. Click the Save button. Back in SSH:

mv config/config.inc.php .
chmod o-rw config.inc.php

You can now visit /phpmyadmin/ and login with your root MySQL account. You’re now able to manage MySQL stuff in an easy-to-use web interface.

SFTP

If you’re wondering how to transfer files onto your server without an FTP server installed, you can use SFTP. SFTP (Secure File Transfer Protocol) is basically FTP over SSH. It allows us to transfer files via our SSH server. Almost all FTP clients also support SFTP. Connecting is fairly simple, provide your IP address, SSH port, username and password to your FTP client and choose “SFTP” (or similar) under the connection type (this will obviously vary from client to client). Voila, you can now (securely) transfer files to and from your server.

Migrating

Migrating your sites to your new server is pretty simple. First of all make you’ve setup the DNS and VHost configuration for the domains you’re transferring. If you need to migrate your MySQL databases, export your databases via phpMyAdmin from your old host, then import them through phpMyAdmin on your server (create the user and database on your server first).

For transferring your files, you could download your files from your old server via FTP, them upload them to your new server via SFTP. However, what might be faster, if your old host allows you to download all your files in a .zip or .tar archive, you could then upload the archive to your server, then use your SSH savviness to unpack the files and move them to the appropriate folders. This way will definitely be quicker (it’ll involve less download/upload time from your computer).

What’s coming up next

We’ve already gotten a couple of suggestions for future articles, but we can always use more. If there’s anything you’d like to install or do with your server, post them in the comments and we’ll consider writing an article on it.