系统环境:

[root@localhost ~]# cat /etc/RedHat-release

CentOS release 6.7 (Final)

[root@localhost tools]# uname -a

Linux localhost 2.6.32-573.22.1.el6.x86_64 #1 SMP Wed Mar 23 03:35:39 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

[root@localhost tools]#

软件准备:

[root@localhost tools]# pwd

/opt/tools

[root@localhost tools]# ll

total 674208

-rw-r--r-- 1 root root 639864682 Jul 22 17:47 mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz

-rw-r--r-- 1 root root  50516207 May 25 12:01 mysql-5.7.13.tar.gz

[root@localhost tools]#

解压安装:

[root@localhost tools]# tar xf mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz

[root@localhost tools]# ll

total 674212

drwxr-xr-x 9 7161 wheel      4096 May 25 15:04 mysql-5.7.13-linux-glibc2.5-x86_64

-rw-r--r-- 1 root root  639864682 Jul 22 17:47 mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz

-rw-r--r-- 1 root root  50516207 May 25 12:01 mysql-5.7.13.tar.gz

[root@localhost tools]#

[root@localhost tools]# mv mysql-5.7.13-linux-glibc2.5-x86_64 /usr/local/mysql

[root@localhost tools]#

初始化操作(生成初始密码):

[root@localhost mysql]# ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/data

2016-07-22T09:58:15.001776Z 0 [Warning] InnoDB: New log files created, LSN=45790

2016-07-22T09:58:15.062066Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2016-07-22T09:58:15.073009Z 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: cebfb8a6-4ff2-11e6-8c8d-005056a01a07.

2016-07-22T09:58:15.074370Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2016-07-22T09:58:15.075736Z 1 [Note] A temporary password is generated for root@localhost: k_1ljzVh3

[root@localhost mysql]#

PS: mysql5.7新特性:由上面可以看出, mysql_install_db 已经不再推荐使用了,建议改成 mysqld --initialize 完成实例初始化。

加入MySQL为系统服务:

[root@localhost mysql]# cp support-files/mysql.server  /etc/init.d/mysqld

[root@localhost mysql]# chkconfig mysqld on

[root@localhost mysql]# chkconfig --list|grep mysqld

mysqld          0:off  1:off  2:on    3:on    4:on    5:on    6:off

[root@localhost mysql]#chmod 755 /etc/init.d/mysqld

MySQL服务启动、重启、停止

[root@localhost mysql]# serivce mysqld start

[root@localhost mysql]# serivce mysqld stop

[root@localhost mysql]# serivce mysqld restart

[root@localhost mysql]#

设置环境变量:

[root@localhost mysql]# vim /etc/profile

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

[root@localhost mysql]#

检查MySQL是否能开启

[root@localhost mysql]# cd /usr/local/mysql

[root@localhost mysql]# cd support-files/

[root@localhost support-files]# ./mysql.server start

Starting MySQL.. SUCCESS!

若改用了, 则在启动服务时会出现如下错误:

# ./support-files/mysql.server start

./support-files/mysql.server: line 276: cd: /usr/local/mysql: No such file or directory

Starting MySQL ERROR! Couldn't find MySQL server (/usr/local/mysql/bin/mysqld_safe)

这时候我们需要修改/support-files/mysql.server文件的basedir和datadir目录路径为我们正确的mysql的basedir和datadir路径, 如下:

# vim support-files/mysql.server

--------------------------

...

basedir=/usr/local/mysql

datadir=/data/mysql/data

...

--------------------------

# ./support-files/mysql.server start

Starting MySQL.. SUCCESS!

创建配置文件

将默认生成的my.cnf备份

# mv /etc/my.cnf /etc/my.cnf.bak

[root@localhost support-files]# cp my-default.cnf  /etc/my.cnf

初始化mysql用户root的密码

先将mysql服务停止

# service mysqld stop

进入mysql安装目录, 执行:

# cd /usr/local/mysql

# ./bin/mysqld_safe --skip-grant-tables --skip-networking&

[1] 6225

[root@localhost mysql]# 151110 02:46:08 mysqld_safe Logging to '/data/mysql/data/localhost.localdomain.err'.

151110 02:46:08 mysqld_safe Starting mysqld daemon with databases from /data/mysql/data

另外打开一个终端(p.s. 如果是ssh连接登录的, 另外创建一个ssh连接即可), 执行操作如下:

