一.mysql5.7 安装(centos6.8)

二进制安装

MySQL has a dependency on the libaio library. Data directory initialization and subsequent(后续) server startup steps will fail if this library is not installed locally. If necessary(必要), install it using the appropriate(适当) package manager. For example, on Yum-based systems:

MYSQL 依赖于libaio库,如果在本地没有安装它则会使数据初始化目录和后续服务器启动步骤失败,必要的话请使用包管理器安装,例如,基于yum方式安装

root@study ~]# yum seearch  libaio
Loaded plugins: fastestmirror, refresh-packagekit, security
No such command: seearch. Please use /usr/bin/yum --help
[root@study ~]# yum search  libaio
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirrors.sohu.com
 * extras: mirror.bit.edu.cn
 * updates: mirrors.zju.edu.cn
===================================================================================== N/S Matched: libaio ======================================================================================
libaio.i686 : Linux-native asynchronous I/O access library
libaio.x86_64 : Linux-native asynchronous I/O access library
libaio-devel.i686 : Development files for Linux-native asynchronous I/O access
libaio-devel.x86_64 : Development files for Linux-native asynchronous I/O access

  Name and summary matches only, use "search all" for everything.
[root@study ~]# yum install   libaio
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.sohu.com
 * extras: mirror.bit.edu.cn
 * updates: mirrors.zju.edu.cn
Package libaio-0.3.107-10.el6.x86_64 already installed and latest version

On Unix, to install a compressed tar file binary distribution(版本), unpack it at the installation location you choose (typically(典型的) /usr/local/mysql). This creates the directories shown in the following table.

在Unix系统上,安装一个二进制版本的压缩tar包。你可以选择/usr/local/mysql典型目录下解压它,这将创建的一些目录在以下的表格

DirectoryContents of Directory
bin mysqld server, client and utility programs mysql 服务器,客户端和一些应用程序
data Log files, databases 日志和数据文件
docs MySQL manual in Info format mysql的手册
man Unix manual pages man手册
include Include (header) files  头文件
lib Libraries 库文件目录
share Miscellaneous support files, including error messages, sample configuration files, SQL for database installation

 

[root@study ~]# groupadd mysql
[root@study ~]# useradd -r -g mysql -s /bin/false mysql
[root@study ~]# cd /soft/
[root@study soft]# ls
mysql-5.6.37-linux-glibc2.12-x86_64.tar.gz  mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz  mysql-test-5.7.19-linux-glibc2.12-x86_64.tar.gz
[root@study soft]# tar zxvf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz 
[root@study soft]# mv mysql-5.7.19-linux-glibc2.12-x86_64 /opt/mysql57
[root@study soft]# ln -s /opt/mysql57  /usr/local/mysql
[root@study soft]# ln -s /opt/mysql57 /usr/local/mysql
[root@study soft]# cd /usr/local/mysql/
[root@study mysql]# mkdir data mysql-files
[root@study mysql]# chmod 750 mysql-files data/
[root@study mysql]# chown -R mysql .
[root@study mysql]# chgrp -R mysql .
[root@study mysql]# ./bin/mysqld --initialize --user=mysql
2017-08-30T17:52:39.562159Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-08-30T17:52:40.166035Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-08-30T17:52:40.245313Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-08-30T17:52:40.313533Z 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: 043dba8e-8dac-11e7-943a-000c291cd934.
2017-08-30T17:52:40.318082Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-08-30T17:52:40.330933Z 1 [Note] A temporary password is generated for root@localhost: sYhgMw?)O15( \\初始化密码
[root@study 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@study mysql]# chown -R mysql data mysql-files
[root@study mysql]# bin/mysqld_safe --user=mysql &
[1] 8894
[root@study mysql]# Logging to '/usr/local/mysql/data/study.com.err'.
2017-08-30T17:57:46.732757Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
[root@study mysql]# cp support-files/mysql.server /etc/init.d/mysql.server
[root@study mysql]# lsof -i:3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 8964 mysql 21u IPv6 23638 0t0 TCP *:mysql (LISTEN)
[root@study mysql]# echo "export PATH=/usr/local/mysql/bin:\$PATH" >> /etc/profile
[root@study mysql]# source /etc/profile
[root@study mysql]# mysql -p 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.19

Copyright (c) 2000, 2017, 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="wuxinglai"
    -> ;
Query OK, 0 rows affected (0.00 sec)

mysql> create database wuxing;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| wuxing             |
+--------------------+
5 rows in set (0.00 sec)
安装完成
posted @ 2017-08-31 12:44  91King  阅读(126)  评论(0)    收藏  举报