mysql 5.7.19 二进制最新安装

 更新时间:2017年10月10日 09:50:06   投稿:mrr  
这篇文章主要介绍了mysql 5.7.19 二进制最新安装的相关资料,需要的朋友可以参考下

首先从官网下载zip archive版本http://dev.mysql.com/downloads/mysql/

MySQL v5.7.19 官方正式版(32/64位 安装版与zip解压版)

一、优化部分

1.操作系统参数调优

2.数据库参数调优

3.防火墙设置等

#############################

二、安装部分

1.创建用户和组

# groupadd mysql
# useradd -g mysql mysql

2.创建数据库安装目录、授权

# mkdir /mysql /mysql/data /mysql/log 
# chown -R mysql:mysql /usr/local/mysql 

3.到安装目录,解压安装文件

#cd /usr/local
# tar -zxvf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
# mv mysql-5.7.19-linux-glibc2.12-x86_64 mysql

4.授权

# chown -R mysql.mysql mysql

5.验证权限

# ls -l mysql
total 52
drwxr-xr-x 2 mysql mysql 4096 Aug 8 04:06 bin
-rw-r--r-- 1 mysql mysql 17987 Jun 22 22:13 COPYING
drwxr-xr-x 2 mysql mysql 4096 Aug 8 04:06 docs
drwxr-xr-x 3 mysql mysql 4096 Aug 8 04:06 include
drwxr-xr-x 5 mysql mysql 4096 Aug 8 04:06 lib
drwxr-xr-x 4 mysql mysql 4096 Aug 8 04:06 man
-rw-r--r-- 1 mysql mysql 2478 Jun 22 22:13 README
drwxr-xr-x 28 mysql mysql 4096 Aug 8 04:06 share
drwxr-xr-x 2 mysql mysql 4096 Aug 8 04:06 support-files

6.编辑参数文件

vim /etc/my.cnf
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
server_id=10
port = 3306
user = mysql
character-set-server = utf8mb4
default_storage_engine = innodb
log_timestamps = SYSTEM
socket = /tmp/mysql.sock
basedir = /usr/local/mysql
datadir = /mysql/data
pid-file = /mysql/data/mysql.pid
max_connections = 1000
max_connect_errors = 1000
table_open_cache = 1024
max_allowed_packet = 128M
open_files_limit = 65535
#####====================================[innodb]==============================
innodb_buffer_pool_size = 1024M
innodb_file_per_table = 1
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_purge_threads = 2
innodb_flush_log_at_trx_commit = 1
innodb_log_file_size = 512M
innodb_log_files_in_group = 2
innodb_log_buffer_size = 16M
innodb_max_dirty_pages_pct = 80
innodb_lock_wait_timeout = 30
innodb_data_file_path=ibdata1:1024M:autoextend
innodb_undo_tablespaces=3
#####====================================[log]==============================
log_error = /mysql/log/mysql-error.log 
slow_query_log = 1
long_query_time = 1 
slow_query_log_file = /mysql/log/mysql-slow.log
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

7.安装数据库

# ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/data --innodb_undo_tablespaces=3 --explicit_defaults_for_timestamp

8.配置启动文件

cp support-files/mysql.server /etc/init.d/mysql
chkconfig --add mysql
chkconfig mysql on
service mysql start

9.配置环境变量

vi /etc/profile
#for mysql 
mysql_home=/usr/local/mysql
PATH=$PATH:$mysql_home/bin
source /etc/profile

10.查看默认密码

grep -i password /mysql/log/mysql-error.log 

11.初始化密码

mysql -uroot -p‘xxxxx‘
SET PASSWORD=PASSWORD(‘root‘);
flush privileges;

12.数据库常规启停

# mysqladmin -uroot -proot shutdown
#mysqld_safe --defaults-file=/etc/my.cnf &
#ps -ef|grep mysql

13.安全配置

# mysql_secure_installation 
Securing the MySQL server deployment.
Enter password for user root: 
VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No: y
There are three levels of password validation policy:
LOW  Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary         file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Using existing password for root.
Estimated strength of the password: 25 
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y
New password: 
Re-enter new password: 
Sorry, passwords do not match.
New password: 
Re-enter new password: 
Sorry, passwords do not match.
New password: 
Re-enter new password: 
Estimated strength of the password: 50 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
 ... Failed! Error: Your password does not satisfy the current policy requirements
