Install phpmyadmin for easy MySQL administration
I have been working with LAMP (Linux Apache, MySQL, PHP) servers for a long time. But not matter how much experience I have with them one of the first things I, do after the LAMP installation, is to install phpMyAdmin. This tool makes database administration so much easier than the command line. And when your job is rolling out sites that depend upon MySQL databases, you know how quickly MySQL can fubar a quick deployment.
In this article you will learn how to install and configure the phpMyAdmin MySQL tool.
The first step is to download phpMyAdmin. You can get this tool from the phpMyAdmin download page. Once you have this downloaded you will need to move the file into the document root of your web server (you will need to have root or sudo access to do this and the setup) Most likely this will be either /var/www/html or /var/www. Once you have this file in the proper locaton it is time to take care of business.
The first thing to do is to unpack the file. The unpacking command will depend upon what file format you download. Let's use the .gz file for an example. With the file phpMyAdmin-3.1.1-english.tar.gz in place issue the command:
tar xvzf phpMyAdmin-3.11-english.tar.gz
The resulting directory will be phpMyAdmin. I highly recommend changing the name of that directory to something easier to navigate and remember. I generally just change the directory with the command mv phpMyAdmin phpmyadmin.
Now that the directory is correct move into the directory. There is one file in particular you must have which is the config.inc.php file. You will notice there is a file called config.sample.inc.php. Some documentation instructs to change the name of config.sample.inc.php to config.inc.php and make your changes from within that file. It is my opinion that method can become confusing with all of the extra options included. Instead create the new config file with the following contents (depending upon your setup):
$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
* Servers configuration
$i = 0;
* First server
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'ROOT_PASSWORD';
$cfg['Servers'][$i]['verbose'] = '';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['AllowNoPasswordRoot'] = true;
$cfg['Servers'][$i]['nopassword'] = true;
There are a few pieces to note. First make sure you use the actual root mysql password where you see ROOT_PASSWORD. Also, if you want to prompted each time for your login information change 'config' to 'cookie' in the 'auth_type' line.
Once you have that configuration file in place you should be able to log into your phpmyadmin system. To do this you will enter http://ADDRESS_TO_SERVER/phpmyadmin/ in your browser (where ADDRESS_TO_SERVER is the IP Address or URL that points to the server.
If, for some reason, this configuration file does not work for you give the web-based setup script a try. To run this point your browser to http://ADDRESS_TO_SERVER/phpmyadmin/setup to start the graphical setup process.
After you are logged in it should be pretty obvious how to create a new database. You simple enter thename you want to give the database and click the Create button.
You're done! You now have a phpmyadmin install ready to serve you.Advertisement