CentOS7安装MySQL教程

安装环境:腾讯云服务器+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

 

62404:37:36localhost.localdomain systemd[1]: Starting MySQL Server...

62404: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服务器就已完成。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值