码迷,mamicode.com
首页 > 数据库 > 详细

Centos 6.5 安装mysql 5.7.18

时间:2017-05-05 15:31:36      阅读:255      评论:0      收藏:0      [点我收藏+]

标签:exist   lib   constrain   open   existing   support   ogg   ini   Owner   

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

[root@MySQL 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 root@localhost: >Wd7Uav4layt

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

启动MySQL

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

加入系统服务

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

修改MySQL密码

[root@MySQL 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)

客户端启动

[root@MySQL mysql]# ln -s /usr/local/mysql/bin/* /usr/bin/

 

 

Centos 6.5 安装mysql 5.7.18

标签:exist   lib   constrain   open   existing   support   ogg   ini   Owner   

原文地址:http://www.cnblogs.com/dan1324/p/6813022.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!