MySQL二进制分发安装
Posted 数据库小学生
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL二进制分发安装相关的知识,希望对你有一定的参考价值。
操作系统:Red Hat Enterprise Linux Server release 6.5
mysql安装包:mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz
1. Linux中创建mysql组和mysql用户
[[email protected] ~]# groupadd -g 1000 mysql
[[email protected] ~]# useradd mysql -g mysql -p mysql
2. 上传安装包到/usr/local目录下
---上传过程略---
3. 解压安装包
[[email protected] local]# tar -zxvf mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz
4. 把解压后安装包名称改为‘mysql‘
[[email protected] local]# mv mysql-5.6.34-linux-glibc2.5-x86_64 mysql
5. 授权:解压的文件属主属组改为root:root,其中data改为mysql:mysql
[[email protected] ~]# cd /usr/local/mysql
[[email protected] mysql]# chown root:root *
[[email protected] mysql]# chown mysql:mysql data
[[email protected] mysql]# ll
total 68
drwxr-xr-x. 2 root root 4096 Jan 9 22:26 bin
-rw-r--r--. 1 root root 17987 Sep 30 19:41 COPYING
drwxr-xr-x. 3 mysql mysql 4096 Jan 9 22:26 data
drwxr-xr-x. 2 root root 4096 Jan 9 22:26 docs
drwxr-xr-x. 3 root root 4096 Jan 9 22:26 include
drwxr-xr-x. 3 root root 4096 Jan 9 22:26 lib
drwxr-xr-x. 4 root root 4096 Jan 9 22:26 man
drwxr-xr-x. 10 root root 4096 Jan 9 22:26 mysql-test
-rw-r--r--. 1 root root 2496 Sep 30 19:41 README
drwxr-xr-x. 2 root root 4096 Jan 9 22:26 scripts
drwxr-xr-x. 28 root root 4096 Jan 9 22:26 share
drwxr-xr-x. 4 root root 4096 Jan 9 22:26 sql-bench
drwxr-xr-x. 2 root root 4096 Jan 9 22:26 support-files
6. 初始化 建立授权表
[[email protected] ~]# cd /usr/local/mysql
[[email protected] mysql]# scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data
7. 编辑配置文件
[[email protected] ~]# cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
[[email protected] ~]# vi /etc/my.cnf
---修改其中的如下内容---
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306
8. 映射mysql和mysqladmin目录
[[email protected] ~]# cd /usr/local/bin
[[email protected] bin]# ln -fs /usr/local/mysql/bin/mysql mysql
[[email protected] bin]# ln -fs /usr/local/mysql/bin/mysqladmin mysqladmin
##标红部分为MySQL的实际安装目录,根据实际目录修改
9. 拷贝mysql.server启动脚本到init.d目录下
[[email protected] ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
10. 启动MySQL Servier
[[email protected] bin]# service mysql start
11. 修改root用户的密码
[[email protected] ~]# mysqladmin -uroot password
12. 连接MySQL Server
[[email protected] bin]# mysql -u root -p
The End!
2017-08-17
以上是关于MySQL二进制分发安装的主要内容,如果未能解决你的问题,请参考以下文章
手把手教你在windows上安装mysql8.0最新版本数据库,保姆级教学