Respaldo de una base de datos completa.
mysqldump -- user=root {nombre_db} > {nombre_db}.$(date +%d%m%Y).backup
CREATE DATABASE {nombre_db} CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Muestra las tablas y el total de registros de la base actual.
SELECT TABLE_NAME, TABLE_ROWS
FROM information_schema .tables
WHERE TABLE_SCHEMA = DATABASE();
Muestra los usuarios en el servidor
SELECT User, Host, Password
FROM mysql .user
ORDER BY 1 ;
CREATE USER ' {username}' @' {host}'
IDENTIFIED BY ' {password}' ;
DROP USER ' {username}' @' {host}' ;
SET PASSWORD FOR ' {username}' @' {host}' = PASSWORD(' {password}' );
GRANT ALL PRIVILEGES ON * .* TO ' {username}' @' {host}'
IDENTIFIED BY ' {password}' ;
SHOW GRANTS FOR ' {username}' @' {host}' ;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM ' {username}' @' {host}' ;
SHOW VARIABLES LIKE " general_log%" ;
/* ON DEBUG */
SET GLOBAL general_log = ' ON' ;
$ tail -f /var/lib/mysql/test.log
/* OFF DEBUG */
SET GLOBAL general_log = ' OFF' ;
SHOW VARIABLES LIKE " general_log%" ;