[root@cn7]/# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) [root@cn7]/# uname -a Linux cn7 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
安装mariadb:
1
[root@cn7]/# yum -y install mariadb-server
开启mariadb并设置开机启动:
1 2 3
[root@cn7]/# systemctl start mariadb [root@cn7]/# systemctl enable mariadb Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
配置数据库
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
[root@cn7]/# mysql_secure_installation Enter current password for root (enter for none): # 输入数据库超级管理员root的密码(注意不是系统root的密码),第一次进入还没有设置密码则直接回车
Set root password? [Y/n] # 设置密码,y
New password: # 新密码 Re-enter new password: # 再次输入密码
[root@cn7]/# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 5.5.68-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | +--------------------+ 3 rows in set (0.00 sec)