Login to phpmyadmin without password. Installing phpMyAdmin for dummies. Updating an old version

Sooner or later, any website owner is faced with working directly with a database. For these purposes, phpmyadmin was developed, which in most cases is already installed and configured on your hosting. But often the webmaster is required to change the root password for phpmyadmin. Like simple task, but for some reason this problem causes considerable difficulties for most people. Personally, this was the case for me.

I had this need after reinstalling the operating system on a VPS server from Majordomo, after which I simply could not log into phpmyadmin with the default password. I had to urgently change it.

The password itself to access phpmyadmin matches the password root to the MySQL server that you specified during installation. If you forgot this password for some reason, you can recover it quite simply. The password recovery method is described in the article:

There is one more small nuance that should be considered when you use phpmyadmin - this is the way to authorize this add-on.

Only one phpmyadmin configuration file is responsible for all this - config.inc.php, which in operating system FreeBSD is located in the directory /usr/local/www/phpMyAdmin. The contents of my file, which is the combat file, are:

Now let's look at where, what and how...

  • blowfish_secret is an arbitrary phrase that is needed to encrypt passwords in cookies. It is safer to change it to any other one, just not the standard one.
  • auth_type– this is an authorization type that can take 2 values: config And cookie:
    • config– indicates that the login/password will be taken from this file (the next two lines user And password). With this mode, a successful login will always happen when you or someone else simply goes to your domain, where phpmyadmin is also located and may have the opportunity to do all sorts of dirty tricks there.
    • cookie– indicates that the login/password will be asked every time someone goes to the address where phpmyadmin is located. The correct password will be stored encrypted in cookies on your computer.
  • user And password– this is the username (in our case it should be root) and password. In this configuration file they are added just for example and for use cookie they can be removed altogether.
  • AllowNoPassword– can take values true(true) and false(lie). Actually, login without a password is allowed (true) or not (false)
  • extension– can take on a meaning mysql And mysqli. The first must be specified if you are using phpmyadmin in MySQL bundles below 4.1.3. The second one is if you are using a MySQL version higher than 4.1.3.

Of course, there are more of these parameters; here are only the most basic ones that are necessary for the normal operation of phpmyadmin.

Click on the title to open/close detailed description process

We will need to create a new database - click on the tab "Database". In the subsection text field "Create Database" enter phpmyadmin, press the button "Create".

Let's create a new user - click on the tab "Users".

On this moment We have created a single user with the name root. Click on the link "Add user",

in the pop-up window that opens, in the section "Information account" to text field "Username:" enter "pma". To text field "Host:" enter "localhost". In field "Password:" enter the password (any one that comes to your mind). In field "Confirmation:" Confirm the password entered above.

Scroll the window to the section "Global Privileges", click on the link "Select all".

Click on the button "Add user".

A new user named pma will be created.

Now, you need to import data into the created database. In the left column select phpmyadmin(click on it with the mouse).

In the top menu, click on the tab Import.

In the subsection Imported file: Click the review button.

In the context menu that opens, select the file create_tables.sql which is in the folder examples, located inside the phpMyAdmin root directory (in my case the full path looks like this: c:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\phpmyadmin\examples\create_tables.sql).

At the very bottom of the page we find and press the button Ok. The database has been imported.

Let's make changes to the configuration file.

Open the file in notepad config.inc.php. Looking for a string $cfg["Servers"][$i]["controlhost"] = "";, uncomment it (remove the double slash), enter it in quotes localhost(the line will look like $cfg["Servers"][$i]["controlhost"] = "localhost";).

Find and uncomment the line $cfg["Servers"][$i]["controlpass"] = "pmapass";, in quotes, change the password to the one that was assigned when creating the user pma.

Find and uncomment the following lines:

$cfg["Servers"][$i]["controluser"] = "pma";

$cfg["Servers"][$i]["pmadb"] = "phpmyadmin";

$cfg["Servers"][$i]["bookmarktable"] = "pma_bookmark";

$cfg["Servers"][$i]["relation"] = "pma_relation";

$cfg["Servers"][$i]["table_info"] = "pma_table_info";

$cfg["Servers"][$i]["table_coords"] = "pma_table_coords";

$cfg["Servers"][$i]["pdf_pages"] = "pma_pdf_pages";

$cfg["Servers"][$i]["column_info"] = "pma_column_info";

$cfg["Servers"][$i]["history"] = "pma_history";

$cfg["Servers"][$i]["tracking"] = "pma_tracking";

$cfg["Servers"][$i]["designer_coords"] = "pma_designer_coords";

