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';


 

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