update
This commit is contained in:
parent
d8ca8b4795
commit
848c24b7fd
@ -6,19 +6,22 @@ tags: ["centos", "mariadb", "二进制"]
|
|||||||
categories: ["database"]
|
categories: ["database"]
|
||||||
---
|
---
|
||||||
|
|
||||||
环境:centos 5.4/6.2/6.5/7.2 x64
|
## 环境
|
||||||
|
- centos 5.4/6.2/6.5/7.2 x86_64
|
||||||
|
|
||||||
1、下载官方编译好的 linux 通用安装包,解压之自定义目录(如/opt)下
|
## 安装
|
||||||
|
1. 下载官方编译好的 linux 通用安装包,解压之自定义目录(如/opt)下
|
||||||
```bash
|
```bash
|
||||||
# rhel 7 地址:
|
# rhel 7 地址:
|
||||||
wget https://mirrors.tuna.tsinghua.edu.cn/mariadb//mariadb-10.1.19/bintar-linux-glibc_214-x86_64/mariadb-10.1.19-linux-glibc_214-x86_64.tar.gz
|
wget https://mirrors.tuna.tsinghua.edu.cn/mariadb//mariadb-10.1.19/bintar-linux-glibc_214-x86_64/mariadb-10.1.19-linux-glibc_214-x86_64.tar.gz
|
||||||
# rhel 5/6 地址:
|
# rhel 5/6 地址:
|
||||||
wget https://mirrors.tuna.tsinghua.edu.cn/mariadb//mariadb-10.1.19/bintar-linux-x86_64/mariadb-10.1.19-linux-x86_64.tar.gz
|
wget https://mirrors.tuna.tsinghua.edu.cn/mariadb//mariadb-10.1.19/bintar-linux-x86_64/mariadb-10.1.19-linux-x86_64.tar.gz
|
||||||
tar zxf mariadb-10.1.19-linux*-x86_64.tar.gz -C /opt/
|
tar zxf mariadb-10.1.19-linux*-x86_64.tar.gz -C /opt/
|
||||||
cd /opt;mv mariadb-10.1.19-linux* mariadb
|
cd /opt
|
||||||
|
mv mariadb-10.1.19-linux* mariadb
|
||||||
```
|
```
|
||||||
|
|
||||||
2、创建服务文件和配置文件,创建日志目录
|
2. 创建服务文件和配置文件,创建日志目录
|
||||||
```bash
|
```bash
|
||||||
cd /opt/mariadb
|
cd /opt/mariadb
|
||||||
mv support_files/my-large.cnf ./my.cnf
|
mv support_files/my-large.cnf ./my.cnf
|
||||||
@ -26,7 +29,7 @@ categories: ["database"]
|
|||||||
mkdir -p log
|
mkdir -p log
|
||||||
```
|
```
|
||||||
|
|
||||||
3、修改服务文件 mysqld
|
3. 修改服务文件 mysqld
|
||||||
```
|
```
|
||||||
vim /opt/mariadb/mysqld
|
vim /opt/mariadb/mysqld
|
||||||
# 在打开的文件中,修改开头的basedir和datadir,datadir是数据库文件目录,建议指定一个大分区中的目录
|
# 在打开的文件中,修改开头的basedir和datadir,datadir是数据库文件目录,建议指定一个大分区中的目录
|
||||||
@ -37,7 +40,7 @@ categories: ["database"]
|
|||||||
lock-file-path="$lockdir/mysql.lock"
|
lock-file-path="$lockdir/mysql.lock"
|
||||||
```
|
```
|
||||||
|
|
||||||
4、修改配置文件 /opt/mariadb/my.cnf
|
4. 修改配置文件 /opt/mariadb/my.cnf
|
||||||
```ini
|
```ini
|
||||||
[mysqld]
|
[mysqld]
|
||||||
datadir=/mnt/sdb1/mariadb_db
|
datadir=/mnt/sdb1/mariadb_db
|
||||||
@ -53,18 +56,18 @@ categories: ["database"]
|
|||||||
#如果系统中存在 /etc/my.cnf 且不可写, 可以在 /opt/mariadb/my.cnf 中重新设置冲突项。
|
#如果系统中存在 /etc/my.cnf 且不可写, 可以在 /opt/mariadb/my.cnf 中重新设置冲突项。
|
||||||
```
|
```
|
||||||
|
|
||||||
5、修改数据库程序数据目录的权限:
|
5. 修改数据库程序数据目录的权限:
|
||||||
```bash
|
```bash
|
||||||
chown mysql.mysql /opt/mariadb/ -R
|
chown mysql.mysql /opt/mariadb/ -R
|
||||||
chown mysql.mysql /mnt/sdb1/mariadb_db/ -R
|
chown mysql.mysql /mnt/sdb1/mariadb_db/ -R
|
||||||
```
|
```
|
||||||
|
|
||||||
6、安装数据库
|
6. 安装数据库
|
||||||
```bash
|
```bash
|
||||||
/opt/mariadb/scripts/mysql_install_db --basedir=/opt/mariadb --datadir=/mnt/sdb1/mariadb_db --user=mysql
|
/opt/mariadb/scripts/mysql_install_db --basedir=/opt/mariadb --datadir=/mnt/sdb1/mariadb_db --user=mysql
|
||||||
```
|
```
|
||||||
|
|
||||||
7、根据提示,修改mariadb的root帐号密码,禁用root登陆,删除匿名用户及test库
|
7. 根据提示,修改mariadb的root帐号密码,禁用root登陆,删除匿名用户及test库
|
||||||
```bash
|
```bash
|
||||||
# 启动 mariadb
|
# 启动 mariadb
|
||||||
/opt/mariadb/mysqld start
|
/opt/mariadb/mysqld start
|
||||||
@ -74,7 +77,7 @@ categories: ["database"]
|
|||||||
/opt/mariadb/bin/mysql_secure_install --basedir=/opt/mariadb
|
/opt/mariadb/bin/mysql_secure_install --basedir=/opt/mariadb
|
||||||
```
|
```
|
||||||
|
|
||||||
8、增加系统动态库配置
|
8. 增加系统动态库配置
|
||||||
```bash
|
```bash
|
||||||
echo '/opt/mariadb/lib' >> /etc/ld.so.conf
|
echo '/opt/mariadb/lib' >> /etc/ld.so.conf
|
||||||
ldconfig
|
ldconfig
|
||||||
|
Loading…
x
Reference in New Issue
Block a user