pub enum DatabaseCommand {
CreateDb(DatabaseCreateArgs),
DropDb(DatabaseDropArgs),
ShowDb(DatabaseShowArgs),
ShowDbPrivs(DatabaseShowPrivsArgs),
EditDbPrivs(DatabaseEditPrivsArgs),
}
Variants§
CreateDb(DatabaseCreateArgs)
Create one or more databases
DropDb(DatabaseDropArgs)
Delete one or more databases
ShowDb(DatabaseShowArgs)
Print information about one or more databases
If no database name is provided, all databases you have access will be shown.
ShowDbPrivs(DatabaseShowPrivsArgs)
Print user privileges for one or more databases
If no database names are provided, all databases you have access to will be shown.
EditDbPrivs(DatabaseEditPrivsArgs)
Change user privileges for one or more databases. See edit-db-privs --help
for details.
This command has two modes of operation:
-
Interactive mode: If nothing else is specified, the user will be prompted to edit the privileges using a text editor.
You can configure your preferred text editor by setting the
VISUAL
orEDITOR
environment variables.Follow the instructions inside the editor for more information.
-
Non-interactive mode: If the
-p
flag is specified, the user can write privileges using arguments.The privilege arguments should be formatted as
<db>:<user>:<privileges>
where the privileges are a string of characters, each representing a single privilege. The characterA
is an exception - it represents all privileges.The character-to-privilege mapping is defined as follows:
s
- SELECTi
- INSERTu
- UPDATEd
- DELETEc
- CREATED
- DROPa
- ALTERI
- INDEXt
- CREATE TEMPORARY TABLESl
- LOCK TABLESr
- REFERENCESA
- ALL PRIVILEGES
If you provide a database name, you can omit it from the privilege string,
e.g. edit-db-privs my_db -p my_user:siu
is equivalent to edit-db-privs -p my_db:my_user:siu
.
While it doesn’t make much of a difference for a single edit, it can be useful for editing multiple users
on the same database at once.
Example usage of non-interactive mode:
Enable privileges `SELECT`, `INSERT`, and `UPDATE` for user `my_user` on database `my_db`:
`mysqladm edit-db-privs -p my_db:my_user:siu`
Enable all privileges for user `my_other_user` on database `my_other_db`:
`mysqladm edit-db-privs -p my_other_db:my_other_user:A`
Set miscellaneous privileges for multiple users on database `my_db`:
`mysqladm edit-db-privs my_db -p my_user:siu my_other_user:ct``
Trait Implementations§
Source§impl Clone for DatabaseCommand
impl Clone for DatabaseCommand
Source§fn clone(&self) -> DatabaseCommand
fn clone(&self) -> DatabaseCommand
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl CommandFactory for DatabaseCommand
impl CommandFactory for DatabaseCommand
Source§impl Debug for DatabaseCommand
impl Debug for DatabaseCommand
Source§impl FromArgMatches for DatabaseCommand
impl FromArgMatches for DatabaseCommand
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches
to self
.Source§fn update_from_arg_matches_mut<'b>(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches
to self
.Source§impl Parser for DatabaseCommand
impl Parser for DatabaseCommand
Source§fn parse_from<I, T>(itr: I) -> Self
fn parse_from<I, T>(itr: I) -> Self
Source§fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
Source§fn update_from<I, T>(&mut self, itr: I)
fn update_from<I, T>(&mut self, itr: I)
Source§impl Subcommand for DatabaseCommand
impl Subcommand for DatabaseCommand
Source§fn augment_subcommands<'b>(__clap_app: Command) -> Command
fn augment_subcommands<'b>(__clap_app: Command) -> Command
Source§fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command
fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command
Command
so it can instantiate self
via
FromArgMatches::update_from_arg_matches_mut
Read moreSource§fn has_subcommand(__clap_name: &str) -> bool
fn has_subcommand(__clap_name: &str) -> bool
Self
can parse a specific subcommandAuto Trait Implementations§
impl Freeze for DatabaseCommand
impl RefUnwindSafe for DatabaseCommand
impl Send for DatabaseCommand
impl Sync for DatabaseCommand
impl Unpin for DatabaseCommand
impl UnwindSafe for DatabaseCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more