$cfg["Servers"][$i]["userconfig"] = "pma_userconfig";

$cfg["Servers"][$i]["recent"] = "pma_recent";

$cfg["Servers"][$i]["table_uiprefs"] = "pma_table_uiprefs";

We save the changes to the file, exit and enter again phpMyAdmin. The warning has disappeared.

As an alternative (if you really don’t want to dig into the code) - replace the entire contents of the file config.inc.php to the code below

< $cfg["blowfish_secret"] = "a8b7c6d"; $i = 0; $i++; $cfg["Servers"][$i]["auth_type"] = "cookie"; $cfg["Servers"][$i]["host"] = "localhost"; $cfg["Servers"][$i]["connect_type"] = "tcp"; $cfg["Servers"][$i]["compress"] = false; $cfg["Servers"][$i]["extension"] = "mysqli"; $cfg["Servers"][$i]["AllowNoPassword"] = false; $cfg["Servers"][$i]["controlhost"] = "localhost"; $cfg["Servers"][$i]["controluser"] = "pma"; $cfg["Servers"][$i]["controlpass"] = "пароль для пользователя pma"; $cfg["Servers"][$i]["pmadb"] = "phpmyadmin"; $cfg["Servers"][$i]["bookmarktable"] = "pma_bookmark"; $cfg["Servers"][$i]["relation"] = "pma_relation"; $cfg["Servers"][$i]["table_info"] = "pma_table_info"; $cfg["Servers"][$i]["table_coords"] = "pma_table_coords"; $cfg["Servers"][$i]["pdf_pages"] = "pma_pdf_pages"; $cfg["Servers"][$i]["column_info"] = "pma_column_info"; $cfg["Servers"][$i]["history"] = "pma_history"; $cfg["Servers"][$i]["table_uiprefs"] = "pma_table_uiprefs"; $cfg["Servers"][$i]["tracking"] = "pma_tracking"; $cfg["Servers"][$i]["designer_coords"] = "pma_designer_coords"; $cfg["Servers"][$i]["userconfig"] = "pma_userconfig"; $cfg["Servers"][$i]["recent"] = "pma_recent"; $cfg["UploadDir"] = ""; $cfg["SaveDir"] = ""; ?>

Don't forget to write in the line $cfg["Servers"][$i]["controlpass"] = "password for user pma"; in quotes the password that was set for the user pma and in the line $cfg["blowfish_secret"] = "a8b7c6d"; increase the inscription in quotation marks to at least 10 characters


1. Before you begin installation, make sure you have the following information, which you can obtain from your hosting provider:

  • Name of the host (server) hosting MySQL
  • MySQL port number
  • Login
  • Password
Also, it will be useful to receive confirmation from the hoster about the possibility of installing phpMyAdmin; in addition, he can point out possible pitfalls when installing phpMyAdmin on a specific hosting site.

2. If you have not yet downloaded the distribution, you can do so on the "Download phpMyAdmin" page

3. After the distribution has been downloaded to your local computer, it’s time create a directory for phpMyAdmin, where the distribution will be downloaded. You can give any name, we will call it `pma` (http://www.yourdomain.ru/pma/), check that the permissions for this directory are 755.

Those who are concerned about traffic, as well as the occupied disk space on the server, can clean out the `lang` directory, which takes up the lion's share of the total volume of the distribution: in version 2.8.1 - more than 8 megabytes, which is about 70% of the "weight" of the unpacked distribution.

Clean the directory carefully, otherwise you may end up without a native translation. For Russian-speaking users, the following files are most important: russian-koi8-r.inc.php, russian-utf-8.inc.php, russian-windows-1251.inc.php, besides them, I would recommend leaving the native language ones for phpMyAdmin files: english-iso-8859-1.inc.php, english-iso-8859-15.inc.php, english-utf-8.inc.php. As a result of such manipulations, the size of the `lang` directory remains less than 500 KB.

4. “Upload” the unpacked distribution kit to the remote server- into the `pma` directory we created earlier.

5. Now everything is ready for the final phase of installation - creating a configuration file (config.inc.php), which is used by phpMyAdmin to work with databases, and, above all, to connect to the MySQL server. You can create a config in two ways: using an installation script or manually. Let's consider both methods.
Generating a phpMyAdmin configuration file using a script. This method became available quite recently - starting with version 2.8.0. Its essence is to set the parameters necessary for phpMyAdmin to work through the web interface and then save the configuration file to the server.

A) create the `config` directory: http://www.yourdomain.ru/pma/config

B) make the `config` directory writable to allow the script to subsequently write the configuration file we created there. Set permissions to 777

