Add repo:
- wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
- sudo yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
Install server:
- sudo yum install mysql-community-server
Start server:
- sudo systemctl start mysqld
Add to system start:
- sudo systemctl enable mysqld
Retrieve the temporary password generated by MySQL:
- grep 'A temporary password is generated for root@localhost' /var/log/mysqld.log | tail -1
To secure your installation of MySQL run the following:
- /usr/bin/mysql_secure_installation
Punch hole in the firewall if database needs to be accessed remotely:
- sudo firewall-cmd --permanent --zone=public --add-service=mysql
OR:
- sudo firewall-cmd --permanent --zone=public --add-port=3306/tcp
Finally, restart the firewall for the changes to take effect:
- sudo systemctl restart firewalld.service
Add MySQL User:
- CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
- GRANT ALL PRIVILEGES ON 'database'.* TO 'user'@'localhost';