Mysql

De notas.romsolutions.es
Ir a la navegación Ir a la búsqueda

Usuarios y permisos

  • CREATE DATABASE prueba_db
  • CREATE USER 'user_test'@'localhost' IDENTIFIED BY 'PASSWORD'; Únicamente desde lcoalhost
  • CREATE USER 'user_test'@'%' IDENTIFIED BY='password'; Desde todas las redes
  • GRANT ALL ON prueb_db.* TO 'user_test'@'localhost';
  • FLUSH PRIVILEGES

Comandos externos para mantenimiento

mysqladmin -u root -p processlist
mysqladmin -u root -p status
mysqladmin -u root -p extended-status
mysqladmin -u root -p variables

Comandos internos mantenimiento

show full processlist
show databases;
use database;
show full tables from database;

Slave

show slave status

Estados correctos

Slave_IO_State: Waiting for master to send event
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Exec_Master_Log_Pos: número tiene que aumentar
Relay_Log_Space: número tiene que aumentar

Copia de tablas

Después de copiar o traspasar las tablas hacia otro servidor debemos entrar dentro del mysql y realizar el siguiente comando con tal de que los datos estén actualizados

flush tables;

Consulta sobre Tablas

select table_schema, table_name, engine from information_schema.tables;

Inserts de Usuarios

  • Tipo1
insert into user values("10.13.120.248","cactiuser",password('password'),"Y","N","N","N","N","N","N","N","N","N","N","N","N","N","N","Y","N","N","N","N","Y","N","N","N","N","N","","","","","0","0","0","0");
  • Tipo2
insert into user values("10.13.120.248","cactiuser",password('password'),"Y","N","N","N","N","N","N","N","N","N","N","N","N","N","N","Y","N","N","N","N","Y","N","N","N","N","N","N","N","","","","","0","0","0","0");
  • Tipo3
insert into user values("10.13.120.248","cactiuser",password('password'),"Y","N","N","N","N","N","N","N","N","N","N","N","N","N","N","Y","N","N","N","N","Y","N","N","N","N","N","N","N","N","","","","","0","0","0","0","","","N");
  • Tipo4
insert into user values  '85.116.115.22','cactiuser',password('password'),"Y","N","N","N","N","N","N","N","N","N","N","N","N","N","N","Y","N","N","N","N","Y,"N","N","N","N","N","N","N","N","Y","","","","","0","0","0","0","","","N","N","","0.000000");