C) run the installation script: http://www.yourdomain.ru/pma/scripts/setup.php

D) Select the very first block `Servers` (Servers) and click `Add` (Add).

A little disclaimer here: phpMyAdmin uses a configuration file to define specific (unique) parameters for your system. If the parameter is not specifically specified in the configuration file, then phpMyAdmin “takes” it from its own default settings, most of which are contained in the file http://www.yourdomain.ru/pma/libraries/config.default.php. Therefore, for example, if the MySQL port number is 3306, then there is no need to specifically set it in the config, because This is the default MySQL port number.

In the window that opens, fill in the following fields:
- Server hostname - name of the host (server) on which MySQL is hosted
- Authentication type - cookie (the most secure authentication type)

After filling out these two fields, click `Add` and ignore the warning message `You didn't set phpMyAdmin database, so you can not use all phpMyAdmin features.`, which reports that you did not set the database for phpMyAdmin (required for advanced features of phpMyAdmin - writing comments to fields, information about table relationships, generating pdf diagrams)


e) Move the config.inc.php we created from the `config` directory to the main directory (`pma`). After this, you need to delete the `config` directory, otherwise phpMyAdmin will not work correctly

E) The configuration file has been created. We check that the rights to the config are 644 to prevent third parties from writing to the file.

Creating a phpMyAdmin configuration file manually. This old way creating a configuration file.

A) copy the following lines into a text editor:

$i++;
$cfg["Servers"][$i]["host"] = "MySQL server host name";
$cfg["Servers"][$i]["extension"] = "mysql";
$cfg["Servers"][$i]["connect_type"] = "tcp";
$cfg["Servers"][$i]["compress"] = false;
$cfg["Servers"][$i]["auth_type"] = "cookie";

$cfg["blowfish_secret"] = "any phrase";
?>


b) save this file as config.inc.php and copy it to the `pma` directory

C) check that the permissions to the configuration file are 644

The first method is preferable if you plan to configure advanced phpMyAdmin settings, characterized by setting specific values ​​for many variables. For a basic installation, the old method of creating a configuration file manually is much more attractive.

6. Launch phpMyAdmin in the browser: http://www.yourdomain.ru/pma/. A greeting and an invitation to log in should appear. If everything is done correctly and the login and password entered are correct, the main phpMyAdmin window for managing databases will open.


7. The final, optional step of installing phpMyAdmin is creating a utility database containing tables that are needed for advanced phpMyAdmin functionality. If you are not going to use bookmarks, comments, maintain SQL history, generate PDF database schemas - then creating a service database is optional.

If you want to use the advanced options of phpMyAdmin, then you need to create a service database "phpmyadmin". To do this, just import the dump, which is located in the scripts/ directory. If you have MySQL server 4.1.2 and higher installed, create_tables_mysql_4_1_2+.sql file. If you have a MySQL server version less than 4.1.2 installed, use create_tables.sql instead of the above file.

If you already have a table infrastructure in place and are upgrading MySQL to version 4.1.2 or higher, use upgrade_tables_mysql_4_1_2+.sql.

After importing create_tables.sql, you need to create a special user with the appropriate rights. If you are not working under root (connecting to the MySQL server not as root), then you must connect to the database as root and give the pma user rights to work with the phpmyadmin database, for which you must do the following:

Create a user with the name “pma” and give him the appropriate rights, for which click “Privileges”, on the page that opens, click the link “Add a new User”, in the “Login Information” section (“Account Information”) fill out the fields as follows:

User name: pma
Host: localhost
Password: Create a password

Click the "Go" (OK) button.

On the page that opens, in the “Database-specific privileges” section, select “phpmyadmin” from the “Add privileges on the following database:” drop-down menu. The following page will open, where in the “Database-specific privileges” section, in the “Data” block, check the boxes next to the options: SELECT, INSERT, UPDATE, DELETE and click “Go " ("OK").

If you specified root as "controluser", then you do not need to set rights - he already has them.

After a user with the necessary rights to the `phpmyadmin` database has been created, it is necessary to make adjustments (set table names, login and password for the previously created user "controluser") in the config.inc.php file, setting values ​​for the following directives:
$cfg["Servers"][$i]["controluser"] - the name of the created user to access extended tables
$cfg["Servers"][$i]["controlpass"] - user password
$cfg["Servers"][$i]["pmadb"] - name of the service database
$cfg["Servers"][$i]["bookmarktable"] - name of the table containing information for bookmarks
$cfg["Servers"][$i]["relation"] - name of the table containing information about table relationships
$cfg["Servers"][$i]["table_info"] - name of the table containing information about user database tables
$cfg["Servers"][$i]["table_coords"] - name of the table containing information for generating PDF diagrams
$cfg["Servers"][$i]["pdf_pages"] - name of the table containing information for generating PDF schemas
$cfg["Servers"][$i]["column_info"] - name of the table containing information about comments to table columns
$cfg["Servers"][$i]["history"] - name of the table containing SQL history

