安装mysql和mariadb端口_mariadb安装(查看端口开放命令)

b1c0bae27418b749bd19c1c32dac5c8f.png

1a6296c3d70c1538b9cde9e9a04f0ee5.png

1.mariadb源配置

[root@localhost yum.repos.d]# vim mariadb.repo

[root@localhost yum.repos.d]#cat mariadb.repo

[mariadb]

name = MariaDB

baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.4/centos7-amd64

gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB

gpgcheck=1

[root@localhost yum.repos.d]# yum clean all && yum makecache

2.mariadb安装

[root@localhost yum.repos.d]# yum install MariaDB-server MariaDB-client  -y

73ac30e8a8c5d124546852051776cd3e.png

[root@localhost yum.repos.d]#systemctl start mariadb

3.2mariadb进程查看

[root@localhost yum.repos.d]# netstat -ntlp |grep 3306

[root@localhost yum.repos.d]# mysql_secure_installation

686639206d92ebc50adfe87afc19cf13.png

Switch to unix_socket authentication [Y/n]

输入y

Change the root password? [Y/n] y

密码:uK8F8cECIDvv

995be423fa6f8fd8c841cfb22dc4a18c.png

e4fc71827f3ca31d050c1d954e0c791d.png

MariaDB [(none)]> set password = PASSWORD('hsz123');           修改mysql密码

MariaDB [(none)]> create database mytest charset=utf8;              创建数据库mytest,并指定默认字符集为utf8

MariaDB [(none)]> use mytest;               切换数据库

Database changed

MariaDB [mytest]> create table mytest(id int,name char(32));创建表

Query OK, 0 rows affected (0.014 sec)

MariaDB [mytest]> desc mytest;                       查看表结构,有id,name,   其中int和char表示数据类型

+-------+----------+------+-----+---------+-------+

| Field | Type | Null | Key | Default | Extra |

+-------+----------+------+-----+---------+-------+

| id | int(11) | YES | | NULL | |

| name | char(32) | YES | | NULL | |

+-------+----------+------+-----+---------+-------+

2 rows in set (0.009 sec)

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值