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

How to download mysql on centos

王林
Release: 2020-04-04 09:15:22
Original
3559 people have browsed it

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
Copy after login

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
Copy after login

Then start installing the MySQL server.


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

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
Copy after login

Check the running status of MySQL

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

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
Copy after login

Enter the database with the following command:

[root@localhost ~]# mysql -uroot -p
Copy after login

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';
Copy after login

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
Copy after login

Then reload

[root@localhost ~]# firewall-cmd --reload
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template