New password: 
Re-enter new password: 
Estimated strength of the password: 100 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
Normally, root should only be allowed to connect from
‘localhost‘. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.
By default, MySQL comes with a database named ‘test‘ that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.
 - Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done! 

相关阅读:

Mysql在各个系统的安装教程

Mysql 5.7.19 免安装版配置方法教程详解(64位)

Mysql 5.7.19 免安装版遇到的坑(收藏)

MySQL 5.7.19安装目录下创建my.ini文件的方法

总结

以上所述是小编给大家介绍的mysql 5.7.19 二进制最新安装,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!

相关文章

  • MySQL 5.7升级8.0报异常:ONLY_FULL_GROUP_BY的问题解决

    MySQL 5.7升级8.0报异常:ONLY_FULL_GROUP_BY的问题解决

    本文主要介绍了MySQL 5.7升级8.0报异常的问题解决,主要是ONLY_FULL_GROUP_BY,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2024-11-11
  • MySQL索引的优化之LIKE模糊查询功能实现

    MySQL索引的优化之LIKE模糊查询功能实现

    这篇文章主要介绍了MySQL索引的优化之LIKE模糊查询功能实现,本文通过示例代码给大家介绍的非常详细,感兴趣的朋友一起看看吧
    2025-04-04
  • mysql中锁机制的最全面讲解

    mysql中锁机制的最全面讲解

    大概几个月之前项目中用到事务,需要保证数据的强一致性,期间也用到了mysql的锁,所以本文打算总结一下mysql的锁机制,这篇文章主要给大家介绍了关于mysql中锁机制的相关资料,需要的朋友可以参考下
    2021-09-09
  • MySQL中获取当前时间格式的方法汇总

    MySQL中获取当前时间格式的方法汇总

    在MySQL数据库开发中,获取时间是一个常见的需求,MySQL提供了多种方法来获取当前日期、时间和时间戳,并且可以对时间进行格式化、计算和转换,以下是一些常用的MySQL时间函数及其示例,需要的朋友可以参考下
    2024-06-06
  • MySQL在线DDL工具 gh-ost的原理解析

    MySQL在线DDL工具 gh-ost的原理解析

    这篇文章主要介绍了MySQL在线DDL工具 gh-ost,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
    2021-03-03
  • 使用MySQL生成最近24小时整点时间临时表

    使用MySQL生成最近24小时整点时间临时表

    MySQL临时表是一种只存在于当前数据库连接或会话期间的表,它们可以被用来存储临时数据,这些数据可以在查询中被使用,但是它们不会在数据库中永久存储,这篇文章主要给大家介绍了关于如何使用MySQL生成最近24小时整点时间临时表的相关资料,需要的朋友可以参考下
    2024-01-01
  • MySQL中json_extract函数说明及使用方式

    MySQL中json_extract函数说明及使用方式

    今天看mysql中的json数据类型,涉及到一些使用,使用到了函数json_extract来,下面这篇文章主要给大家介绍了关于MySQL中json_extract函数说明及使用方式的相关资料,需要的朋友可以参考下
    2022-08-08
  • MYSQL 创建函数出错的解决方案

    MYSQL 创建函数出错的解决方案

    在程序开发过程中,大家有没有遇到过mysql函数不能创建,我是遇到过,是一个很麻烦的问题,上网搜了些相关资料,整理在一起了,供大家参考,帮助那些需要帮助的朋友
    2015-08-08
  • MySQL如何比较两个表数据的差异

    MySQL如何比较两个表数据的差异

    这篇文章主要介绍了MySQL比较两个表数据的差异,这些方式可以根据具体需求和数据结构选择合适的方法来比较两个表的数据差异,本文给大家介绍的非常详细,需要的朋友可以参考下
    2023-10-10
  • MySQL分组查询、排序查询、分页查询以及执行顺序

    MySQL分组查询、排序查询、分页查询以及执行顺序

    MySQL数据查询是数据库操作中最常见的操作之一,它可以帮助我们从数据库中获取所需的数据,下面这篇文章主要给大家介绍了关于MySQL分组查询、排序查询、分页查询以及执行顺序的相关资料,需要的朋友可以参考下
    2024-02-02

最新评论