首页/应用软件/内容

案例详细说明linux下多个mysql5.7.19(tar.gz)安装图文详细教程

应用软件2022-10-07 阅读()
SQL是Structured Query Language(结构化查询语言)的缩写。SQL是专为数据库而建立的操作命令集,是一种功能齐全的数据库语言。在使用它时,只需要发出“做什么”的命令,“怎么做”是不用使用者考虑的。SQL功能强大、简单易学、使用方便,已经成为了数据库操作的基础,并且现在几乎所有的数据库均支持SQL。
初级第一次在Linux下安装MySQL-5.7.19版本教程请看上一篇,如果已经会安装了,那么请看这篇linux下安装多个mysql-5.7.19,本文主要为大家详细介绍了linux下多个mysql5.7.19tar.gz安装教程,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,希望能帮助到大家。

环境:centos 6.5

1-下载

实例详解linux下多个mysql5.7.19(tar.gz)安装图文教程

2-跳过登陆

实例详解linux下多个mysql5.7.19(tar.gz)安装图文教程

3-1安装多个数据库需要配置自己的my.cnf,如果只安装一个,系统没有安装过直接这个命令就可以

shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> mkdir mysql-files
查看下有没有data目录如果没有的话增加个命令(mkdir data)
shell> chmod 750 mysql-files
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db --user=mysql # MySQL 5.7.5
shell> bin/mysqld --initialize --user=mysql # MySQL 5.7.6 and up
shell> bin/mysql_ssl_rsa_setup # MySQL 5.7.6 and up
shell> chown -R root .
shell> chown -R mysql data mysql-files
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

安装好了就可以直接跳到登陆 步骤5

下面说安装多个mysql情况:

3-2安装多个数据库需要安照如下命令:

1-增加配置文件 my.cnf (在mysql目录下命令touch my.cnf):

下面配置文件可以直接使用粘贴复制进去

然后创建log文件 /xcxyz/log/mysql/error.log

[mysqld]
basedir= /usr/local/mysql-5.7.19-3307
datadir = /usr/local/mysql-5.7.19-3307/data
port = 3307
character-set-server=utf8
server_id = 11
#该socket最好指定,不指定的话默认的话 是使用的默认的socket文件 而且登陆数据库的时候会有我下面的问题
socket = /tmp/mysql3307.sock 
log-error = /xcxyz/log/mysql/error.log
pid-file = /usr/local/mysql-5.7.19-3307/data/mysql-5.7.19-3307.pid

2-执行如下命令

2-1增加用户 组 我的用户和组都使用的是mysqlosf这个随意

shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz

2-2建立软连接:

shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> mkdir mysql-files

查看下有没有data目录如果没有的话增加个命令(mkdir data)

2-3授权当前目录:

shell> chmod 750 mysql-files
shell> chown -R mysqlosf .
shell> chgrp -R mysqlosf .

2-4编译

bin/mysqld --defaults-file=/usr/local/full-path-to-mysql-VERSION-OS/my.cnf --initialize --user=mysqlosf

查看日志输出:vi /xcxyz/log/mysql/error.log
2017-07-24T03:13:47.933684Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-07-24T03:13:49.979892Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-07-24T03:13:50.262941Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-07-24T03:13:50.330756Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 1d702294-701e-11e7-98a1-00163e30bbf6.
2017-07-24T03:13:50.340474Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-07-24T03:13:50.344419Z 1 [Note] A temporary password is generated for root@localhost: jZpgHhigx5>i(特别重要一会初始化密码)

2-5建立密钥

shell> bin/mysql_ssl_rsa_setup --defaults-file=/usr/local/mysql-5.7.19-3307/my.cnf

这里写图片描述

2-6重新授权分配

shell> chown -R root .
shell> chown -R mysql data mysql-files

2-7启动后台mysql

bin/mysqld_safe --defaults-file=/usr/local/full-path-to-mysql-VERSION-OS/my.cnf --user=mysqlosf &

实例详解linux下多个mysql5.7.19(tar.gz)安装图文教程

Next command is optional

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

2-8查看mysql是否启动 ps -ef (北联网教程,专业提供视频软件下载)

第1页  第2页 

……

相关阅读