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

http://www.jb51.net/article/87160.htm

************************************************

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

1系统约定

安装文件下载目录:/data/software

Mysql目录安装位置:/usr/local/mysql

数据库保存位置:/data/mysql

日志保存位置:/data/log/mysql

97d3c07b5dfd9c5b5d600ff7d5009c60.png

执行如下命名:

#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

执行后如下:

597f9f32782c96551e8c2e4a4d5fcd1a.png

#ls

70b1d334c2dd36343447f95fb6932814.png

#cd /usr/local

#pwd

a3b11c52d6071ae806af6ef655d2e4a7.png

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

74a9771c09af06bf4c3d58a581b459b8.png

#ls

71d19d8eebdd5ac9fdbd10d3d52a8f37.png

--修改文件名

# mv mysql-5.7.13-linux-glibc2.5-x86_64 mysql

#ls

c0ed2850ee664aa63aabb1c4b4c29b23.png

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

# mkdir /data/mysql

#ls /data/

1debb23389f0b541ecbc29d062f96419.png

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 .

1b973dbd135fc0e74bd69a6adadf6b52.png

#chown -R mysql /data/mysql

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

c21f89d415ac3658f423e04fdf595191.png

此处需要注意记录生成的临时密码,如上文:YLi>7ecpe;YP

#bin/mysql_ssl_rsa_setup  --datadir=/data/mysql

3c82bd352c6ff03ca6e1353a4165669b.png

8修改系统配置文件

429953e9d9c9dfa0fe9cc454663a535f.png

# cp my-default.cnf /etc/my.cnf

# cp mysql.server /etc/init.d/mysql

64462ad45b8151e77cab03bae745f0bb.png

# 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

4945fe32e19142076aa886d8ec969b34.png

# vim /etc/my.cnf

修改以下内容:

e05c3e86af8ef24889a50189de201fbe.png

4010936fb7a1a78a6e5044d2c158159e.png

0c14b7ce2bc69c01754f6c38dde8a2b5.png

9启动mysql

61ecebb3e077f29b71ab7bac16c7d9e5.png

#bin/mysqld_safe --user=mysql &

a6ac40367335a48397e7b854f3b6ea5f.png

bin/mysql --user=root –p

--输入第6步生成的临时密码

25d2a4069001241728920b6ef4017fee.png

7db23aec3d2b8909915e96f0894c6407.png

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

96d16c1f99301001c699b50d9f2f0235.png

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

mysql> flush privileges;

9e32ac8fb790f30c3e8e69c8650f71d3.png

mysql> use mysql;

mysql> select host,user from user;

990e50df0084fafdbcd5f16d826e6c80.png

10添加系统路径

# vim /etc/profile

添加:

export PATH=/usr/local/mysql/bin:$PATH

如下:

0967c2663456741cf14dfb1782e503d3.png

# source /etc/profile

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值