千家信息网

怎么用二进制包安装mysql

发表于:2026-11-04 作者:千家信息网编辑
千家信息网最后更新 2026年11月04日,这篇文章主要讲解了"怎么用二进制包安装mysql",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习"怎么用二进制包安装mysql"吧!目的本文主要讲述如何使
千家信息网最后更新 2026年11月04日怎么用二进制包安装mysql

这篇文章主要讲解了"怎么用二进制包安装mysql",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习"怎么用二进制包安装mysql"吧!

目的

本文主要讲述如何使用二进制安装mysql,并启动mysql

1、mysql安装包的下载

https://dev.mysql.com/downloads/mysql/

2、安装mysql前的准备

  • 上传mysql安装包至/usr/local目录

  • 解压mysql安装包;

    [root@localhost local]# tar xvf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
  • 将解压后的文件夹连接至mysql文件夹

    [root@localhost local]# ln -s mysql-5.6.39-linux-glibc2.12-x86_64 mysql
  • 检查并安装依赖包(perl)

    [root@localhost scripts]# yum -y install perl perl-devel perl-Data-Dumper
> 如若未安装perl组件将会报以下错误

[root@localhost scripts]# ./mysql_install_db
FATAL ERROR: please install the following Perl modules before executing ./mysql_install_db:
Data::Dumper

- 检查并安装依赖包(libaio)

[root@localhost mysql]# yum list|grep libaio
libaio.i686 0.3.109-13.el7 base
libaio.x86_64 0.3.109-13.el7 base
libaio-devel.i686 0.3.109-13.el7 base
libaio-devel.x86_64 0.3.109-13.el7 base
[root@localhost mysql]# yum -y install libaio libaio-devel

> 若如为安装libaio组件将会报以下错误

[root@localhost mysql]# scripts/mysql_install_db --user=mysql
WARNING: The host 'Alinx' could not be looked up with ./bin/resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !

Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
[root@localhost mysql]#

###  3、创建mysql用户,用户组并将目录授权给mysql用户

[root@localhost scripts]# groupadd mysql
[root@localhost scripts]# useradd -r -g mysql mysql
[root@localhost ~]# chown mysql:mysql /usr/local/mysql -R
[root@localhost ~]# ll /usr/local/
total 321180
drwxr-xr-x. 2 root root 6 Aug 12 2015 bin
drwxr-xr-x. 2 root root 6 Aug 12 2015 etc
drwxr-xr-x. 2 root root 6 Aug 12 2015 games
drwxr-xr-x. 2 root root 6 Aug 12 2015 include
drwxr-xr-x. 2 root root 6 Aug 12 2015 lib
drwxr-xr-x. 2 root root 6 Aug 12 2015 lib64
drwxr-xr-x. 2 root root 6 Aug 12 2015 libexec
lrwxrwxrwx 1 mysql mysql 35 Jan 16 22:46 mysql -> mysql-5.6.39-linux-glibc2.12-x86_64
drwxr-xr-x 13 mysql mysql 4096 Jan 16 22:38 mysql-5.6.39-linux-glibc2.12-x86_64
-rw-r--r-- 1 root root 328882304 Jan 21 2018 mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
drwxr-xr-x. 2 root root 6 Aug 12 2015 sbin
drwxr-xr-x. 5 root root 46 Jan 17 2017 share
drwxr-xr-x. 2 root root 6 Aug 12 2015 src

> 此时可以看到mysql目录的归属为mysql:mysql- 删除系统中的mysql配置文件

rm -f /etc/my.cnf
rm -fr /etc/my.cnf.d/

### 4、初始化并启动mysql- 初始化

[root@localhost mysql]# scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data --skip-name-resolve

> 该步骤为创建了一个root用户(空密码),并初始化了mysql的一些权限账户表- 拷贝配置文件以及启动脚本

[root@localhost mysql]# cp support-files/my-default.cnf /etc/my.cnf
[root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysqld

- 编辑/etc/my.cnf文件,并写入如下内容

basedir = /usr/local/mysql
datadir = /usr/local/mysql/data/

### 5、启动mysql- 启动mysql

/usr/local/mysql/support-files/mysqld start

- 为mysql数据库设置密码(跟进提示进行密码设置,部署完时密码为空)

[root@localhost mysql]# ./bin/mysql_secure_installation

- 登录数据库

[root@localhost mysql]# mysql -uroot -pAlinx

> 当前启动时候报错(发现是/etc/my.cnf未配置目录导致)

[root@localhost support-files]# /usr/local/mysql/support-files/mysql.server start
Starting MySQL.Logging to '/usr/local/mysql/data/localhost.err'.
ERROR! The server quit without updating PID file (/usr/local/mysql/data/localhost.pid).
[root@localhost support-files]#

感谢各位的阅读,以上就是"怎么用二进制包安装mysql"的内容了,经过本文的学习后,相信大家对怎么用二进制包安装mysql这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是,小编将为大家推送更多相关知识点的文章,欢迎关注!

二进制 文件 密码 用户 目录 内容 学习 配置 数据 数据库 文件夹 组件 错误 会报 检查 就是 思路 情况 拷贝 文章 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 中智农互联网科技 广州大一互联网络科技有限公司 云之行互联网科技 互联网最新的科技 中资互联网科技 北京互联网科技公司 互联网的科技创新 互联网科技logo设计 科技伦理 互联网公司 昭通互联网科技选哪家 荆州市昕露互联网络科技有限公司 呼和浩特新华互联网科技学院 互联网数据科技专业 卓翼科技产业互联网合作 恒生互联网科技业指数调整周期 四川互联网展示科技馆设计 普陀区互联网教育科技管理办法 互联网科技博主张洲 瑞安市蟠桃会互联网科技有限公司 前海云享互联网科技 互联网科技公司 易通互联网络科技有限公司 互联网科技公司介绍 互联网系的金融科技公司 内蒙古九一互联网科技 互联网科技和法律行业 锡山区互联网智能科技产品供应 山东星卡互联网科技有限公司官网 小米互联网科技园入驻 河南商务圈互联网科技有限公司
0