日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

rhel7.2 mysql_RHEL 7.2 安装 MySQL 5.7.11 二进制版

發(fā)布時間:2025/3/21 数据库 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 rhel7.2 mysql_RHEL 7.2 安装 MySQL 5.7.11 二进制版 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

操作系統(tǒng):rhel7.2

MySQL版本:5.7.11

1、MySQL下載

http://dev.mysql.com/downloads/

2、上傳MySQL軟件到操作系統(tǒng)

[root@rhel7 ~]# ls -l mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz

-rw-r--r--. 1 root root 548193637 Dec? 4 21:16 mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz

3、添加mysql用戶和組

[root@rhel7 ~]# groupadd mysql

[root@rhel7 ~]# useradd -r -g mysql -s /bin/false mysql

[root@rhel7 ~]# id mysql

uid=996(mysql) gid=1000(mysql) groups=1000(mysql)

4、創(chuàng)建目錄、改屬組及解壓文件

[root@rhel7 ~]# mkdir -p /opt/mysql/

[root@rhel7 ~]# mkdir /mysqldata

[root@rhel7 ~]# mv /root/mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz /opt/mysql/

[root@rhel7 ~]# cd /opt/mysql/

[root@rhel7 mysql]# ls

mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz

[root@rhel7 mysql]# tar -zxvf mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz

......

[root@rhel7 mysql]# mv mysql-5.7.11-linux-glibc2.5-x86_64 mysql5.7.11

[root@rhel7 mysql]# ls -l

total 535352

drwxr-xr-x. 9 7161 wheel? ? ? 4096 Feb? 2? 2016 mysql5.7.11

-rw-r--r--. 1 root root? 548193637 Dec? 4 21:16 mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz

[root@rhel7 mysql]# chown mysql:mysql -R /opt/mysql/

[root@rhel7 mysql]# chown mysql:mysql -R /mysqldata/

5、初始化庫

[root@rhel7 mysql]# cd mysql5.7.11/

[root@rhel7 mysql5.7.11]# ./bin/mysqld --initialize --user=mysql --basedir=/opt/mysql/mysql5.7.11/ --datadir=/mysqldata/

2016-12-04T13:33:01.318081Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2016-12-04T13:33:01.729086Z 0 [Warning] InnoDB: New log files created, LSN=45790

2016-12-04T13:33:02.027182Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2016-12-04T13:33:02.111882Z 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: 2dca0cf3-ba26-11e6-b4ff-080027e818bc.

2016-12-04T13:33:02.118970Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2016-12-04T13:33:02.120080Z 1 [Note] A temporary password is generated for root@localhost: rqwPw!9iNEEP

[root@rhel7 mysql5.7.11]# ls /mysqldata/

auto.cnf? ib_buffer_pool? ibdata1? ib_logfile0? ib_logfile1? mysql? performance_schema? sys

注意:root的初始密碼已經(jīng)在日志中給出:rqwPw!9iNEEP

在5.7.6之前的版本中使用bin/mysql_install_db --user=mysql初始化庫。

6、啟動MySQL數(shù)據(jù)庫

#替換系統(tǒng)自帶的my.cnf文件

[root@rhel7 mysql5.7.11]# mv /etc/my.cnf /etc/my.cnf.bak

[root@rhel7 mysql5.7.11]# cp support-files/my-default.cnf /etc/my.cnf

#在my.cnf中添加如下兩條

[root@rhel7 mysql5.7.11]# vi /etc/my.cnf

basedir = /opt/mysql/mysql5.7.11

datadir = /mysqldata

#啟動MySQL

[root@rhel7 mysql5.7.11]# ./bin/mysqld_safe --user=mysql &

[1] 1756

[root@rhel7 mysql5.7.11]# 2016-12-04T13:44:30.046089Z mysqld_safe Logging to '/mysqldata/rhel7.err'.

2016-12-04T13:44:30.097978Z mysqld_safe Starting mysqld daemon with databases from /mysqldata

[root@rhel7 mysql5.7.11]# ps -ef |grep mysql

root? ? ? 1756? 1182? 0 21:44 pts/0? ? 00:00:00 /bin/sh ./bin/mysqld_safe --user=mysql

mysql? ? 1876? 1756? 1 21:44 pts/0? ? 00:00:00 /opt/mysql/mysql5.7.11/bin/mysqld --basedir=/opt/mysql/mysql5.7.11 --datadir=/mysqldata --plugin-dir=/opt/mysql/mysql5.7.11/lib/plugin --user=mysql --log-error=/m

ysqldata/rhel7.err --pid-file=/mysqldata/rhel7.pidroot? ? ? 1905? 1182? 0 21:44 pts/0? ? 00:00:00 grep --color=auto mysql

7、登錄MySQL,使用安裝時給出密碼登錄并更改root密碼

[root@rhel7 mysql5.7.11]# ./bin/mysql -uroot -p

Enter password:

Welcome to the MySQL monitor.? Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.7.11

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='1qaz!QAZ';

Query OK, 0 rows affected (0.01 sec)

注意:5.6之前使用set password=password('newpassword')進行改密碼,5.7版本不再建議這樣改密碼,會有如下提示:

mysql> set password=password('123456');

Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show warnings;

+---------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+

| Level? | Code | Message? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |

+---------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+

| Warning | 1287 | 'SET PASSWORD = PASSWORD('')' is deprecated and will be removed in a future release. Please use SET PASSWORD = '' instead |

+---------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+

1 row in set (0.00 sec)

到此,MySQL5.7.11安裝完成。

官方文檔:http://dev.mysql.com/doc/refman/5.7/en/binary-installation.html

總結(jié)

以上是生活随笔為你收集整理的rhel7.2 mysql_RHEL 7.2 安装 MySQL 5.7.11 二进制版的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。