[root@iZwz94knyxhkgqeu5pve0zZ bin]# cd /usr/local/mysql
[root@iZwz94knyxhkgqeu5pve0zZ mysql]# bin/mysqld --initialize --user=mysql --basedir=/u
sr/local/mysql
2017-04-21T01:09:02.837622Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-04-21T01:09:05.621663Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-04-21T01:09:06.007022Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-04-21T01:09:06.103758Z 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: 1da93999-262f-11e7-a713-00163e06a307.
2017-04-21T01:09:06.109542Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-04-21T01:09:06.110557Z 1 [Note] A temporary password is generated for root@localhost: MX,)LrHRq6gn
[root@iZwz94knyxhkgqeu5pve0zZ mysql]# bin/mysql_ssl_rsa_setup
Generating a 2048 bit RSA private key
.........+++
................................................................................................................................................+++
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
...............+++
..........................................+++
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
........+++
........................................+++
writing new private key to 'client-key.pem'
-----
[root@iZwz94knyxhkgqeu5pve0zZ mysql]# cd /usr/local/mysql/support-files
[root@iZwz94knyxhkgqeu5pve0zZ support-files]# cp my-default.cnf /etc/my.cnf
[root@iZwz94knyxhkgqeu5pve0zZ support-files]# cp mysql.server /etc/init.d/mysql
[root@iZwz94knyxhkgqeu5pve0zZ support-files]# vim /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 = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....
# 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
~
~
~
~
~
~
~
"/etc/my.cnf" 31L, 1126C 1,1 All
# 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 = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306
# server_id = .....
socket = /tmp/mysql.sock
# 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
~
~
~
~
~
~
~
"/etc/my.cnf" 31L, 1154C written
[root@iZwz94knyxhkgqeu5pve0zZ support-files]# cd ../
[root@iZwz94knyxhkgqeu5pve0zZ mysql]# bin/mysqld-safe --user=mysql &
[1] 21491
[root@iZwz94knyxhkgqeu5pve0zZ mysql]# cd data
[root@iZwz94knyxhkgqeu5pve0zZ data]# chmod a+rw server-key.pem
[root@iZwz94knyxhkgqeu5pve0zZ data]# cd ../
[root@iZwz94knyxhkgqeu5pve0zZ mysql]# bin/mysqld_safe --user=mysql &
[2] 21686
[root@iZwz94knyxhkgqeu5pve0zZ mysql]# bin/mysql --user=root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@iZwz94knyxhkgqeu5pve0zZ mysql]# bin/mysql --user=root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.7.16
Copyright (c) 2000, 2016, 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> set password=password('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> grant all privileges on *.* to root@'%' identified by '123456';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
另外启动一个窗口,/etc/profile文件修改添加一句话export PATH=/usr/local/mysql/bin:$PATH
vim /etc/profile的过程省略
[root@iZwz94knyxhkgqeu5pve0zZ ~]# source /etc/profile
[root@iZwz94knyxhkgqeu5pve0zZ ~]# chmod 755 /etc/init.d/mysql
[root@iZwz94knyxhkgqeu5pve0zZ ~]# chkconfig --add mysql
[root@iZwz94knyxhkgqeu5pve0zZ ~]# chkconfig --level 345 mysql on
注意绿色的字体是生成的mysql初始化密码啊
结束
相关推荐
本文将详细介绍如何在CentOS7系统上安装MySQL 5.7.16版本。首先,我们需要确保系统中没有已存在的MySQL或MariaDB数据库,因为CentOS7默认预装了MariaDB。检查系统中是否存在MySQL数据库的方法是通过`rpm -qa | grep ...
在本教程中,我们将深入探讨如何在CentOS 7.3.1611操作系统上编译安装Nginx 1.10.3、MySQL 5.7.16和PHP 7.1.2。这个过程对于那些希望自定义安装配置或需要最新版本的开发者来说非常有用。首先,让我们逐一了解每个...
Centos6.7+MySQL5.7.16源码编译安装.doc
在CentOS7环境中,源码安装MySQL5.7.16是一个相对复杂的过程,涉及到多个步骤和配置选项。以下是对整个过程的详细说明: 一、下载源码包 首先,你需要从官方镜像站点或其他可靠的资源下载MySQL的源码包。在本例中,...
在本文中,我们将深入探讨如何在 CentOS 6.5 操作系统上安装 MySQL 5.7.16 版本,特别关注的是与 glibc2.5 和 x86_64 架构相关的细节。这个过程对于那些需要在 CentOS 环境中部署 MySQL 数据库服务器的 IT 专业人员...
mysql-5.7.16-1.el7.x86-64.rpm-bundle.zip
在这篇教程中,我们将学习如何在 Centos 平台上安装和卸载 MySQL 数据库管理系统。 MySQL 是一个非常流行的开源关系数据库管理系统,可以用来存储和管理大量数据。在 Centos 平台上安装 MySQL 是一个非常简单的过程...
至此,MySQL 5.7.16已经在Linux上成功部署。在实际运维过程中,还要关注性能监控、备份策略、安全防护等方面,确保数据库系统的稳定和高效运行。同时,持续学习和了解MySQL的新特性和最佳实践,以便更好地管理和优化...