Home > Article > Operation and Maintenance > How to download mysql on centos
##1. Download and install the official MySQL Yum Repository
[root@localhost ~]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpmUse the above command to directly download the Yum Repository for installation, probably It looks like 25KB, and then you can install it directly with yum.
[root@localhost ~]# yum -y install mysql57-community-release-el7-10.noarch.rpmThen start installing the MySQL server.
[root@localhost ~]# yum -y install mysql-community-serverThis step may take some time. After the installation is completed, the previous mariadb will be overwritten.
2. MySQL database settings
First start MySQL[root@localhost ~]# systemctl start mysqld.serviceCheck the running status of MySQL
[root@localhost ~]# systemctl status mysqld.serviceIf you want to enter MySQL, you have to First find out the password of the root user at this time. You can find the password in the log file through the following command:
[root@localhost ~]# grep "password" /var/log/mysqld.logEnter the database with the following command:
[root@localhost ~]# mysql -uroot -pEnter the initial password (the last one in the picture above) no;e!5>>alfg), you cannot do anything at this time, because MySQL must change the password by default before operating the database:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';Replace 'new password' with the password you want to set, Note: Password settings must contain uppercase and lowercase letters, numbers, and special symbols (,/';:, etc.), otherwise the configuration cannot be successful.
3. Add open ports for firewalld
Add mysql port 3306 and Tomcat port 8080[root@localhost ~]# firewall-cmd --zone=public --add-port=3306/tcp --permanent [root@localhost ~]# firewall-cmd --zone=public --add-port=8080/tcp --permanentThen reload
[root@localhost ~]# firewall-cmd --reloadRelated tutorial recommendations:
The above is the detailed content of How to download mysql on centos. For more information, please follow other related articles on the PHP Chinese website!