Linux使用二进制文件进行安装mysql

使用源码安装比较费时间,推荐使用二进制文件进行安装(好想也费下载的时间,不过50M带宽表示无压力)

1、下载

wget https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz

没有wget命令使用yum install wget -y 安装

2、解压并copy

tar zxvf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz

cp mysql-5.6.39-linux-glibc2.12-x86_64 /usr/local/mysql -r

3、进入文件夹

cd /usr/local/mysql/

4、添加系统mysql组和mysql用户

grouped mysql

useradd -r -g mysql mysql

5、修改当前目录拥有者为mysql用户

 chown -R mysql:mysql ./

6、 安装数据库

./scripts/mysql_install_db --user=mysql

6.1如果出现Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

说明确实依赖包libaio

使用yum 安装

yum install libaio-devel.x86_64 -y

6.2如果出现 FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db:

使用yum安装

yum-y install autoconf

7、修改当前目录拥有者为root用户

 chown -R root:root ./

8、修改当前data目录拥有者为mysql用户

chown -R mysql:mysql data

9、添加软连接,这样就可以直接使用msyql

ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql

10、添加开机启动

cp support-files/mysql.server /etc/init.d/mysql

11、启动mysql服务

service mysql start

12、测试

mysql -uroot -p

成功

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.31 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>

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值