Centos7.1部署mysql-5.6.34(笔记)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7.1部署mysql-5.6.34(笔记)相关的知识,希望对你有一定的参考价值。
这里安装我用的的是mysql二进制包,主要减少编译安装的时间,当然快的还有yum的安装方式。
mysql个版本下载地址:http://mirrors.sohu.com/mysql/
1、解决相关依赖问题,否则初始化数据库会出现错误
yum install -y perl-Module-Install.noarch libaio*
2、解压软件包到/usr/local/src
tar xf mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz -C /usr/local/src/
3、设置mysql
cd /usr/local/src/mysql-5.6.34-linux-glibc2.5-x86 ln -sv /usr/local/src/mysql-5.6.34-linux-glibc2.5-x86_64 /usr/local/mysql cd /usr/local/mysql/
#创建用户给予权限
useradd mysql -s /sbin/nologin chown -R mysql.mysql ./* –R
#创建mysql的数据目录
mkdir /data/mysql && chown mysql.mysql /data/mysql –R
#初始化mysql
/usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/data/mysql --basedir=/usr/local/mysql/
#拷贝mysql的启动文件以及配置文件
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql cp /usr/local/mysql/my.cnf /etc/my.cnf
#设置mysql的环境变量
ln -sv /usr/local/mysql/bin/mysql /usr/bin/
#最后启动mysql即可
/etc/init.d/mysql restart
#访问mysql
[[email protected] ~]# /usr/local/mysql/bin/mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 5.6.34 MySQL Community Server (GPL) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is 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>
以上是关于Centos7.1部署mysql-5.6.34(笔记)的主要内容,如果未能解决你的问题,请参考以下文章