doc:appunti:linux:sa:mysql
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
doc:appunti:linux:sa:mysql [2019/01/11 15:09] – [Riparazione di tabelle corrotte] niccolo | doc:appunti:linux:sa:mysql [2022/07/04 16:08] – niccolo | ||
---|---|---|---|
Line 121: | Line 121: | ||
</ | </ | ||
- | È possibile anche manipolare direttamente la tabella interna degli utenti: | + | Sarebbe |
<code sql> | <code sql> | ||
Line 227: | Line 227: | ||
password=MySecret | password=MySecret | ||
</ | </ | ||
+ | |||
+ | ===== Accesso root senza password ===== | ||
+ | |||
+ | Debian 9 Stretch installa il motore MariaDB 10.1.37 con una speciale configurazione, | ||
+ | |||
+ | Con questa query si verifica che l' | ||
+ | |||
+ | < | ||
+ | MariaDB [(none)]> | ||
+ | MariaDB [mysql]> SELECT user, host, password, plugin FROM user; | ||
+ | +--------------+-----------+-------------------------------------------+-------------+ | ||
+ | | user | host | password | ||
+ | +--------------+-----------+-------------------------------------------+-------------+ | ||
+ | | root | localhost | | unix_socket | | ||
+ | | oneuser | ||
+ | | anotheruser | ||
+ | </ | ||
+ | |||
+ | Per ripristinare il funzionamento con richiesta di password è necessario impostarla e rimuovere il plugin: | ||
+ | |||
+ | < | ||
+ | USE mysql; | ||
+ | SET PASSWORD FOR ' | ||
+ | UPDATE user SET plugin='' | ||
+ | FLUSH PRIVILEGES; | ||
+ | </ | ||
===== Log delle query ===== | ===== Log delle query ===== | ||
Line 276: | Line 302: | ||
</ | </ | ||
+ | ===== Event Scheduler were found damaged ===== | ||
+ | |||
+ | È capitato un caso in cui un **mysqldump** generava il seguente errore (MariaDB 5.5.64 su CentOS 7.7): | ||
+ | |||
+ | < | ||
+ | mysqldump: Couldn' | ||
+ | Cannot proceed because system tables used by Event | ||
+ | Scheduler were found damaged at server start | ||
+ | </ | ||
+ | |||
+ | In effetti dal prompt SQL si riscontrava lo stesso problema: | ||
+ | |||
+ | < | ||
+ | CONNECT mysql; | ||
+ | SHOW EVENTS; | ||
+ | ERROR 1577 (HY000): Cannot proceed because system tables used | ||
+ | by Event Scheduler were found damaged at server start | ||
+ | </ | ||
+ | |||
+ | Dalla shell Unix sono stati eseguiti i seguenti comandi che hanno risolto il problema (non si sa se sono tutti e tre necessari, ma fino all' | ||
+ | |||
+ | < | ||
+ | mysqlcheck --all-databases --check-upgrade --auto-repair | ||
+ | mysql_upgrade | ||
+ | systemctl restart mariadb.service | ||
+ | </ | ||
===== Utenti e privilegi ===== | ===== Utenti e privilegi ===== | ||
Line 284: | Line 336: | ||
* **tables_priv** Table-level privileges. | * **tables_priv** Table-level privileges. | ||
* **columns_priv** Column-level privileges. | * **columns_priv** Column-level privileges. | ||
- | * **procs_priv** Stored procedure and function privileges. | + | * **procs_priv** Stored procedure and function privileges. |
+ | |||
+ | ===== Encoding del database e delle tabelle ===== | ||
+ | |||
+ | Pare che ancora nel 2020 MySQL (MariaDB 10.3) crei le tabelle con encoding **Latin1**. Ecco come verificare l' | ||
+ | |||
+ | < | ||
+ | SELECT default_character_set_name FROM information_schema.SCHEMATA | ||
+ | WHERE schema_name = ' | ||
+ | |||
+ | +----------------------------+ | ||
+ | | default_character_set_name | | ||
+ | +----------------------------+ | ||
+ | | utf8mb4 | ||
+ | +----------------------------+ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | SELECT CCSA.character_set_name FROM information_schema.TABLES T, | ||
+ | information_schema.COLLATION_CHARACTER_SET_APPLICABILITY CCSA | ||
+ | WHERE CCSA.collation_name = T.table_collation AND T.table_schema = ' | ||
+ | AND T.table_name = ' | ||
+ | |||
+ | +--------------------+ | ||
+ | | character_set_name | | ||
+ | +--------------------+ | ||
+ | | latin1 | ||
+ | +--------------------+ | ||
+ | </ | ||
+ | |||
+ | ===== Errore " | ||
+ | |||
+ | Può capitare con l' | ||
+ | |||
+ | Ovviamente i dati contenuti nella tabella sono persi, ma dovrebbe essere possibile ricostruire la struttura dal file **frm**. Nella pagina **[[https:// |
doc/appunti/linux/sa/mysql.txt · Last modified: 2023/03/27 11:31 by niccolo