ubuntu安装二进制mariadb

来源:转载


[email protected]:/opt# mkdir /mydata/data [email protected]:/opt# groupadd -r mysql

[email protected]:/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

[email protected]:/# chown -R mysql:mysql /mydata/data

[email protected]:/# tar xf /root/mariadb-10.0.28-linux-glibc_214-x86_64.tar.gz -C /usr/local

[email protected]:/# cd /usr/local

[email protected]:/usr/local# ln -sv mariadb-10.0.28-linux-x86_64 mysql

[email protected]:/usr/local/mysql# cd mysql

[email protected]:/usr/local/mysql# chown -R mysql:mysql .

[email protected]:/usr/local/mysql# apt-get install libaio-dev 安装之后才能初始化成功 否则报错缺少它

[email protected]:/usr/local/mysql# scripts/mysql_install_db --user=mysql --datadir=/mydata/data

[email protected]:/usr/local/mysql# chown -R root .

[email protected]:/usr/local/mysql# cp support-files/my-large.cnf /etc/my.cnf

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

thread_concurrency = 2

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

datadir = /mydata/data

[email protected]:/usr/local/mysql# cp support-files/mysql.server /etc/init.d/mysqld

[email protected]:/usr/local/mysql# chmod +x /etc/init.d/mysqld

[email protected]:/usr/local/mysql# /lib/systemd/systemd-sysv-install enable mysqld

[email protected]:/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


分享给朋友:
您可能感兴趣的文章:
随机阅读: