练习二进制分发安装mysql

Posted Tomatoes

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了练习二进制分发安装mysql相关的知识,希望对你有一定的参考价值。

环境描述:

Red Hat Enterprise Linux Server release 6.5

mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz

1.创建用户和组:

[[email protected] ~]# groupadd -g 1000 mysql
[[email protected] ~]# useradd mysql -g mysql -p mysql

2.创建安装包上传目录,将安装包上传到该目录下(上传过程省略):

[[email protected] ~]# mkdir -p /usr/local/mysql

3.解压安装包,解压后安装包名称改为’mysql’:

[[email protected] local]# tar -zxvf mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz
[[email protected] local]# mv mysql-5.6.34-linux-glibc2.5-x86_64 mysql

4.解压的文件属主属组改为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

5.初始化 建立授权表:

[[email protected] ~]# cd /usr/local/mysql
[[email protected] mysql]# scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data

6.编辑配置文件:

[[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

7.映射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

8.拷贝mysql.server启动脚本到init.d目录下:

[[email protected] ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql

9.启动MySQL Servier:

[[email protected] bin]# service  mysql start

10.修改root用户的密码:

mysqladmin -uroot password

11.连接MySQL Server:

[[email protected] bin]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.6.35 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>

 

以上是关于练习二进制分发安装mysql的主要内容,如果未能解决你的问题,请参考以下文章

windows平台下安装与配置mysql5.7

手把手教你在windows上安装mysql8.0最新版本数据库,保姆级教学

mysql数据库安装实战

Android 事件分发事件分发源码分析 ( Activity 中各层级的事件传递 | Activity -> PhoneWindow -> DecorView -> ViewGroup )(代码片段

mysql物理文件组成

如何在 Windows 中为 Python 安装 `protoc` 的二进制分发版