CentOS7在线安装Mariadb数据库详细教程!!!

1、先清除系统自带的MySQL或mariadb

rpm -aq | grep -E "mariadb|mysql" | xargs yum remove -y

2、检查是否卸载成功

rpm -aq | grep -E "mariadb|mysql"

3、查找数据库残留文件

find / -name mysql

find / -name my.cnf

find / -name mariadb

4、如果能找到下面两个数据存储目录和配置文件,则需要删除

/var/lib/mysql

/etc/my.cnf

5、安装mariadb客户端

yum install -y mariadb

6、安装mariadb服务器

yum install -y mariadb-server

7、启动mariadb服务,且开机自启动

systemctl enable --now mariadb-server

8、查看mariadb服务的状态

[root@localhost ~]# systemctl status mariadb.service 
● mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2023-08-03 08:15:23 CST; 2s ago
  Process: 1693 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
  Process: 1608 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
 Main PID: 1692 (mysqld_safe)
   CGroup: /system.slice/mariadb.service
           ├─1692 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
           └─1857 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin ...

Aug 03 08:15:21 localhost.localdomain mariadb-prepare-db-dir[1608]: MySQL manual for more instructions.
Aug 03 08:15:21 localhost.localdomain mariadb-prepare-db-dir[1608]: Please report any problems at http://mariadb....ra
Aug 03 08:15:21 localhost.localdomain mariadb-prepare-db-dir[1608]: The latest information about MariaDB is avail.../.
Aug 03 08:15:21 localhost.localdomain mariadb-prepare-db-dir[1608]: You can find additional information about the...t:
Aug 03 08:15:21 localhost.localdomain mariadb-prepare-db-dir[1608]: http://dev.mysql.com
Aug 03 08:15:21 localhost.localdomain mariadb-prepare-db-dir[1608]: Consider joining MariaDB's strong and vibrant...y:
Aug 03 08:15:21 localhost.localdomain mariadb-prepare-db-dir[1608]: https://mariadb.org/get-involved/
Aug 03 08:15:21 localhost.localdomain mysqld_safe[1692]: 230803 08:15:21 mysqld_safe Logging to '/var/log/maria...og'.
Aug 03 08:15:21 localhost.localdomain mysqld_safe[1692]: 230803 08:15:21 mysqld_safe Starting mysqld daemon wit...ysql
Aug 03 08:15:23 localhost.localdomain systemd[1]: Started MariaDB database server.
Hint: Some lines were ellipsized, use -l to show in full.

你可能感兴趣的:(数据库,系统运维,数据库,centos,mariadb)