servers:mysql
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
servers:mysql [2019/02/13 21:19] – Sean Rhone | servers:mysql [2019/02/13 22:07] (current) – Sean Rhone | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Information ====== | ||
+ | * MySQL Community Edition ((https:// | ||
+ | * [[Information: | ||
+ | |||
+ | ===== Prerequisites ===== | ||
+ | |||
+ | * [[distros: | ||
+ | |||
+ | ====== Repository ====== | ||
+ | |||
+ | * https:// | ||
+ | |||
+ | sudo dnf install ' | ||
+ | |||
+ | ====== 5.7 ====== | ||
+ | |||
+ | * Disables the latest GA repo and enables the 5.7 repo | ||
+ | * This is necessary for TrinityCore | ||
+ | |||
+ | sudo dnf repolist all | grep ' | ||
+ | |||
+ | sudo dnf config-manager --disable ' | ||
+ | |||
+ | sudo dnf config-manager --enable ' | ||
+ | |||
+ | ====== Dependencies ====== | ||
+ | |||
+ | **** | ||
+ | |||
+ | sudo dnf install ' | ||
+ | |||
+ | ====== Settings ====== | ||
+ | |||
+ | ===== Initial ===== | ||
+ | |||
+ | **** | ||
+ | |||
+ | echo ' | ||
+ | |||
+ | ===== Settings ===== | ||
+ | |||
+ | * :!: The empty '' | ||
+ | |||
+ | sudo mkdir -p '/ | ||
+ | |||
+ | < | ||
+ | [mysqld] | ||
+ | character-set-client-handshake = FALSE | ||
+ | character-set-server = utf8mb4 | ||
+ | collation-server = utf8mb4_unicode_ci | ||
+ | expire_logs_days = 7 | ||
+ | max_binlog_size = 100M | ||
+ | skip-networking = On | ||
+ | sql-mode = </ | ||
+ | |||
+ | ===== Verify ===== | ||
+ | |||
+ | **** | ||
+ | |||
+ | mysqladmin variables -u ' | ||
+ | |||
+ | ====== Initial Setup ====== | ||
+ | |||
+ | ===== Service ===== | ||
+ | |||
+ | **** | ||
+ | |||
+ | sudo systemctl enable ' | ||
+ | |||
+ | ===== Get Temporary Password ===== | ||
+ | |||
+ | **** | ||
+ | |||
+ | cat '/ | ||
+ | |||
+ | ===== Setup ===== | ||
+ | |||
+ | **** | ||
+ | |||
+ | mysql_secure_installation | ||
+ | |||
+ | |||
+ | |||
+ | ====== Database Repair and Optimization ====== | ||
+ | |||
+ | ===== Create MySQL User ===== | ||
+ | |||
+ | mysql -u ' | ||
+ | |||
+ | GRANT SELECT, INSERT ON *.* to ' | ||
+ | |||
+ | FLUSH PRIVILEGES; | ||
+ | |||
+ | ===== Authentication File ===== | ||
+ | |||
+ | sudo -u ' | ||
+ | |||
+ | < | ||
+ | [mysqlcheck] | ||
+ | user=maintenance | ||
+ | password=x</ | ||
+ | |||
+ | ===== Service ===== | ||
+ | |||
+ | sudo -e '/ | ||
+ | |||
+ | < | ||
+ | [Service] | ||
+ | User=mysql | ||
+ | Group=mysql | ||
+ | Type=oneshot | ||
+ | ExecStart='/ | ||
+ | ExecStartPost='/ | ||
+ | |||
+ | ===== Timer ===== | ||
+ | |||
+ | sudo -e '/ | ||
+ | |||
+ | < | ||
+ | [Unit] | ||
+ | Description=MySQL Database Check, Repair, and Optimization | ||
+ | After=mysqld.service | ||
+ | |||
+ | [Timer] | ||
+ | OnCalendar=weekly | ||
+ | Persistent=true | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=timers.target</ | ||
+ | |||
+ | ====== Notable Commands ====== | ||
+ | |||
+ | ===== Show Users on Server ===== | ||
+ | |||
+ | **** | ||
+ | |||
+ | select User,Host from mysql.user; | ||
+ | |||
+ | ===== Show Data Folder Location ===== | ||
+ | |||
+ | **** | ||
+ | |||
+ | select @@datadir; | ||
+ | |||
+ | ===== Socket File ===== | ||
+ | |||
+ | **** | ||
+ | |||
+ | / | ||
+ | |||
+ | ===== Log ===== | ||
+ | |||
+ | **** | ||
+ | |||
+ | / | ||
+ | |||
+ | ===== Reset ===== | ||
+ | |||
+ | sudo systemctl stop ' | ||
+ | |||
+ | sudo rm -Rf '/ | ||
+ | |||
+ | sudo dnf reinstall ' | ||
+ | |||
+ | ===== Password Validation ===== | ||
+ | |||
+ | ==== cnf ==== | ||
+ | |||
+ | **** | ||
+ | |||
+ | validate_password_policy=LOW | ||
+ | |||
+ | ==== Query ==== | ||
+ | |||
+ | mysql -u ' | ||
+ | |||
+ | SHOW VARIABLES LIKE ' | ||
+ | |||
+ | ==== Configure ==== | ||
+ | |||
+ | * Default policy is '' | ||
+ | |||
+ | mysql -u ' | ||
+ | |||
+ | SET GLOBAL validate_password_policy=LOW; | ||
+ | |||
+ | ==== Disable ==== | ||
+ | |||
+ | mysql -u ' | ||
+ | |||
+ | UNINSTALL PLUGIN validate_password; | ||
+ | |||
+ | ==== Enable ==== | ||
+ | |||
+ | mysql -u ' | ||
+ | |||
+ | INSTALL PLUGIN validate_password SONAME ' |