w3resource

phpmyadmin tutorial

phpmyadmin tutorial

phpmyadmin is a free browser-based tool for MySQL administration. phpmyadmin is written is PHP. In this page, we are going to discuss -

1. How to install and configure phpmyadmin.

2. How to create a database using phpmyadmin.

3. How to create a table using phpmyadmin.

4. How to run queries using phpmyadmin.

How to install and configure phpmyadmin

Download the phpmyadmin from http://www.phpmyadmin.net/home_page/downloads.php.

Unzip the zip file to store all files into htdocs directory of your Apache server.

Open your favorite browser and in the address bar type "http://localhost/phpmyadmin/index.php".

If PHP is installed correctly, you should see the phpMyAdmin login page with an error.

Open config.inc.php file located within phpmyadmin folder in a text editor.

Find the following lines and if necessary change them to look like these :

$cfg['Servers'][$i]['verbose'] = 'localhost';
$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]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'your_password'; //replace it with your own password.

Save the config.inc.php file.

On Windows systems (i)copy libmcrypt.dll from c:\php directory to c:\windows\system32 directory. (ii) you may also need to add "extension=php_mcrypt.dll" into php.ini and/or add c:\php and maybe c:\php\ext into the Windows search path (Control panel -> System -> Environment variables -> path) and reboot Windows.

Reload the page "http://localhost/phpmyadmin/index.php". You should see either the login page or see the first screen of the phpmyadmin.

How to create a database using phpmyadmin

create-datatbase-phpmyadmin

Provide the name of the database and click on Create.

How to create a table using phpmyadmin

Click on the database within which you want to create a new table. Now provide the name and number of fields in the fields marked bellow and click on the Go.

create-table-phpmyadmin

The following image shows how you can enter the name of the fields, their size, type, and other attributes.

create-table-phpmyadmin2

After you finish defining fields, click on the Save button.

How to run queries using phpmyadmin

run-queries-phpmyadmin

Click on the SQL button to open query browser from where you can run queries. Remember that you have to select a database before you run any query on tables of that database.

run queries phpmyadmin 2

After you write your query in the box, click on Go button to accomplish the task.

Previous: MySQL Workbench
Next: MySQL Connector and APIs Introduction



Follow us on Facebook and Twitter for latest update.