MySQL on CentOS

Installation

  1. wget rpm from http://dev.mysql.com/downloads/repo/yum/.
  2. Install release package (Example):
    1
    
     sudo rpm -Uvh mysql80-community-release-el6-n.noarch.rpm
    
  3. Select Version

    1
    2
    3
    4
    
     yum repolist all | grep mysql  
     sudo yum-config-manager --disable mysql80-community  
     sudo yum-config-manager --enable mysql57-community  
     yum repolist enabled | grep mysql  
    
  4. Install & Config MySQL
    1
    2
    3
    4
    5
    6
    
     sudo yum install mysql-community-server  
     sudo systemctl start mysqld.service  
     sudo systemctl enable mysqld.service   // as service at start  
     sudo grep 'temporary password' /var/log/mysqld.log  
     mysql -uroot -p  
     MYSQL > ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword!';  
    

Remote Access

SQL

1
2
3
UPDATE user SET Host='%' WHERE User='root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Firewall

1
2
firewall-cmd --add-port=3306/tcp
firewall-cmd --permanent --add-port=3306/tcp

MISC

https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/