# mysql -u root mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.7.13 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, 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> use mysql;

Database changed

mysql> UPDATE user SET password=PASSWORD('123456') WHERE user='root';

ERROR 1054 (42S22): Unknown column 'password' in 'field list'

mysql> update user set authentication_string = PASSWORD('123456') where user = 'root';

Query OK, 1 row affected, 1 warning (0.02 sec)

Rows matched: 1  Changed: 1  Warnings: 1

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

mysql> \s

mysql  Ver 14.14 Distrib 5.7.13, for linux-glibc2.5 (x86_64) using  EditLine wrapper

Connection id:          62

Current database:

Current user:          root@localhost

SSL:                    Not in use

Current pager:          stdout

Using outfile:          ''

Using delimiter:        ;

Server version:        5.7.13-log MySQL Community Server (GPL)

Protocol version:      10

Connection:            Localhost via UNIX socket

Server characterset:    utf8

Db    characterset:    utf8

Client characterset:    utf8

Conn.  characterset:    utf8

UNIX socket:            /data/AEData/mysql/data/mysql.sock

Uptime:                46 min 54 sec

Threads: 6  Questions: 6846  Slow queries: 0  Opens: 257  Flush tables: 1  Open tables: 201  Queries per second avg: 2.432

--------------

mysql>

到此, 设置完mysql用户root的密码且确保mysql编码集是utf8, 注意上面, 新版本的mysql.user表里的密码字段是authentication_string

MySQL远程授权

格式如下:

mysql> grant all [privileges] on db_name.table_name to 'username'@'host' identified by 'password';

示例如下:

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

Query OK, 0 rows affected, 1 warning (0.04 sec)

mysql> FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.00 sec)

mysql>

或用

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

到此, 完成了mysql的安装 及配置!!!

附上配置文件:

[client]

loose_default-character-set = utf8

[mysqld]

basedir = /usr/local/mysql

datadir = /data/mysql/data

port = 3306

server_id = 1

socket = /data/mysql/data/mysql.sock

expire_logs_days      = 7

innodb_file_per_table

innodb_buffer_pool_size        = 2G

innodb_thread_concurrency      = 24

innodb_flush_log_at_trx_commit  = 1

innodb_log_buffer_size          = 32M

innodb_log_file_size            = 256M

innodb_log_files_in_group      = 3

innodb_max_dirty_pages_pct      = 90

innodb_lock_wait_timeout        = 120

wait_timeout            = 60

interactive_timeout    = 7200

skip-name-resolve

character-set-server    = utf8

back_log                = 50

max_connections        = 3000

max_connect_errors      = 32

max_allowed_packet      = 32M

binlog_cache_size      = 8M

max_heap_table_size    = 512M

tmp_table_size          = 64M

key_buffer_size        = 16M

read_buffer_size        = 2M

read_rnd_buffer_size    = 8M

bulk_insert_buffer_size = 64M

sort_buffer_size        = 4M

join_buffer_size        = 2M

thread_cache_size      = 64

thread_stack            = 192K

query_cache_type        = 1

query_cache_size        = 256M

query_cache_limit      = 2M

ft_min_word_len        = 2

default_storage_engine  = INNODB

#default_table_type    = INNODB

transaction_isolation  = REPEATABLE-READ

lower_case_table_names  = 1

#log_slow_queries

slow_query_log

long_query_time = 2

log-short-format

myisam_sort_buffer_size        = 128M

myisam_max_sort_file_size      = 10G

myisam_repair_threads          = 1

[mysqldump]

quick

max_allowed_packet = 32M

routines

single-transaction

hex-blob

skip-comments

complete-insert

skip-disable-keys

skip-add-locks

skip-lock-tables

[isamchk]

key_buffer      = 512M

sort_buffer_size = 512M

read_buffer      = 8M

write_buffer    = 8M

[myisamchk]

key_buffer      = 512M

sort_buffer_size = 512M

read_buffer      = 8M

write_buffer    = 8M

[mysqlhotcopy]

interactive-timeout

# 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

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

