[MYSQL] Database yum installation method!

Turn off the firewall and selinux
mysql's official website: www.mysql.com

Show some below 内联代码片.

1. Download

[root@mysql-server ~]# wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

Or download to the local and upload to the server

2. Install mysql yum warehouse

[root@mysql-server ~]# rpm -ivh mysql80-community-release-el7-3.noarch.rpm
[root@mysql-server ~]# yum -y install yum-utils    #安装yum工具包

3. Configure yum source

[root@mysql-server ~]# vim /etc/yum.repos.d/mysql-community.repo   #修改如下

Insert picture description here
1 means on, 0 means off
or

# yum-config-manager --enable mysql57-community   将禁用的yum源库启用
# yum-config-manager --disable mysql80-community   将启用的yum源库禁用

4. Install the database

[root@mysql-server ~]# yum install -y mysql-community-server
[root@mysql-server ~]# systemctl start mysqld     #启动服务
[root@mysql-server ~]# systemctl enable mysqld      #设置开机启动

5. Find the password. The
password is saved in the log file

[root@mysql-server ~]# grep password /var/log/mysqld.log
2020-11-19T14:03:51.991454Z 1 [Note] A temporary password is generated for root@localhost: woHtkMgau9,w

6. Modify password

[root@mysql-server ~]# mysqladmin -u root -p'woHtkMgau9,w' password 'ABCabc@123'

The command is: mysqladmin -u root -p'old password' password'new password'
Note: The modified password must have uppercase and lowercase numbers and special symbols.

7. Log in to the database

[root@mysql-server ~]# mysql -uroot -p'ABCabc@123'

Guess you like

Origin blog.csdn.net/qq_30566629/article/details/109817722