Mariadb 10.0.38 编译安装基于 Centos Ubuntu类似 就不贴具体操作了,基本一样 安装相关依赖包即可。
Mariadb 10.0.38 编译安装
1、下载源码包Mariadb源码包下载
2、安装基础环境
1
2
|
yum groupinstall -y Development Tools
yum -y install ncurses-devel zlib-devel
|
3、编译
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
cmake \
-DCMAKE_INSTALL_PREFIX=/opt/ops/mariadb \
-DMYSQL_DATADIR=/opt/ops/mariadb/data \
-DSYSCONFDIR=/opt/ops/mariadb \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/opt/ops/mariadb/data/mysql.sock \
-DMYSQL_TCP_PORT=8105 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
#编译并且安装
make && make install
|
4、生成mysql的配置文件
1
|
cp /opt/ops/mariadb/support-files/my-medium.cnf /opt/ops/mariadb/my.cnf
|
5、修改mysql配置文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
vim /opt/ops/mariadb/my.cnf #在mysqld标签下加上以下内容
lower_case_table_names = 1
character-set-server=utf8
key_buffer_size = 64M
max_allowed_packet = 10M
table_open_cache = 256
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 1M
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 16M
max_connections=3000
thread_cache_size=1000
max_connect_errors=200
interactive_timeout=600
wait_timeout=3600
innodb_buffer_pool_size=1000M
read_buffer_size = 256K
query_cache_type = 1
query_cache_limit = 512K
query_cache_min_res_unit = 2k
query_cache_size=32M
tmp_table_size=64M
open_files_limit = 65535
|
6、初始化数据库
1
|
/opt/ops/mariadb/scripts/mysql_install_db --user=mysql --datadir=/opt/ops/mariadb/data/
|
7、生成Mariadb的启动脚本
1
|
cp /opt/ops/mariadb/support-files/mysql.server /opt/ops/mariadb/mysqld
|
8、将安装目录授权给mysql用户
1
|
chown -R mysql:mysql /opt/ops/mariadb
|
9、启动 Mariadb
1
|
/opt/ops/mariadb/mysqld start
|
10、设置用户密码
1
|
/opt/ops/mariadb/bin/mysqladmin -u root password 'ops123'
|
11、授权在任意地方登陆
1
|
grant all on *.* to 'root'@'%' identified by 'ops123';
|
12、刷新授权