一、安装mysql
1)查看是否有安装源
rpm -qa|grep mysql
centos7安装的新机器一般是没有安装源的
2)添加安装源
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm rpm -ivh mysql-community-release-el7-5.noarch.rpm
3)查看安装源
[root@cmdb tools]# rpm -qa|grep mysql mysql-community-release-el7-5.noarch [root@cmdb tools]# ll /etc/yum.repos.d/ total 36 -rw-r--r--. 1 root root 1664 Aug 30 2017 CentOS-Base.repo -rw-r--r--. 1 root root 1309 Aug 30 2017 CentOS-CR.repo -rw-r--r--. 1 root root 649 Aug 30 2017 CentOS-Debuginfo.repo -rw-r--r--. 1 root root 314 Aug 30 2017 CentOS-fasttrack.repo -rw-r--r--. 1 root root 630 Aug 30 2017 CentOS-Media.repo -rw-r--r--. 1 root root 1331 Aug 30 2017 CentOS-Sources.repo -rw-r--r--. 1 root root 3830 Aug 30 2017 CentOS-Vault.repo -rw-r--r-- 1 root root 1209 Jan 29 2014 mysql-community.repo -rw-r--r-- 1 root root 1060 Jan 29 2014 mysql-community-source.repo
4)yum安装 。yum install mysql-server -y
5)启动测试
[root@cmdb tools]# systemctl restart mysqld.service [root@cmdb tools]# mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.6.42 MySQL Community Server (GPL) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
浙公网安备 33010602011771号