mysql 5.7.13 安装配置方法图文教程(linux)

inux环境Mysql 5.7.13安装教程分享给大家,供大家参考,具体内容如下

1系统约定
安装文件下载目录:/data/software
Mysql目录安装位置:/usr/local/mysql
数据库保存位置:/data/mysql
日志保存位置:/data/log/mysql


2下载mysql
在官网:http://dev.mysql.com/downloads/mysql/ 中,选择以下版本的mysql下载:




执行如下命名:
#mkdir /data/software
#cd /data/software
#wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz

3解压压缩包到目标位置
# mkdir /usr/local/mysql
#cd /dat/software
#pwd
执行后如下:


#ls


#cd /usr/local
#pwd


# tar -xzvf /data/software/mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz


#ls



--修改文件名
# mv mysql-5.7.13-linux-glibc2.5-x86_64 mysql        
#ls


4创建数据仓库目录
--/data/mysql 数据仓库目录
# mkdir /data/mysql         
#ls /data/




5新建mysql用户、组及目录
#      ---新建一个msyql组
# useradd -r -s /sbin/nologin -g mysql mysql -d /usr/local/mysql     ---新建msyql用户禁止登录shell

6改变目录属有者
#cd /usr/local/mysql
#pwd
#chown –R mysql .
#chgrp –R mysql .


#chown -R mysql /data/mysql

7配置参数
# bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql


 此处需要注意记录生成的临时密码,如上文:YLi>7ecpe;YP
#bin/mysql_ssl_rsa_setup  --datadir=/data/mysql



8修改系统配置文件




# cp my-default.cnf /etc/my.cnf
# cp mysql.server /etc/init.d/mysql


# vim /etc/init.d/mysql
修改以下内容:

[client]
port=3306
# socket=/usr/local/mysql/mysql.sock
socket=/data/mysql/mysql.sock
[mysqld]
basedir=/usr/local/mysql
datadir=/data/mysql
# socket=/usr/local/mysql/mysql.sock
socket=/data/mysql/mysql.sock
pid-file=/data/mysql/mysqld.pid


# vim /etc/my.cnf
修改以下内容:












9启动mysql

#bin/mysqld_safe --user=mysql &


bin/mysql --user=root –p
--输入第6步生成的临时密码


mysql> set password=password('A123456');


mysql>grant all privileges on *.* to 'root'@'%' identified by 'A123456';
mysql> flush privileges;


mysql> use mysql;
mysql> select host,user from user;


10添加系统路径
# vim /etc/profile
添加:
export PATH=/usr/local/mysql/bin:$PATH
如下:


11配置mysql自动启动
# chmod 755 /etc/init.d/mysql
# chkconfig --add mysql
# chkconfig --level 345 mysql on

以上就是linux环境Mysql 5.7.13安装教程,希望对大家的学习有所帮助。



附my.cn

/etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
innodb_buffer_pool_size = 10G

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
log_bin
character-set-server=utf8
collation-server=utf8_bin
init-connect='SET NAMES utf8'
# These are commonly set, remove the # and set as required.
basedir = /usr/local/mysql
datadir = /export/mysql/var
port = 3306
server_id = 22206
socket = /export/mysql/mysql.sock
binlog_format = statement
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
join_buffer_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 2M
log_bin_trust_function_creators = on
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

lower_case_table_names=1



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
很高兴回答你的问题!以下是MySQL 5.7.13安装教程: 步骤 1: 下载 MySQL 安装包 首先,你需要从 MySQL 官方网站下载适用于你的操作系统的 MySQL 5.7.13 安装包。访问 https://dev.mysql.com/downloads/mysql/5.7.html,在 "MySQL Community Server" 下载栏中选择适合你操作系统的版本。 步骤 2: 安装 MySQL 1. 打开下载的安装包,双击运行安装程序。 2. 阅读并接受许可协议。 3. 在 "Choosing a Setup Type" 页面,选择 "Custom" 自定义安装类型,以便选择安装路径和组件。 4. 在 "Select Products and Features" 页面,选择你需要安装的组件。通常情况下,都会默认选择 "MySQL Server"。你可以根据需要选择其他组件,然后点击 "Next" 继续。 . 在 "Check Requirements" 页面,检查系统是否满足安装要求。如果有任何问题,请解决它们后继续。 6. 在 "Installation" 页面,选择安装类型。如果你是第一次安装 MySQL,选择 "New installation"。如果你是升级现有的 MySQL 版本,请选择 "Upgrade"。 7. 在 "Installation" 页面,选择你想要安装的位置。默认情况下,它会安装在 "C:\Program Files\MySQL\MySQL Server 5.7" 目录下。 8. 在 "Accounts and Passwords" 页面,设置 root 用户的密码。确保密码安全,并记住它。 9. 在 "Windows Service" 页面,选择是否将 MySQL 安装为 Windows 服务。如果你打算在 Windows 启动时自动启动 MySQL,请选择 "Server Machine"。 10. 在 "Apply Server Configuration" 页面,选择适合你的用途的配置类型。你可以选择 "Development Machine" 或 "Server Machine"。 11. 在 "Performing Configuration" 页面,等待 MySQL配置完成。 12. 在 "Product Configuration" 页面,根据需要选择是否要启动 MySQL Workbench。 13. 在 "Completing the MySQL Server 5.7 Setup Wizard" 页面,点击 "Finish" 完成安装。 步骤 3: 验证安装 1. 打开命令提示符或终端窗口。 2. 输入以下命令验证 MySQL 是否成功安装: ``` mysql -V ``` 如果成功安装,将显示 MySQL 的版本信息。 恭喜你!你已经成功安装MySQL 5.7.13。现在你可以开始使用它来创建和管理数据库了。希望这个教程对你有帮助!如果还有其他问题,请随时提问。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值