centos 6.7 mysql_CentOS6.7 64位环境下安装部署MySQL-5.7.13相关推荐

  1. windows7 64位环境下安装apache+mysql5.5+php7经验

    安装环境时遇到的一写问题现总结如下: 整体都是  windows64位环境下  vc14 首先电脑上安装的是vs2015环境 安装顺序: 1.首先安装apache2.4安装包,解压即可 2.php7压 ...

  2. Windows7(64位)环境下安装openssl详细步骤+图解

    本人同样也是刚刚接触openssl,看到一个安装教程就直接上手,结果走了很多弯路.建议大家多看些资料再安装,出现问题不要急着放弃,在网上去查一下问题代码,一个一个解决.阅读网上分享出来的安装教程,大家 ...

  3. Windows7(64位)环境下安装openssl详细步骤+图解(亲测有效分享)

    自己写的东西被整片复制,遂重新发一份 源地址:https://bbs.csdn.net/topics/392193545 本人同样也是刚刚接触openssl,看到一个安装教程就直接上手,结果走了很多弯 ...

  4. linux64位系统需要安装32位mysql_在Ubuntu16.04 Linux 64位环境下安装二进制版本MySQL 8.0.13...

    a.MySQL依赖于libaio库.如果此库不在本地安装,则数据目录初始化和随后的服务器启动步骤将失败.如果需要,请使用适当的包管理器安装它.例如,基于云计算的系统: hell> apt-cac ...

  5. python2.7安装教程win7_win7 64位环境下,为python2.7 安装pip

    第一步: 安装python并配置好环境变量 第二步: 下载setuptools源码setuptools-38.5.1.zip,地址:https://pypi.python.org/pypi/setup ...

  6. win10,64位环境下curl7下载安装和配置详细图文教程(亲测有效)

    win10,64位环境下curl7下载安装和配置教程 一.前期准备: (1)windows10,64位: (2)python3.8 二.下载: 三.安装: 四.环境变量配置: (1)新建 ==CURL ...

  7. Win7系统64位环境下使用Apache——下载mod_jk

    转载请注明出处:http://blog.csdn.net/dongdong9223/article/details/70313329 本文出自[我是干勾鱼的博客] 之前在几篇文章: Win7系统64位 ...

  8. linux ubuntu安装教程6,64位Ubuntu下安装IE6步骤

    64位Ubuntu下安装IE6步骤 ies4linux下载地址: cabextract下载地址: wine1.0下载地址: cab文件及字体下载地址: simsun.ttc下载地址: adobe fl ...

  9. centos 启动一个redis_linux环境下安装部署redis服务器

    概述 Redis是Remote Dictionary Server的缩写.他本质上一个Key/Value数据库,与Memcached类似的NoSQL型数据库.今天把之前在生产环境下安装部署redis的 ...

最新文章

  1. spring 项目中的一个异常
  2. No-PDO-Models-MySQL数据库层抽象类
  3. beanstalkd 协议中文版
  4. 数据库系统概论:第六章 关系数据库理论
  5. 单片机while用法c语言例子,51单片机-C语言之while(!x)的理解
  6. CentOS7更换镜像源
  7. kubernetes mysql ip_弄明白kubernetes中的“三种IP”
  8. php取商,PHP获取百度关键词排名
  9. 微信WeixinJSBridge API 屏蔽右上角分享等常用方法
  10. java 二维数组内存溢出_程序员:学习心得,Java内存区域,内存溢出异常
  11. linux aix试题,《aix-linux考试试题.xls》-支持高清全文免费浏览-max文档
  12. 谷歌gmail注册入口_Gmail,日历和其他Google Apps即将出现的外观如下
  13. AXI5 new feature: support atomic transaction
  14. php如何pfx转成jks证书,常规方法不行,变相来实现
  15. Jetpack:Room配合LiveData/Flow使用优化,Room+Flow使用原理解析。
  16. loj6198谢特 后缀数组+并查集+Trie
  17. Protoss and Zerg(快速幂)
  18. 直线拟合fitLine函数的用法
  19. MYSQL数据库--存储引擎
  20. 6种穷人思维必须警惕

热门文章

  1. 机器学习的开源工具-开源程序-研究工具
  2. 每日英语:Electronics Develop A Sixth Sense
  3. ComponentOne Ultimate 2012 v2 新特性
  4. java hashmap 无序_Map的有序和无序实现类,与Map的排序
  5. js 如何拿到后天的时间_js获取日期及日期相关js方法 积累总结
  6. Python爬虫之一键保存全部必应高清1080P壁纸
  7. Emacs之hs-minor-mode折叠代码
  8. 《C关键字分析》之typedef与callback
  9. iOS 使用mp4v2合成的视频注意事项
  10. Android 循环缓冲区