运维mysql安装⽬录规范_MySQL运维---⼆进制安装⼀、MySql安装⽅法
⼆、⼆进制安装Mysql
1、下载mysql-5.6.40⼆进制⽂件
2、解压
tar -zxvf mysql-5.6.40-linux-glibc2.12-x86_
3、创建安装⽬录,并把mysql移动⾄安装⽬录
mkdir /applicationmv mysql-5.6.40-linux-glibc2.12-x86_64 /application/mysql-5.6.40
4、创建软连接
ln -s /application/mysql-5.6.40/ /application/mysql
5、进⼊脚本以及配置⽂件⽬录,并拷贝配置⽂件、启动脚本
cd /application/mysql/support-files/
cp my-defaultf /etc/myf
cp mysql.server /etc/init.d/mysqld
6、进⼊
cd /application/mysql/scripts/
useradd mysql -s /sbin/nologin -M 创建mysql⽤户,不允许登录,不指定家⽬录
./mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data 初始化mysql 报错1:
报错原因:执⾏初始化报错缺少Perl模块
解决⽅法:安装Perl模块,再次初始化。
yum install autoconf -y
报错2:
报错原因:环境问题
解决办法:装完依赖,在解压,要是还不⾏,再装⼀个依赖
yum install -y gcc-c++ gcc glibc
linux安装oracle依赖包报错3:
报错原因:执⾏初始化报错缺少libaio包
解决办法:安装依赖libaio包
yum install -y libaio-devel
安装完成,再次初始化
⼆、启动mysql
1、先授权
chown -sql /application/mysql*
2、启动mysql
[root@controller mysql]# /etc/init.d/mysqld start
报错:
报错原因:安装⽬录我们的是/application/,和默认的/usr/local,不⼀致。
3、修改配置⽂件⾥⾯的安装⽬录
[root@controller mysql]# sed -i 's#/usr/local#/application#g' /etc/init.d/mysqld /application/mysql/bin/mysqld_safe 修改完成,再次启动
启动成功,它会告诉你mysql错误⽇志会记录在/application/mysql/⾥⾯
三、添加环境变量
1、创建环境变量脚本
[root@controller ~]# vim /etc/profile.d/mysql.sh
export PATH="/application/mysql/bin:$PATH"
2、重新加载⼀下
source /etc/profile
3、登录mysql
[root@controller ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection idis 1Server version:5.6.40MySQL Community Server (GPL) Copyright (c)2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracleis a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type'help;' or '\h' for help. Type '\c'to clear the current input statement.
mysql>
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论