• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • MsSql
  • Mysql
  • oracle
  • MariaDB
  • DB2
  • SQLite
  • PostgreSQL
  • MongoDB
  • Redis
  • Access
  • 数据库其它
  • sybase
  • HBase
您的位置:首页 > 数据库 >Mysql > 基于 Linux 安装glibc版mysql 5.7.12

基于 Linux 安装glibc版mysql 5.7.12

作者:匿名 字体:[增加 减小] 来源:互联网 时间:2018-12-05

匿名通过本文主要向大家介绍了Linux ,glibc,mysql 等相关知识,希望本文的分享对您有所帮助


对于mysql的数据库的安装,我们有很多种选择来完成。而最为常用的为二进制安装以及源码安装。二进制安装方式中,包括rpm版本以及glibc版本。rpm版本就是在特定linux版本下编译的,如果你的linux版本匹配,就可以安装,如针对RedHat6或者RedHat7编译好的rpm包,下载对应的安装即可。还有另外一种二进制安装包为基于特定的glibc版本编译的,本文主要描述基于glibc方式安装mysql。

一、准备安装环境

###准备安装介质下载地址:http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz ###或者使用wget方式直接下载对应的版本
# wget http:///# mkdir -pv /u01/app# mkdir -pv /u01/soft# mkdir -pv /u02/mysqldata# cd /u01/soft# wget http:/// 
# tar -xf mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz# ln -sv /u01/soft/mysql-5.7.12-linux-glibc2.5-x86_64 /u01/app/mysql`/u01/app/mysql' -> `
/u01/soft/mysql-5.7.12-linux-glibc2.5-x86_64'###下面添加mysql用户# useradd -r mysql -s /sbin/nologin# chown -R mysql:mysql /u01/app/mysql
# chown -R mysql:mysql /u02/mysqldata

二、初始化mysql

###使用以下的方式来初始化# cd /u01/app/mysql/bin# ./mysqld --initialize --basedir=/u01/app/mysql --datadir=/u02/mysqldata --user=mysql 
--explicit_defaults_for_timestamp2016-06-28T02:18:23.437852Z 0 [Warning] InnoDB: New log files created, LSN=457902016-06-28T02:18:23.718104Z 0 
[Warning] InnoDB: Creating foreign key constraint system tables.2016-06-28T02:18:23.866501Z 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: 9731b834-3cd6-11e6-8654-fcaa14e34b30.2016-06-28T02:18:23.896540Z 0 
     [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.2016-06-28T02:18:23.898416Z 
     1 [Note] A temporary password is generated for root@localhost: )%%D0pr,mU.Y# ls /u02/mysqldata/auto.cnf    client-cert.pem  
     ibdata1      performance_schema  sys
ca-key.pem  client-key.pem   ib_logfile0  server-cert.pem
ca.pem      client-req.pem   ib_logfile1  server-key.pem
ca-req.pem  ib_buffer_pool   mysql        server-req.pem###从上面的结果可以看出 mysql 5.7多出了证书相关文件,安全较5.6有较大提升
###mysql_install_db方式初始化数据已经被废弃# ./mysql_install_db --basedir=/u01/app/mysql --datadir=/u02/mysqldata --user=mysql2016-06-28 10:04:56 
[WARNING] mysql_install_db is deprecated. 
Please consider switching to mysqld --initialize2016-06-28 10:05:15 [WARNING] The bootstrap log isn't empty:2016-06-28 10:05:15 [WARNING] 
2016-06-28T02:04:56.688237Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead2016-06-28T02:04:56.688654Z 0 
[Warning] Changed limits: max_open_files: 1024 (requested 5000)2016-06-28T02:04:56.688657Z 0 [Warning] Changed 
limits: table_open_cache: 431 (requested 2000)###如上书提示,mysql_install_db方式初始化数据已经被废弃,建议使用mysqld --initialize,同时也给出了参数限制的警告
# cp /u01/app/mysql/support-files/my-default.cnf /etc/my.cnf# cp /u01/app/mysql/support-files/mysql.server /etc/init.d/mysqld# vim /etc/my.cnf [mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
basedir=/u01/app/mysql
datadir=/u02/mysqldata
user=mysql
port=3306# vim /etc/profile.d/mysql.shexport MYSQL_HOME=/u01/app/mysql
export PATH=$PATH:$MYSQL_HOME/bin# source /etc/profile.d/mysql.sh# service mysqld startStarting MySQL.                                            [  OK  ]

三、配置安全选项

###使用初始化时得到的密码配置安全选项
# /u01/app/mysql/bin/mysql_secure_installation -p)%%D0pr,mU.Y
mysql_secure_installation: [Warning] Using a password on the command line interface can be insecure.

