meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux:databases [2015/06/22 08:22] – created niziaklinux:databases [2022/04/11 10:27] (current) niziak
Line 1: Line 1:
 +====== Databases ======
 +
 ===== Reset password ===== ===== Reset password =====
 Start database without permission checking: Start database without permission checking:
Line 22: Line 24:
 </code> </code>
  
 +<code sql>
  
 GRANT LOCK TABLES ON *.* TO 'debian-sys-maint'@'localhost'; GRANT LOCK TABLES ON *.* TO 'debian-sys-maint'@'localhost';
  
-GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost'+GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost';
 GRANT RELOAD, SHUTDOWN, PROCESS, SHOW DATABASES, SUPER, LOCK TABLES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY PASSWORD 'xxxxxxxxxxxxxxxxxxxx' GRANT RELOAD, SHUTDOWN, PROCESS, SHOW DATABASES, SUPER, LOCK TABLES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY PASSWORD 'xxxxxxxxxxxxxxxxxxxx'
 GRANT ALL ON testDB.* TO 'demo-user'@'localhost'; GRANT ALL ON testDB.* TO 'demo-user'@'localhost';
 +</code>
  
 ==== MySQL ==== ==== MySQL ====
 +<code sql>
 show databases; show databases;
 show tables; show tables;
 +</code>
  
 === Permissions === === Permissions ===
 +<code sql>
 SHOW GRANTS; SHOW GRANTS;
 SHOW GRANTS FOR CURRENT_USER; SHOW GRANTS FOR CURRENT_USER;
Line 39: Line 46:
 SELECT User,Host,Password FROM mysql.user; SELECT User,Host,Password FROM mysql.user;
 flush privileges; flush privileges;
 +</code>
  
 +=== Optimize databases === 
 +<code bash> 
 +#!/bin/bash 
 +mysqlcheck --all-databases 
 +mysqlcheck --all-databases -o 
 +mysqlcheck --all-databases --auto-repair 
 +mysqlcheck --all-databases --analyze 
 +</code>