Or, agree with the default table names by copying and adding literally the following lines to the configuration file.


Previous materials described the installation and launch of a local Apache web server on Microsoft Windows 7, and also a PHP programming language module and a MySQL DBMS (database management system) were connected to the web server.

Now we need to “acquire” a convenient tool for managing MySQL databases; one of these tools that has gained great popularity is phpMyAdmin.

phpMyAdmin- an open source web application written in PHP and representing a web interface for administering the MySQL DBMS. PHPMyAdmin allows you to administer a MySQL server through a browser, run SQL commands, and view the contents of tables and databases. The application is very popular among web developers, as it allows you to manage the MySQL DBMS without directly entering SQL commands, providing a user-friendly interface.

Download and install phpMyAdmin

Download latest version phpMyAdmin, for this we will follow the link http://phpmyadmin.net/home_page/downloads.php and find on the page a distribution kit whose name has the format "phpMyAdmin-X-X-X-all-languages.*".

Unpack the directory of the downloaded archive into "C:\Apache24\htdocs\" and rename the unpacked directory to "phpmyadmin". As a result, the files of the archive we downloaded should be located in the directory

downloading and installing phpMyAdmin

In point "Working with the php.ini configuration file" material Connecting PHP to Apache we looked at a connection example dynamically loaded extensions. For further work with phpMyAdmin in the php configuration file "C:\php\php.ini" you need to connect the following extensions (after connecting the extensions, you need to restart the web server):

in file php.ini find the Dynamic Extensions block

;;;;;;;;;;;;;;;;;;;;; ; Dynamic Extensions; ;;;;;;;;;;;;;;;;;;;;; ... extension=php_mbstring.dll extension=php_mysql.dll extension=php_mysqli.dll extension=php_pdo_mysql.dll ...

uncomment the necessary extensions

Launching and setting up phpMyAdmin

Like most web applications, phpMyAdmin has a configuration file that stores the settings necessary to run it. I suggest you first try to launch phpMyAdmin, and then, based on unsuccessful attempts to launch it, create and configure its configuration file.

Open the page in the browser http://localhost/phpmyadmin or page http://localhost/phpmyadmin/index.php. You should see a page with a login form. You must enter your MySQL username and password in the form.

Previously in the material Connecting MySQL to Apache We installed the MySQL service. In our case, by default, MySQL has a main user named root and not having a password. Based on this data, we will try to log in. Enter your username - root and do not specify a password.

After an unsuccessful authorization attempt, informational messages are returned to the form. In our case (the case of no password), we will see the message: "Login without a password is prohibited during configuration (see AllowNoPassword)". This message indicates that a missing password should not be tolerated.

Now let's create and configure the phpMyAdmin configuration file.

To do this, we need to create, or rather copy, a configuration file that exists in the root of this application. In the directory "C:\Apache24\htdocs\phpmyadmin" looking for a file "config.sample.inc.php" and create a copy of it with a new name "config.inc.php".

Open the file in a text editor and, since when we tried to log in we were told: "...(see AllowNoPassword)", look for this value and write to it true.

change the value of the variable to true

$cfg["Servers"][$i]["AllowNoPassword"] = true;

After changing this value, when a user tries to log in without a password in phpMyAdmin, the configuration will not complain about its absence. But it is worth noting that this does not mean that a user who has a password may not specify it. Now you can log in.

launch phpMyAdmin

Removing authorization in phpMyAdmin

Since we installed phpMyAdmin on our local web server and, accordingly, only you will work on it, I think it would be advisable to disable authorization in this web application. On a combat web server, for security reasons, there is of course no need to disable authorization.

Open the file "C:\Apache24\htdocs\phpmyadmin\config.inc.php" in a text editor and make the following changes.

variable value $cfg["Servers"][$i]["auth_type"] = "config"; means that authorization data will be taken from the configuration file, namely from the variables listed below.

Based on the results of studying this material, we downloaded, installed and launched the phpMyAdmin web application, which allows you to administer the MySQL server through a browser. And also, for the basic setup of phpMyAdmin, we made changes to the configuration file "config.inc.php".

Share with friends or save for yourself:

Loading...