servers:linux:mysql
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| servers:linux:mysql [2024/08/13 16:33] – created Sean Rhone | servers:linux:mysql [2025/09/11 06:43] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Information ====== | ====== Information ====== | ||
| - | * MySQL Community Edition ((https:// | + | * MySQL |
| - | * [[Information: | + | |
| ===== Prerequisites ===== | ===== Prerequisites ===== | ||
| - | * [[distros: | + | * [[linux;distros; |
| - | + | * [[distros:fedora_server|Fedora Server]] (TODO) | |
| - | ====== 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 ====== | ====== Dependencies ====== | ||
| Line 29: | Line 12: | ||
| **** | **** | ||
| - | sudo dnf install 'mysql-community-server' | + | sudo dnf install ' |
| - | ====== | + | ====== |
| - | + | ||
| - | ===== 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 | + | |
| **** | **** | ||
| Line 69: | Line 20: | ||
| sudo systemctl enable ' | sudo systemctl enable ' | ||
| - | ===== Get Temporary Password | + | ====== Settings ====== |
| **** | **** | ||
| - | | + | |
| - | ===== Setup ===== | + | ===== Verify |
| **** | **** | ||
| - | | + | |
| - | + | ||
| ====== Database Repair and Optimization ====== | ====== Database Repair and Optimization ====== | ||
| - | ===== Create MySQL User ===== | + | ===== One-shot ===== |
| - | + | ||
| - | 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 | + | |
| **** | **** | ||
| - | | + | |
| - | + | ||
| - | ===== Show Data Folder Location ===== | + | |
| - | + | ||
| - | **** | + | |
| - | + | ||
| - | select @@datadir; | + | |
| - | + | ||
| - | ===== Socket File ===== | + | |
| - | + | ||
| - | **** | + | |
| - | + | ||
| - | / | + | |
| - | + | ||
| - | ===== Log ===== | + | |
| - | + | ||
| - | **** | + | |
| - | + | ||
| - | / | + | |
| - | + | ||
| - | ===== Reset ===== | + | |
| - | + | ||
| - | sudo systemctl stop 'mysqld' | + | |
| - | + | ||
| - | sudo rm -Rf '/ | + | |
| - | + | ||
| - | sudo dnf reinstall 'mysql-community-server' | + | |
| - | + | ||
| - | ===== 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 ' | + | |
/srv/www/wiki/data/attic/servers/linux/mysql.1723581197.txt.gz · Last modified: (external edit)
