Name
mysqlaccess
Synopsis
mysqlaccess [host
[user
[database
]]] [options
]
This utility checks the privileges that a user has for a specific host and database. One use is to run it as a preliminary tool to check for user permissions before proceeding with a customized program that uses one of the APIs.
If MySQL was not installed in the default location for the version
you’re using, you’ll have to set the variable MYSQL
in the mysqlaccess
script. Change it with a plain
text editor. Look for the following line (near the beginning) and change
the file path to where the mysql
client is
located:
$MYSQL = '/usr/local/mysql/bin/mysql'; # path to mysql executable
With regard to the syntax, the hostname is the first argument and is optional. If not given, localhost is assumed. The username given in the second argument is the name of the user for which the utility is checking privileges. The third argument is the database against which to check privileges. The fourth argument involves several possible options, one of which could be the username by which the utility will access the server to gather information on the user named in the second argument. Here is an example of how you might use this utility:
mysqlaccess localhost marie workrequests -U russell -P
In this example, I give the utility the hostname, then the user
I’m inquiring about, then the database name for which I want user
privilege information. The -U
option specifies the username with which to access the server to gather information. ...
Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.