Centos 6.5 安装mysql 5.7.18

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos 6.5 安装mysql 5.7.18相关的知识,希望对你有一定的参考价值。

1,首先在mysql官网下载MySQL 5.7.18

2安装mysql

首先安装依赖包:yum install  libaio -y

创建MySQL用户和组

groupadd mysql

useradd mysql -g mysql

创建MySQL安装目录

技术分享

解压MySQL到安装目录

技术分享

技术分享

创建数据目录和授权

cd /usr/local/mysql

mkdir var && mkdir data

cd /usr/local

chmod -R 755 mysql/

chown root:mysql mysql/

cd mysql

chown -R mysql:mysql *

初始化MySQL

[[email protected] mysql]# ./bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize
2017-05-04T22:46:35.096810Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-05-04T22:46:36.171880Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-05-04T22:46:37.553352Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-05-04T22:46:37.777380Z 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: 883ca086-311b-11e7-bd73-080027e6059a.
2017-05-04T22:46:37.808310Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed‘ cannot be opened.
2017-05-04T22:46:39.739908Z 0 [Warning] CA certificate ca.pem is self signed.
2017-05-04T22:46:39.946178Z 1 [Note] A temporary password is generated for [email protected]: >Wd7Uav4layt

注意:>Wd7Uav4layt是root的临时密码。

启动MySQL

[[email protected] mysql]# ./support-files/mysql.server start
Starting MySQL.Logging to ‘/usr/local/mysql/data/MySQL.err‘.
. SUCCESS!

加入系统服务

[[email protected] mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[[email protected] mysql]#
[[email protected] mysql]#
[[email protected] mysql]# chmod +x /etc/init.d/mysqld
[[email protected] mysql]# /etc/init.d/mysqld restart
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!

修改MySQL密码

[[email protected] mysql]# /usr/local/mysql/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \\g.
Your MySQL connection id is 3
Server version: 5.7.18-enterprise-commercial-advanced-log

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=password(‘mima666‘);
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

客户端启动

[[email protected] mysql]# ln -s /usr/local/mysql/bin/* /usr/bin/

 

 
























以上是关于Centos 6.5 安装mysql 5.7.18的主要内容,如果未能解决你的问题,请参考以下文章

Linux(CentOS 6.5) 下安装MySql 5.7.18 二进制版本粗浅攻略

CentOS 6.9上安装Mysql 5.7.18 安装

MySQL 5.7.18 在centos下安装记录

centos 6.6 安装 mysql-5.7.18

Centos6.9安装Mysql5.7.18

CentOS 6.6 源码编译安装MySQL-5.7.18