Methods |
public
|
__destruct()
|
#
|
public
|
user_exists($user, $host = 'localhost')
|
#
|
public
|
get_prefix()
|
#
|
public
|
delete_user(string $user, string $host)
bool delete_mysql_user(string, string[, bool = false])
Delete a MySQL user
bool delete_mysql_user(string, string[, bool = false])
Delete a MySQL user
Parameters
$user |
username
|
$host |
hostname
|
|
#
|
public
|
store_password(string $sqlpasswd): bool
bool store_sql_password (string, string)
bool store_sql_password (string, string)
Parameters
$sqlpasswd |
plaintext password
|
|
#
|
public
|
set_option(string $option, string $value = null, string $group = 'client'): bool
Set MySQL client option
Set MySQL client option
Reads from ~/.my.cnf and creates if necessary.
Specify a value of null to remove an option.
|
#
|
public
|
get_password(): string
string retrieve_sql_password (string)
string retrieve_sql_password (string)
|
#
|
public
|
get_option(string $option, string $group = 'client'): mixed
Get option from MySQL client/server configuration
Get option from MySQL client/server configuration
Parameters
$option |
option name
|
$group |
option group
|
Returns
option value, false on failure, null on non-existent value
|
#
|
public
|
get_elevated_password_backend()
|
#
|
public
|
import(string $db, string $file): bool
Import a database from a dump
Import a database from a dump
Parameters
$db |
database name
|
$file |
filename
|
|
#
|
public
|
resolve_site_from_database(string $db): string|null
Resolve database from site
Resolve database from site
|
#
|
public
|
recover_innodb_from_disk(string $db, string $srcdir, bool $force = false): bool
Recover InnoDB from .ibd files
Recover InnoDB from .ibd files
Existing .ibd are NOT overwritten.
Parameters
$db |
target database
|
$srcdir |
source directory containing .ibd files
|
$force |
overwrite .ibd if it exists
|
|
#
|
public
|
list_databases(): array
array list_mysql_databases ()
Queries the db table in the mysql database for applicable grants
array list_mysql_databases ()
Queries the db table in the mysql database for applicable grants
Returns
|
#
|
public
|
change_prefix(string $prefix): bool
Change account database prefix
Change account database prefix
|
#
|
public
|
get_sql_prefix()
|
#
|
public
|
list_users()
array list_mysql_users ()
Lists all created users for MySQL
array list_mysql_users ()
Lists all created users for MySQL
|
#
|
public
|
add_user(
$user,
$host,
$password,
int $maxconn = self::DEFAULT_CONCURRENCY_LIMIT,
int $maxupdates = 0,
int $maxquery = 0,
string $ssl = '',
string $cipher = '',
string $issuer = '',
string $subject = '',
): bool|MySQLError|void
bool add_mysql_user(string, string, string[, int[, int[, int[, string[, string[, string[, string]]]]]]])
bool add_mysql_user(string, string, string[, int[, int[, int[, string[, string[, string[, string]]]]]]])
|
#
|
public
|
get_database_charset(string $db): null|string
Get charset from database
Get charset from database
|
#
|
public
|
create_database(string $db, string $charset = 'latin1', string $collation = 'latin1_swedish_ci'): bool
Create a new mysql database
Create a new mysql database
Parameters
$charset |
optional default charset
|
$collation |
optional default collation
|
Returns
|
#
|
public
|
charset_valid($charset): bool
|
#
|
public
|
get_supported_charsets(): array
|
#
|
public
|
collation_valid(string $collation): bool
Validate collation name
|
#
|
public
|
get_supported_collations()
|
#
|
public
|
collation_compatible(string $collation, string $charset): bool
Verify collation + charset combination are compatible
Verify collation + charset combination are compatible
|
#
|
public
|
database_exists(string $db): bool
Query information_schema for existence of MySQL database
Query information_schema for existence of MySQL database
Parameters
|
#
|
public
|
create_database_backend($db, $charset, $collation)
bool create_mysql_database_backend (string)
{@link create_mysql_database}
bool create_mysql_database_backend (string)
{@link create_mysql_database}
|
#
|
public
|
add_user_permissions(string $user, string $host, string $db, array $opts): bool
bool add_mysql_user_permissions (string, string, string, array)
bool add_mysql_user_permissions (string, string, string, array)
|
#
|
public
|
set_privileges(string $user, string $host, string $db, array $privileges): bool
Set grants for a MySQL user
Set grants for a MySQL user
Parameters
|
#
|
public
|
delete_user_permissions($user, $host, $db)
|
#
|
public
|
revoke_privileges(string $user, string $host, string $db): bool
Revoke all privileges on a database from a MySQL user
Revoke all privileges on a database from a MySQL user
|
#
|
public
|
get_user_permissions($user, $host, $db)
|
#
|
public
|
get_privileges(string $user, string $host, string $db): array
Get MySQL grants for a user on a database
Get MySQL grants for a user on a database
|
#
|
public
|
version($pretty = false): int|string
Returns the version of the MySQL server as an integer
Returns the version of the MySQL server as an integer
The form of this version number is
main_version * 10000 + minor_version * 100 + sub_version
(i.e. version 4.1.0 is 40100)
Returns
integer representing the server version or string
|
#
|
public
|
delete_database(string $db): bool
Delete MySQL database from system
Delete MySQL database from system
Parameters
|
#
|
public
|
delete_backup(string $db): bool
Remove MySQL Backup
|
#
|
public
|
assert_permissions()
Ensure that /var/lib/mysql/ has mysql:<group id> ownership
Ensure that /var/lib/mysql/ has mysql: ownership
|
#
|
public
|
delete_database_backend($db)
|
#
|
public
|
edit_user(string $user, string $host, array $opts): bool
bool edit_mysql_user(string, string, array)
Note when calling through SOAP, all options must be given, otherwise
theā¦
bool edit_mysql_user(string, string, array)
Note when calling through SOAP, all options must be given, otherwise
the will default to server preferences.
Parameters
$user |
user
|
$host |
hostname
|
$opts |
array of options, valid indexes:
host
password
max_user_connections
max_updates
max_questions
use_ssl
ssl_type
ssl_cipher
x509_subject
x509_issuer
|
Returns
|
#
|
public
|
service_enabled(): bool
bool service_enabled (string)
bool service_enabled (string)
Checks to see if a service is enabled
|
#
|
public
|
enabled(): bool
MySQL/PostgreSQL service enabled on account
MySQL/PostgreSQL service enabled on account
Checks to see if either MySQL or PostgreSQL is enabled on an account
|
#
|
public
|
truncate_database($db)
|
#
|
public
|
empty($db): bool
Database is empty
|
#
|
public
|
empty_database($db)
|
#
|
public
|
export(string $db, string|null $file = null): mixed
Export a MySQL database
Parameters
Returns
path of export or false on failure
|
#
|
public
|
clone(string $from, string $to): bool
Clone a database
Parameters
$from |
source database
|
$to |
target database
|
|
#
|
public
|
get_database_size(string $db): int
Get disk space occupied by database
Get disk space occupied by database
Parameters
Returns
|
#
|
public
|
export_pipe($db): bool|void
Export a db to a named pipe for immediate download
Export a db to a named pipe for immediate download
|
#
|
public
|
export_pipe_real($db, $user): bool|string|void
Export a database to a named pipe
Export a database to a named pipe
Differs from export_pipe in that it may only be called internally
or from backend, no API access
|
#
|
public
|
get_uptime(): int
int get_mysql_uptime
|
#
|
public
|
add_backup(
string $db,
string $extension = DATABASE_BACKUP_EXTENSION,
int $span = DATABASE_BACKUP_SPAN,
int $preserve = DATABASE_BACKUP_PRESERVE,
$email = '',
)
|
#
|
public
|
edit_backup(
string $db,
string $extension = DATABASE_BACKUP_EXTENSION,
int $span = DATABASE_BACKUP_SPAN,
int $preserve = DATABASE_BACKUP_PRESERVE,
$email = '',
)
|
#
|
public
|
list_backups()
|
#
|
public
|
get_backup_config(string $db): array
Fetch MySQL backup task information
Fetch MySQL backup task information
span => (integer) days between backups
hold => (integer) number of backups to preserve
next => (integer) unix timestamp of next backup
ext => (string) extension of backup
email => (string) notify address after backup
Parameters
|
#
|
public
|
repair_database($db)
|
#
|
public
|
kill(integer $id): bool
Kill a mysql connection
|
#
|
public
|
get_processlist(): array
Get active mysql connections
Get active mysql connections
Array
(
[0] => Array
(
[id] => 11024
[user] => debug
[host] => localhost
[db] => debug
[command] => Query
[state] => User sleep
[info] => select sleep(1000)
)
)
|
#
|
public
|
stats(): array
Get basic MySQL server statistics
Get basic MySQL server statistics
|
#
|
public
|
_cron(Cronus $c)
|
#
|
public
|
schema_column_maxlen(string $field): int|null
Get max length of a column in mysql schema
Get max length of a column in mysql schema
|
#
|