2

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

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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


i 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 Comment

Is it possible to achieve the same task by setting $cfg['Servers'][$i]['auth_type'] = 'config' and some other parameter?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.