Home >Operation and Maintenance >CentOS >How to download mysql on centos

How to download mysql on centos

王林
王林Original
2020-04-04 09:15:223564browse

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.rpm

Use 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.rpm

Then start installing the MySQL server.


[root@localhost ~]# yum -y install mysql-community-server

This 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.service

Check the running status of MySQL

[root@localhost ~]# systemctl status mysqld.service

If 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.log

Enter the database with the following command:

[root@localhost ~]# mysql -uroot -p

Enter 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 --permanent

Then reload

[root@localhost ~]# firewall-cmd --reload

Related tutorial recommendations:

centos tutorial

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn