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
[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
Switch to unix_socket authentication [Y/n]
输入y
Change the root password? [Y/n] y
密码:uK8F8cECIDvv
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)