mysqladmin
Stai visualizzando una vecchia versione di questo article. Visualizza
la versione più recente.
Contents
mysqladmin
è il programma di amministrazione del demone mysqld. Può essere utilizzato per:
- Monitorare le attività dei client MariaDB (processlist)
- Ottenere le statistiche di utilizzo e le variabili dal server MariaDB / MySQL
- Creare ed eliminare database
- Svuotare i log, le statistiche e le tabelle
- Terminare le query in esecuzione.
- Arrestare il server (shutdown)
- Avviare e arrestare gli slave
- Controllare se il server è raggiungibile (ping)
Utilizzo
mysqladmin [OPZIONI] comando comando....
Opzioni di mysqladmin
Opzione | Spiegazione |
---|---|
-c, | Numero di iterazioni da eseguire. Funziona solo con -i ( ). |
| Controlla la memoria e l'utilizzo dei file aperti prima di uscire. |
| Stampa le informazioni di debug ed esce. |
-f, | Non chiede conferma prima di eliminare un database; ripetendo più volte il comando, continua anche se si verificano degli errori. |
-C, | Utilizza la compressione nel protocollo server/client. |
| Directory dei set di caratteri. |
| Imposta il set di caratteri predefinito. |
-?, | Mostra questo help ed esce. |
-h, | Si connette all'host specificato. |
-b, | Disattiva i beep in caso di errore. |
-p, | Password da usare per connettersi al server. Se non viene specificata, verrà chiesta da tty. |
-P, | Numero di porta da usare per la connessione, o 0 per usare la porta di default specificata, in ordine di preferenza, in my.cnf, $MYSQL_TCP_PORT, /etc/services o il default built-in (3306). |
| Il protocollo da usare per la connessione (tcp, socket, pipe, memory). |
-r, | Mostra le differenze tra i valori attuali e quelli precedenti, se usato con -i. Attualmente funziona solo con extended-status. |
-O, | Modifica il valore di una variabile. Si noti che questa opzione è deprecata; è possibile impostare la variabile direttamente con . |
-s, | Termina silenziosamente se non può connettersi al server. |
-S, | Il file del socket da usare per la connessione. |
-i, | Esegue i comandi ripetutamente, lasciando trascorrere l'intervallo di tempo specificato. |
| Abilita le connessioni SSL (abilitato automaticamente se si usano gli altri flag). Si può disabilitare con ' '. |
| File CA nel formato PEM (si veda la documentazione diOpenSSL, implica ). |
| Directory CA (si veda la documentazione diOpenSSL, implica ). |
| Certificato X509 nel formato PEM (implica ). |
| Cifratura SSL da usare (implica ). |
| Chiave X509 nel formato PEM (implica ). |
| Verifica il "Common Name" nel certificato con il nome host usato per connettersi. Questa opzione è disabilitata per default.. |
-u, | Nome utente da usare per il login, se non è quello corrente. |
-v, | Stampa più informazioni. |
-V, | Stampa il numero di versione e termina. |
-E, | Stampa l'output verticalmente. Simile a ' ', ma stampa l'output verticalmente. |
-w, | Attende e riprova se la connessione fallisce. |
| |
|
Variabili di mysqladmin (--
nome-variabile=valore
)
--
nome-variabile=valoreVariabili e opzioni booleane | Valore {FALSE|TRUE} (dopo aver letto le opzioni) |
---|---|
count | 0 |
debug-check | FALSE |
debug-info | FALSE |
force | FALSE |
compress | FALSE |
character-sets-dir | (Nessun valore predefinito) |
default-character-set | (Nessun valore predefinito) |
host | (Nessun valore predefinito) |
no-beep | FALSE |
port | 3306 |
relative | FALSE |
socket | /var/run/mysqld/mysqld.sock |
sleep | 0 |
ssl | FALSE |
ssl-ca | (Nessun valore predefinito) |
ssl-capath | (Nessun valore predefinito) |
ssl-cert | (Nessun valore predefinito) |
ssl-cipher | (Nessun valore predefinito) |
ssl-key | (Nessun valore predefinito) |
ssl-verify-server-cert | FALSE |
user | (Nessun valore predefinito) |
verbose | FALSE |
vertical | FALSE |
connect_timeout | 43200 |
shutdown_timeout | 3600 |
Opzioni predefinite di mysqladmin
Le opzioni predefinite vengono lette dai seguenti file, nell'ordine:
/etc/my.cnf
/etc/mysql/my.cnf
/usr/etc/my.cnf
~
/.my.cnf
Vengono letti i seguenti gruppi:
mysqladmin
client
client-server
client-mariadb
Le seguenti opzioni possono essere specificate come primo argomento:
Option | Description |
---|---|
| Stampa la lista degli argomenti e termina. |
| Non legge le opzioni predefinite dai file. |
| Legge le opzioni predefinite solo dal file specificato. |
| Legge questo file dopo aver letto quelli globali. |
mysqladmin Commands
Command is one or more of: (Commands may be shortened)
Command | Description |
---|---|
create databasename | Create a new database |
debug | Instruct server to write debug information to log |
drop databasename | Delete a database and all its tables |
extended-status | Gives an extended status message from the server |
flush-all-statistics | Flush all statistics tables |
flush-all-status | Flush status and statistics |
flush-client-statistics | Flush client statistics |
flush-hosts | Flush all cached hosts |
flush-index-statistics | Flush index statistics |
flush-logs | Flush all logs |
flush-privileges | Reload grant tables (same as reload) |
flush-slow-log | Flush slow query log |
flush-status | Clear status variables |
flush-table-statistics | Clear table statistics |
flush-tables | Flush all tables |
flush-threads | Flush the thread cache |
flush-user-statistics | Flush user statistics |
kill id,id,... | Kill mysql threads |
password new-password | Change old password to new-password, MySQL 4.1 hashing. |
old-password new-password | Change old password to new-password in old format. |
ping | Check if mysqld is alive |
processlist | Show list of active threads in server |
reload | Reload grant tables |
refresh | Flush all tables and close and open logfiles |
shutdown | Take server down |
status | Gives a short status message from the server |
start-slave | Start slave |
stop-slave | Stop slave |
variables | Prints variables available |
version | Get version info from server |
Typical example usage
Quick check of what the server is doing:
shell> mysqladmin status Uptime: 8023 Threads: 1 Questions: 14 Slow queries: 0 Opens: 15 Flush tables: 1 Open tables: 8 Queries per second avg: 0.1 shell> mysqladmin processlist +----+-------+-----------+----+---------+------+-------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +----+-------+-----------+----+---------+------+-------+------------------+ .... +----+-------+-----------+----+---------+------+-------+------------------+
More extensive information of what is happening 'just now' changing (great for troubleshooting a slow server):
shell> mysqladmin --relative --sleep=1 extended-status | grep -v " 0 "
Check the variables for a running server:
shell> mysqladmin variables | grep datadir | datadir | /my/data/ |
See also
- mytop, a 'top' like program for MariaDB/MySQL that allows you to see what the server is doing. A mytop optimized for MariaDB is included in MariaDB 5.3
Commenti
Sto caricando i commenti......
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.