二進制安裝MySQL5.7.17

搜狐mysql下載地址
    http://mirrors.sohu.com/mysql/MySQL-5.7/

系統環境:

[root@db02 ~]# uname -r
		2.6.32-696.el6.x86_64
	[root@db02 ~]# uname -m
		x86_64
	[root@db02 ~]# cat /etc/redhat-release 
		CentOS release 6.9 (Final)

安裝

一、建立目錄

mkdir -p /server/tools
mkdir -p /application

# 將mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz上傳到/server/tools
# 將mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz.md5也上傳到/server/toolsmysql

二、驗證安裝包是否無缺,並解壓

[root@db02 tools]# md5sum -c mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz.md5 
	mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz: OK
[root@db02 ~]# cd /server/tools/
[root@db02 tools]# tar -zxf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
[root@db02 tools]# mv /server/tools/mysql-5.7.17-linux-glibc2.5-x86_64 /application/mysql-5.7.17

三、建立用戶mysql管理Mysql5.7數據庫

useradd mysql -M -s /sbin/nologin 
id mysql

四、受權

chown -R mysql.mysql /application/mysql-5.7.17/

五、初始化,記錄此步驟生成的臨時密碼(*******必定要記住******

[root@db02 tools]# /application/mysql-5.7.17/bin/mysqld --initialize --user=mysql --basedir=/application/mysql-5.7.17/ --datadir=/application/mysql-5.7.17/data
	2018-04-02T05:37:58.545594Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
	2018-04-02T05:38:00.301715Z 0 [Warning] InnoDB: New log files created, LSN=45790
	2018-04-02T05:38:00.490353Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
	2018-04-02T05:38:00.597912Z 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: 017f2649-3638-11e8-ab8f-000c29cb5b53.
	2018-04-02T05:38:00.601057Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
	2018-04-02T05:38:00.627614Z 1 [Note] A temporary password is generated for root@localhost: u_Z/qkry.0h3
######## 注意:A temporary password is generated for root@localhost: u_Z/qkry.0h3  
######## 生成了臨時密碼,要記住**************
[root@db02 tools]# echo $?
	0

六、拷貝配置文件和啓動文件

cp /application/mysql-5.7.17/support-files/my-default.cnf /etc/my.cnf
cp /application/mysql-5.7.17/support-files/mysql.server /etc/init.d/mysqld-5.7.17
sed -i 's#/usr/local/mysql#/application/mysql-5.7.17#g' /application/mysql-5.7.17/bin/mysqld_safe /etc/init.d/mysqld-5.7.17

七、啓動mysql服務,查看版本

/etc/init.d/mysqld-5.7.17 start
/application/mysql-5.7.17/bin/mysql --version

八、修改mysql用戶root的密碼,此時要輸入臨時密碼 u_Z/qkry.0h3

[root@db02 tools]# /application/mysql-5.7.17/bin/mysqladmin -uroot -p password '123'
	Enter password: 
	mysqladmin: [Warning] Using a password on the command line interface can be insecure.
	Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety

九、清除命令行記錄(可不執行)

history -c

注:讀者可根據自身狀況進行靈活的配置安裝,謝謝您的閱讀!linux

相關文章
相關標籤/搜索