Skip to content

Latest commit

 

History

History
61 lines (44 loc) · 1.05 KB

mysql.md

File metadata and controls

61 lines (44 loc) · 1.05 KB

MySQL

Installation

  • MySQL v 5.7 or higher generates a temporary random password after installation

    grep 'temporary password' /var/log/mysqld.log
  • Security steps

    mysql_secure_installation

Config

  • /etc/my.cnf

    [mysqld]
    port=${port}
    [client]
    port=${port}
  • Firewall

    firewall-cmd --zone=public --add-rich-rule 'rule family="ipv4" source address="x.x.0.0/16" port port=${port} protocol=tcp accept' --permanent
    firewall-cmd --reload

Grants

CREATE USER 'zhangyu'@'localhost' IDENTIFIED BY '1';
grant all on testdb.* to 'zhangyu'@'%';
grant all privileges on *.* to 'zhangyu'@'%' with grant option;
flush privileges;

phpMyAdmin

yum install php-mysql php-fpm
ln -s /usr/share/phpMyAdmin /usr/share/nginx/html
mv /usr/share/nginx/html/phpMyAdmin /usr/share/nginx/html/pma
systemctl restart php-fpm
  • /etc/phpMyAdmin/config.inc.php

    $cfg['Servers'][$i]['host']    = '127.0.0.1';
    $cfg['Servers'][$i]['port']    = '15906';