MySQL5.7 企业版安装方法

简介

     MySQL 不仅提供了社区版本,也对外开放企业版本,市面上大多数都是使用社区版本,刚开始大多以为企业版都是付费的,实际上官网下载的企业版也是可以免费使用的,最大的区别在于付费版的有提供专业的售后服务,以下介绍MySQL5.7版本企业版的安装方法,希望能帮到各位。

环境准备

操作系统:Centos7.1 x64 

配置:双核CPU、2G内存、10G硬盘

数据库版本:mysql-advanced-5.7.28-el7-x86_64 (官网可以下载)

开始安装

官网下载的文件

上传文件至服务器,进行解压

unzip mysql-advanced-5.7.28.zip

解压出来有4个文件,需对 mysql-advanced-5.7.28-el7-x86_64.tar.gz 再次解压

tar -zxvf mysql-advanced-5.7.28-el7-x86_64.tar.gz

解压后的文件目录如下

目录结构说明

往下开始执行安装步骤

shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> mkdir mysql-files
shell> chown mysql:mysql mysql-files
shell> chmod 750 mysql-files
shell> bin/mysqld --initialize --user=mysql 
shell> bin/mysql_ssl_rsa_setup              
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server
shell> echo 'export PATH=$PATH:/usr/local/mysql/bin' >> /etc/profile
shell> source /etc/profile

完成以上安装步骤后,再次查看mysql目录

MySQL数据 data 默认存放在当前目录 mysql-files 为我们手动创建

可通过服务命令查看mysql状态: service mysql.server status

[root@zabbix-server mysql]# service mysql.server status
 SUCCESS! MySQL running (1304)

 以上就完成了MySQL 5.7 企业版的安装,是不是很简单 ?

注:

 1、安装是会生成初始密码,需及时记录,避免首次登陆不上

[root@zabbix-server mysql]# bin/mysqld --initialize --user=mysql
2020-04-09T07:30:28.648020Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is
       deprecated. Please use --explicit_defaults_for_timestamp server option 
       (see documentation for more details).
2020-04-09T07:30:29.397763Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-04-09T07:30:29.558346Z 0 [Warning] InnoDB: Creating foreign key constraint system 
       tables.
2020-04-09T07:30:29.665431Z 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: fd1c9fcc-7a33-11ea-afc3-000c29b15d12.
2020-04-09T07:30:29.667622Z 0 [Warning] Gtid table is not ready to be used. Table 
      'mysql.gtid_executed' cannot be opened.
2020-04-09T07:30:31.652061Z 0 [Warning] CA certificate ca.pem is self signed.
2020-04-09T07:30:32.062385Z 1 [Note] A temporary password is 
       generated for root@localhost: FyZ/ryY%q7eM

2、首次登陆后执行任务操作都会抛出以下异常

mysql> select * from mysql.user;
ERROR 1820 (HY000): You must reset your password using 
ALTER USER statement before executing this statement.
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using 
ALTER USER statement before executing this statement.

   这个时候不要慌,只需要执行以下SQL就可解决(修改初始密码)

   MySQL版本5.7.6版本以前用户可以使用如下命令:  

mysql> SET PASSWORD = PASSWORD('123456'); 

  MySQL版本5.7.6版本开始的用户可以使用如下命令:

mysql> ALTER USER USER() IDENTIFIED BY '123456';


 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章