pub struct MysqlConnection {
pub host: String,
pub port: u16,
pub user: String,
pub password: String,
pub database: String,
pub connect_timeout_secs: u32,
}Expand description
A resolved MySQL connection target for the client. The password goes in MYSQL_PWD
(the env the mysql/mysqldump clients read), never argv.
Fields§
§host: StringThe reachable host.
port: u16The server port.
user: StringThe role to connect as.
password: StringThe password — the ONLY secret; it goes in MYSQL_PWD, never argv.
database: StringThe physical database to dump/restore.
connect_timeout_secs: u32A bounded connect timeout (seconds).
Implementations§
Source§impl MysqlConnection
impl MysqlConnection
Sourcepub fn env(&self) -> Vec<(String, String)>
pub fn env(&self) -> Vec<(String, String)>
The connection ENVIRONMENT: MYSQL_PWD (the password) ONLY. The password is the
sole secret and goes in the env every MySQL client reads, never argv. Host/port/
user are NOT placed here — unlike libpq’s PGHOST (honored by all libpq tools),
MYSQL_HOST is read by the mysql CLI ALONE; mysqldump ignores it and defaults
to the local unix socket (“Can’t connect to local MySQL server through socket”),
so the host/port/user travel in argv via conn_args.
Sourcepub fn conn_args(&self) -> Vec<String>
pub fn conn_args(&self) -> Vec<String>
The non-secret connection args every MySQL client (both mysql and mysqldump)
honors: --host, --port, --user. A real host IP (not “localhost”) forces TCP
rather than the local socket. None of these is a credential, so argv is correct;
no DSN string is assembled.
Trait Implementations§
Source§impl Clone for MysqlConnection
impl Clone for MysqlConnection
Auto Trait Implementations§
impl Freeze for MysqlConnection
impl RefUnwindSafe for MysqlConnection
impl Send for MysqlConnection
impl Sync for MysqlConnection
impl Unpin for MysqlConnection
impl UnsafeUnpin for MysqlConnection
impl UnwindSafe for MysqlConnection
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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