当前位置:Gxlcms > 数据库问题 > RHEL 7.2 安装 MySQL 5.7.11 二进制版

RHEL 7.2 安装 MySQL 5.7.11 二进制版

时间:2021-07-01 10:21:17 帮助过:24人阅读

初始化库。

6、启动MySQL数据库

  1. #替换系统自带的my.cnf文件
  2. [root@rhel7 mysql5.7.11]# mv /etc/my.cnf /etc/my.cnf.bak
  3. [root@rhel7 mysql5.7.11]# cp support-files/my-default.cnf /etc/my.cnf
  4. #在my.cnf中添加如下两条
  5. [root@rhel7 mysql5.7.11]# vi /etc/my.cnf
  6. basedir = /opt/mysql/mysql5.7.11
  7. datadir = /mysqldata
  8. #启动MySQL
  9. [root@rhel7 mysql5.7.11]# ./bin/mysqld_safe --user=mysql &
  10. [1] 1756
  11. [root@rhel7 mysql5.7.11]# 2016-12-04T13:44:30.046089Z mysqld_safe Logging to ‘/mysqldata/rhel7.err‘.
  12. 2016-12-04T13:44:30.097978Z mysqld_safe Starting mysqld daemon with databases from /mysqldata
  13. [root@rhel7 mysql5.7.11]# ps -ef |grep mysql
  14. root      1756  1182  0 21:44 pts/0    00:00:00 /bin/sh ./bin/mysqld_safe --user=mysql
  15. 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
  16. 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密码

  1. [root@rhel7 mysql5.7.11]# ./bin/mysql -uroot -p 
  2. Enter password: 
  3. Welcome to the MySQL monitor.  Commands end with ; or \g.
  4. Your MySQL connection id is 2
  5. Server version: 5.7.11
  6. Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  7. Oracle is a registered trademark of Oracle Corporation and/or its
  8. affiliates. Other names may be trademarks of their respective
  9. owners.
  10. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
  11. mysql> set password=‘1qaz!QAZ‘;
  12. Query OK, 0 rows affected (0.01 sec)

注意:5.6之前使用set password=password(‘newpassword‘)进行改密码,5.7版本不再建议这样改密码,会有如下提示:

  1. mysql> set password=password(‘123456‘);
  2. Query OK, 0 rows affected, 1 warning (0.00 sec)
  3. mysql> show warnings;
  4. +---------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  5. | Level   | Code | Message                                                                                                                                                           |
  6. +---------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  7. | Warning | 1287 | ‘SET PASSWORD = PASSWORD(‘<plaintext_password>‘)‘ is deprecated and will be removed in a future release. Please use SET PASSWORD = ‘<plaintext_password>‘ instead |
  8. +---------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  9. 1 row in set (0.00 sec)

到此,MySQL5.7.11安装完成。

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


本文出自 “DBA Fighting!” 博客,请务必保留此出处http://hbxztc.blog.51cto.com/1587495/1879396

RHEL 7.2 安装 MySQL 5.7.11 二进制版

标签:mysql5.7 安装

人气教程排行