mariadb安装

史玉全 2023-8-1 98 8/1

yum安装Mariadb-10.3.37

 

以下命令全部都是linux命令。

1. 检查是否已经安装mariadb

rpm -qa | grep mariadb

出现mariadb-libs-5.5.60-2.el7.x86_64这个,表示已经安装,需要先卸载。

2. 卸载已经安装了的mariadb

rpm -e mariadb-libs-5.5.60-2.el7.x86_64 --nodeps

3. 配置yum源

vi /etc/yum.repos.d/MariaDB.repo

输入以下内容

  1. # MariaDB 10.3.37 CentOS repository list - created 2022-11-23 16:17 UTC
  2. # http://downloads.mariadb.org/mariadb/repositories/
  3. [mariadb]
  4. name = MariaDB
  5. baseurl = https://mirror.mariadb.org/yum/10.3.37/centos7-amd64/
  6. gpgkey= https://mirror.mariadb.org/yum/RPM-GPG-KEY-MariaDB
  7. gpgcheck=1
  8. skip_if_unavailable = 1
  9. keepcache = 0

4. 更新yum源

  1. yum makecache
  2. yum update

5. 安装mariadb

yum -y install MariaDB-server MariaDB-client

6. 启动mariadb

  1. systemctl start mariadb
  2. 设置开机启动
  3. systemctl enable mariadb

7. 进入mariadb

  1. mysql_secure_installation
  2. #首先是设置密码,会提示先输入密码
  3. Enter current password for root (enter for none):<–初次运行直接回车
  4. #设置密码
  5. Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
  6. New password: <– 设置root用户的密码
  7. Re-enter new password: <– 再输入一次你设置的密码
  8. #其他配置
  9. Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车
  10. Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车,
  11. Remove test database and access to it? [Y/n] <– 是否删除test数据库,回车
  12. Reload privilege tables now? [Y/n] <– 是否重新加载权限表,回车
  13. #初始化MariaDB完成,接下来测试登录
  14. #登录
  15. mysql -u root -p你设置的密码
mariadb安装

8. 远程授权

grant all privileges on *.* to 'root'@'%' identified by 'root123.' with grant option;
- THE END -
最后修改:2023年8月1日
0

非特殊说明,本博所有文章均为博主原创。