Computer Programming web Web programming Tips



How to use phpMyAdmin: Part 1

By Sergey Skudaev


In this tutorial you will learn how to use phpMyAdmin to manage MySQL database. How to create database, tables, how to alter table, add fields, insert records, backup table and backup database.

phpMyAdmin is an open source php script. Download phpMyAdmin from www.phpmyadmin.net and unzip it in "htdocs" directory.

On my PC it is C:\Apache24\htdocs. Start your browser and type in the Address:

http://localhost/phpMyAdmin/.

phpMyAdmin home page displays. Hover mouse over a thumbnail to see a large image.

phpMyAdmin home page


I got error message, because I forgot to uncomment ´#extension=php_mysqli.dll´ in the php.ini file, which is located in the C:\php\bin directory.

Then I got another error message. The whole text in the message is:
phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in config.inc.php and make sure that they correspond to the information given by the administrator of the MySQL server.

phpMyAdmin home page

Above, you can see the correct configuration of the config.inc.php file, which is located in the phpMyAdmin directory.

If you entered a string '5f4dcc3b5aa765d61d8327deb882cf99' for $cfg['blowfish_secret'], then you have to use this string in your URL to phpMyAdmin:

http://localhost/phpMyAdmin/index.php?Token=5f4dcc3b5aa765d61d8327deb882cf99

By default, I had a root user without password. To protect my database I set root password to Aspirin9@27. Since it is not good practice to use root user in php code, let us created a new user.

Read MySQL SHELL to learn how to create users and set passwords to MySQL.

MySQL Community Server Shell

Login in MySQL as root user.

C:\mysql\bin>mysql -u root -pAspirin9@17
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 3.23.58-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

Create a new user

mysql> GRANT ALL PRIVILEGES ON *.* TO 'sergeys'@'localhost' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.25 sec)

mysql>

Now type user name and password in the config.inc.php file.

$cfg['Servers'][$i]['user']='sergeys'; // MySQL user
$cfg['Servers'][$i]['password']='password';// MySQL password (only needed)

Save file. Refresh browser page. phpMyAdmin home page displays:

phpMyAdmin home page

Enter your user and pasword and click the Go button. The phpMyAdmin interface is opened.

phpMyAdmin home page

Select your database and database tables (if any) wiil be displayed.

>>Part 2>>


My eBooks on Amazon.com

US    UK    BR    CA
US   UK   BR   CA
US    UK    BR    CA