ubuntu安装二进制mariadb

前端之家收集整理的这篇文章主要介绍了ubuntu安装二进制mariadb前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。


root@sun-virtual-machine:/opt# mkdir /mydata/data -pv
root@sun-virtual-machine:/opt# groupadd -r MysqL

root@sun-virtual-machine:/opt# useradd -g MysqL -r -s /sbin/nologin -M -d /mydata/data MysqL

-r,--system 创建一个系统账户

-s,--shell SHELL新账户的登录 shell

-M,--no-create-home不创建用户的主目录

-d,--home-dir HOME_DIR 新账户的主目录

-g,--gid GROUP新账户主组的名称或 ID

root@sun-virtual-machine:/# chown -R MysqL:MysqL /mydata/data

root@sun-virtual-machine:/# tar xf /root/mariadb-10.0.28-linux-glibc_214-x86_64.tar.gz -C /usr/local

root@sun-virtual-machine:/# cd /usr/local

root@sun-virtual-machine:/usr/local# ln -sv mariadb-10.0.28-linux-x86_64 MysqL

root@sun-virtual-machine:/usr/local/MysqL# cd MysqL

root@sun-virtual-machine:/usr/local/MysqL# chown -R MysqL:MysqL .

root@sun-virtual-machine:/usr/local/MysqL# apt-get install libaio-dev 安装之后才能初始化成功 否则报错缺少它

root@sun-virtual-machine:/usr/local/MysqL# scripts/MysqL_install_db --user=MysqL --datadir=/mydata/data

root@sun-virtual-machine:/usr/local/MysqL# chown -R root .

root@sun-virtual-machine:/usr/local/MysqL# cp support-files/my-large.cnf /etc/my.cnf

修改文件中thread_concurrency的值为你的cpu个数乘以2,比如这里使用如下行:

thread_concurrency = 2

另外还需要添加如下行指定MysqL数据文件的存放位置:

datadir = /mydata/data

root@sun-virtual-machine:/usr/local/MysqL# cp support-files/MysqL.server /etc/init.d/MysqLd

root@sun-virtual-machine:/usr/local/MysqL# chmod +x /etc/init.d/MysqLd

root@sun-virtual-machine:/usr/local/MysqL# /lib/systemd/systemd-sysv-install enable MysqLd

root@sun-virtual-machine:/usr/local/MysqL# systemctl start MysqLd

在开机时启用一个服务:systemctl enable postfix.service
在开机时禁用一个服务:systemctl disable postfix.service
查看服务是否开机启动:systemctl is-enabled postfix.service
查看已启动的服务列表:systemctl list-unit-files|grep enabled
查看启动失败的服务列表:systemctl --Failed

猜你在找的Ubuntu相关文章