user2237829
user2237829

Reputation:

create host table in mysql for user access with phpmyadmin

I am trying to create a host table in phpMyAdmin for user access and while there is this option below, I cannot find this table to add hosts nor any instructions to create one.

Am I missing something?

Field: Use Host Table Description: When host table is used, this field is ignored and values stored in Host table are used instead.

Thank you in advance

Upvotes: 5

Views: 15152

Answers (1)

Ethan Wayne
Ethan Wayne

Reputation: 351

As of MySQL 5.6.7 the host table is no longer included in the installation of MySQL.

It used to be that you could use the host table (located at mysql.host) to define allowed hosts for a specific database. It worked something like this:

  1. A user would try to do something (let's say INSERT).
  2. The server would look in the mysql.user table to see if the user had global INSERT privileges.
  3. If the user didn't have global INSERT privileges the server would then look in the mysql.db table to see if the user had DB specific privileges.
  4. If the user had DB specific privileges and the mysql.db.Host field was empty the server would look in the mysql.host table for any hosts that matched the Db field of the mysql.db.Db field.
  5. Assuming it found a match it would allow the INSERT.

If you want to have multiple hosts for a given user read the following:

Since a MySQL username is actually 'name'@'host' you could always add multiple users with the same name but different hosts and give them the same privileges.

Why does phpmyadmin still include this feature?

I can only assume that it is for legacy support.

Upvotes: 7

Related Questions