Home / Linux / MySQL / Install MySQL 5.7 on CentOS 7.4

Install MySQL 5.7 on CentOS 7.4


Add repo:
  1. wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
  2. sudo yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

Install server:

  1. sudo yum install mysql-community-server

Start server:

  1. sudo systemctl start mysqld

Add to system start:

  1.  sudo systemctl enable mysqld

Retrieve the temporary password generated by MySQL:

  1. grep 'A temporary password is generated for root@localhost' /var/log/mysqld.log | tail -1

To secure your installation of MySQL run the following:

  1. /usr/bin/mysql_secure_installation

Punch hole in the firewall if database needs to be accessed remotely:

  1. sudo firewall-cmd --permanent --zone=public --add-service=mysql

OR:

  1. sudo firewall-cmd --permanent --zone=public --add-port=3306/tcp

Finally, restart the firewall for the changes to take effect:

  1. sudo systemctl restart firewalld.service

Add MySQL User:

  1. CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
  2. GRANT ALL PRIVILEGES ON 'database'.* TO 'user'@'localhost';



    Post a comment

    Your Name or E-mail ID (mandatory)

     

    Note: Your comment will be published after approval of the owner.




     RSS of this page