linux中mysql的安装

linux中mysql的安装


mysql安装方式有三种:

  • 源代码:编译安装
  • 二进制格式的程序包:展开至特定路径,并经过简单配置后即可使用(常见的以tar.gz结尾)
  • 程序包管理器管理的程序包(yum或dnf方式安装):
    • rpm:有两种
      • OS Vendor:操作系统发行商提供的
      • 项目官方提供的
    • deb
  • docker部署,生产环境数据库一般不使用容器部署,但作为测试的快速部署很方便

安装方式总结:

yum安装mysql

二进制安装mysql

源码安装mysql

docker部署

[root@localhost ~]# docker run -itd --name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7.30
Unable to find image 'mysql:5.7.30' locally
5.7.30: Pulling from library/mysql
8559a31e96f4: Pull complete
d51ce1c2e575: Pull complete
c2344adc4858: Pull complete
fcf3ceff18fc: Pull complete
16da0c38dc5b: Pull complete
b905d1797e97: Pull complete
4b50d1c6b05c: Pull complete
d85174a87144: Pull complete
a4ad33703fa8: Pull complete
f7a5433ce20d: Pull complete
3dcd2a278b4a: Pull complete
Digest: sha256:32f9d9a069f7a735e28fd44ea944d53c61f990ba71460c5c183e610854ca4854
Status: Downloaded newer image for mysql:5.7.30
669eddc896b9d0603e790ac2de173e584f287d9d9f864a86360e277fef12e74c
[root@localhost ~]# ss -tanl
State       Recv-Q Send-Q                     Local Address:Port                                    Peer Address:Port
LISTEN      0      100                            127.0.0.1:25                                                 *:*
LISTEN      0      128                                    *:3306                                               *:*
LISTEN      0      128                                    *:22                                                 *:*
LISTEN      0      100                                [::1]:25                                              [::]:*
LISTEN      0      128                                 [::]:22                                              [::]:*

登录

[root@localhost ~]# mysql -uroot -h127.0.0.1 -p123456
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.30 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]>

posted @ 2021-01-27 09:45  EverEternity  阅读(190)  评论(0编辑  收藏  举报