环境:
- CentOS Linux release 7.6.1810 (Core)
- mariadb:10.4.7
安装过程中我是使用root用户操作的。
依赖
离线安装不容易啊,按照官方文档:Installing MariaDB With the rpm Tool 的意思,是需要jemalloc
、MariaDB*
、galera
等,但是我只用到了下面的依赖,没有装jemalloc*
。文件可以自行 Google,总结就是,缺什么装什么。
boost-program-options-1.53.0-27.el7.x86_64.rpm(galera需要)
galera-4-26.4.0-1.rhel7.el7.centos.x86_64.rpm
perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm
perl-Data-Dumper-2.145-3.el7.x86_64.rpm
perl-DBI-1.627-4.el7.x86_64.rpm
perl-IO-Compress-2.061-2.el7.noarch.rpm
perl-Net-Daemon-0.48-5.el7.noarch.rpm
perl-PlRPC-0.2020-14.el7.noarch.rpm
perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm
下载
下载地址:http://downloads.mariadb.org/ ,选择适合自己的镜像地址进行下载。
MariaDB-client-10.4.7-1.el7.centos.x86_64.rpm
MariaDB-devel-10.4.7-1.el7.centos.x86_64.rpm
MariaDB-server-10.4.7-1.el7.centos.x86_64.rpm
MariaDB-shared-10.4.7-1.el7.centos.x86_64.rpm
标准的服务端至少要下载client、shared和server,点击这里 查看各个rpm的含义。
卸载旧版本Mysql
安装之前,旧版本的MYSQL会与MariaDB有冲突,因此需要先卸载MYSQL。检查是否安装:
rpm -qa 'mysql*'
安装依赖
使用下面的命令安装上面下载好的依赖
rpm -ivh boost-program-options-1.53.0-27.el7.x86_64.rpm
rpm -ivh galera-4-26.4.0-1.rhel7.el7.centos.x86_64.rpm
rpm -ivh perl*
安装MariaDB
rpm -ivh MariaDB-*
启动服务
systemctl start mariadb #立刻启动
systemctl enable mariadb #开机启动
systemctl status mariadb #查看服务状态
设置root密码
/usr/bin/mysqladmin -u root password '1234567890'
通过修改mysql
数据库,配置实现远程连接:
[root@localhost seafile-env]# /usr/bin/mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.4.7-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)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> grant all privileges on *.* to root@'localhost' identified by "Passw0rd";
Query OK, 0 rows affected (0.098 sec)
MariaDB [mysql]> grant all privileges on *.* to root@'%' identified by "Passw0rd";
Query OK, 0 rows affected (0.028 sec)
MariaDB [mysql]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)
MariaDB [mysql]> grant all privileges on *.* to inspur@'10.47.0.172' identified by "Passw0rd";
Query OK, 0 rows affected (0.109 sec)
MariaDB [mysql]> grant all privileges on *.* to inspur@'10.47.0.172' identified by "Passw0rd";
Query OK, 0 rows affected (0.093 sec)
MariaDB [mysql]> grant all privileges on *.* to inspur@'%' identified by "Passw0rd";
Query OK, 0 rows affected (0.138 sec)
MariaDB [mysql]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.003 sec)
测试连接
如果连接失败,可能是防火墙端口没有开放的原因,默认端口是3306,参考这篇文章:CentOS开放端口的方法,对端口进行放开。
错误及解决
错误1:
1)信息
error: Failed dependencies:
MariaDB-compat is needed by MariaDB-common-10.4.7-1.el7.centos.x86_64
galera-4 is needed by MariaDB-server-10.4.7-1.el7.centos.x86_64
perl(Data::Dumper) is needed by MariaDB-server-10.4.7-1.el7.centos.x86_64
perl(DBI) is needed by MariaDB-server-10.4.7-1.el7.centos.x86_64
2)解决
yum remove mariadb-libs -y
最新评论
网飞没问题, 迪士尼+有解决方案么?
pp助手是安卓手机用的,根本下载用不来苹果
已解决
这样的话数据库里的结构为{"attachment":{"content":"xxx"}}, 要怎么才能变成{"content":"xxx"},从而使结构保持一致?
赞! make test不过的坑都写到的,谢谢楼主~
谢谢你
用了root用户还是一直502是怎么回事呢
student id 是空的