码迷,mamicode.com
首页 > 数据库 > 详细

ubuntu安装二进制mariadb

时间:2017-10-31 14:11:22      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:linux mysql


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安装二进制mariadb

标签:linux mysql

原文地址:http://11408933.blog.51cto.com/11398933/1977725

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!