Securing the MySQL server deployment.

The existing password for the user account root has expired. Please set a new password.

New password: 

Re-enter new password: 

VALIDATE PASSWORD PLUGIN can be used to test passwordsand improve security. It checks the strength of passwordand allows the users to set 
only those passwords which aresecure 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 >= 8MEDIUM 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: 100 Change the password for root ? ((Press y|Y for Yes, any other key for No) : 

 ... skipping.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 fortesting, 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 atthe root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y  ###是否关闭root远程登陆功能
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> show variables like 'valid%';+--------------------------------------+--------+| Variable_name                   | Value  |
+--------------------------------------+--------+| validate_password_dictionary_file    |        |
| validate_password_length             | 8      |
| validate_password_mixed_case_count   | 1      |
| validate_password_number_count       | 1      |
| validate_password_policy             | STRONG |
| validate_password_special_char_count | 1      |
+--------------------------------------+--------+

四、同一主机配置其他实例

###按上面描述的步骤创建其对应的目录及授权后,再执行初始化###使用新的配置文件,如下文本示例使用的为3317# mkdir -pv /u02/mysqldata3317# chown -R mysql:mysql 
/u02/mysqldata 3317# grep -v ^# /etc/my3317.cnf[mysqld]
basedir=/u01/app/mysql
datadir=/u02/mysqldata3317
user=mysql
port=3317socket=/tmp/mysql3317.sock# cd /u01/app/mysql/bin# ./mysqld --defaults-file=/etc/my3317.cnf --initialize --user=mysql 
--explicit_defaults_for_timestamp# 2016-06-30T08:32:52.497519Z 0 [Warning] InnoDB: New log files created, LSN=457902016-06-30T08:32:52.852457Z 0 
[Warning] InnoDB: Creating foreign key constraint system tables.2016-06-30T08:32:53.042621Z 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: 3cb1686d-3e9d-11e6-a71f-fcaa14e34b30.2016-06-30T08:32:53.081210Z 0 [Warning] Gtid table is not ready to be used. 
Table 'mysql.gtid_executed' cannot be opened.2016-06-30T08:32:53.082538Z 1 [Note] A temporary password is generated for root@localhost: :8
#l!MCYoCNY### Author : Leshami### Blog   : http:///# mysqld_safe --defaults-file=/etc/my3317.cnf &[1] 58252016-06-30T08:11:49.468176Z 
mysqld_safe Logging to '/u02/mysqldata3317/ydq4.err'.2016-06-30T08:11:49.480379Z my
  


 
分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • 解析远程连接管理其他机器上的MYSQL数据库
  • 解析Mysql备份与恢复简单总结与tee命令的使用介绍
  • mysql基础:mysqld_safe 启动执行流程详解
  • 深入解析mysql.sock不见的问题
  • 基于Mysql的IP处理函数inet_aton()与inet_ntoa()的深入分析
  • 配置mysql允许远程连接的方法
  • linux mysql 报错:MYSQL:The server quit without updating PID file
  • mysql自动增量备份的实例方法(本地备份与远程备份)
  • linux下mysql自动备份数据库与自动删除临时文件
  • linux下指定mysql数据库服务器主从同步的配置实例

相关文章

  • 2018-12-05SQL Server 自动增长清零的方法
  • 2017-05-11mysql-5.5.28源码安装过程中错误总结
  • 2017-05-11MySQL中主从复制重复键问题修复方法
  • 2017-05-11MySQL 性能优化的最佳20多条经验分享
  • 2018-12-05Mysql一次死锁排查过程的全纪录分享
  • 2017-05-11MySQL 实现双向复制的方法指南
  • 2018-12-05MySQL命令大全(收藏)
  • 2017-05-11MySQL与MSSQl使用While语句循环生成测试数据的代码
  • 2018-12-05详解高性能MySQL的架构与概念
  • 2017-05-11通过mysqladmin远程管理mysql的方法

文章分类

  • MsSql
  • Mysql
  • oracle
  • MariaDB
  • DB2
  • SQLite
  • PostgreSQL
  • MongoDB
  • Redis
  • Access
  • 数据库其它
  • sybase
  • HBase

最近更新的内容

    • MySQL通过触发器解决数据库中表的行数限制的需求
    • mysqlslap 性能测试工具
    • show engine innodb status显示信息不全如何解决
    • oracle--rollup 和cube分组累计求和
    • MySql命令行创建和删除触发器
    • 深入Mysql字符集设置[精华结合]
    • Mysql 协议嗅探是什么
    • 与MSSQL对比学习MYSQL的心得(三)--查看字段的长度
    • 详细讲述MySQL中的子查询操作
    • MySql数据库分区和分表方法的详解及分区和分表介绍

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有