phpmyadmin: how to select a default database?

  Kiến thức lập trình

Is there a way to select a default database when entering phpmyadmin ?

I have 20 databases and I would like to create some shortcuts like

Better if I can choose it with an url parameter such as:

?defaultDatabase=database1

The url parameter for the database name is ‘db’. See https://docs.phpmyadmin.net/en/latest/faq.html#can-i-access-directly-to-database-or-table-pages.

If your ‘normal’ url to open phpMyAdmin was:

https://yourMyPhpAdmin.com/  

. . . then you could go directly to a specific database with:

https://yourMyPhpAdmin.com/sql.php?db=yourDBname  

. . . or directly to SQL view in that database with:

https://yourMyPhpAdmin.com/db_sql.php?db=yourDBname  

. . . or directly to Browse Table view with:

https://yourMyPhpAdmin.com/sql.php?db=yourDBname&table=yourTableName  

I save a lot of time by keeping a set of one-click links to database sections/tasks that I use frequently. You can even supply login credentials – if your webhost has the option enabled. Also, if your webhost the ophasn’t disabled this (like mine has), you could even supply your login credentials with:

&pma_username=youUserName
&pma_password=yourPassword

You can find more parameters by keeping an eye on the eye on the url querystring while navigating the site, or there’s more information here:


4.8 Which parameters can I use in the URL that starts phpMyAdmin?

When accessing phpMyAdmin, you can use the db, pma_username, pma_password and server URL parameters. The server parameter can contain either the numeric host index (from $i of the configuration file) or one of the host names present in the configuration file. Using pma_username and pma_password has been tested with the ‘cookie’ auth_type.

For example, a direct login URL can be constructed as:
https://example.com/phpmyadmin/?pma_username=user&pma_password=password


Warning: If you don’t already know why this is a bad idea, then you really shouldn’t use that last tip!

If you wanted to get really fancy, a quick addition to your .htaccess file would allow you to use direct urls like below. (Details here)

  • http://server/phpMyAdmin/yourDatabase ,or,
  • http://server/phpMyAdmin/yourDatabase/yourTable ,or,
  • http://server/phpMyAdmin/yourDatabase/yourTable/yourScript

1

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT