安装环境:腾讯云服务器+CentOS7
1、下载mysql源安装包
[root@VM_0_14_centos~]#
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
# 安装mysql源
[root@VM_0_14_centos~]#
yum localinstall mysql57-community-release-el7-8.noarch.rpm
检查mysql源是否安装成功
[root@VM_0_14_centos~]#
yum repolist enabled |grep "mysql.*-community.*"
看到上图所示表示安装成功。
2、安装MySQL
[root@VM_0_14_centos~]#
yum install mysql-community-server
3、启动MySQL服务
[root@VM_0_14_centos~]#
systemctl start mysqld
查看MySQL的启动状态
[root@VM_0_14_centos~]#
systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded(/usr/lib/systemd/system/mysqld.service;disabled; vendor preset: disabled)
Active: active (running) since 五 2016-06-2404:37:37 CST; 35min ago
Main PID: 2888 (mysqld)
CGroup: /system.slice/mysqld.service
└─2888 /usr/sbin/mysqld --daemonize--pid-file=/var/run/mysqld/mysqld.pid
6月 2404:37:36localhost.localdomain systemd[1]: Starting MySQL Server...
6月 2404:37:37localhost.localdomain systemd[1]: Started MySQL Server.
4、开机启动
[root@VM_0_14_centos~]#
systemctl enable mysqld
[root@VM_0_14_centos~]#
systemctl daemon-reload
5、登陆MySQL数据库
用户名:root 密码:123456
[root@VM_0_14_centos ~]# mysql -uroot -p
Enterpassword:123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.7.21 MySQL CommunityServer (GPL)
Copyright (c) 2000, 2018, Oracle and/or itsaffiliates. All rights reserved.
Oracle is a registered trademark of OracleCorporation and/or its
affiliates. Other names may be trademarksof their respective
owners.
Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.
至此,在CentOS7环境下安装MySQL服务器就已完成。