溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

linux環(huán)境Mysql 5.7.13安裝

發(fā)布時(shí)間:2020-08-07 19:10:15 來(lái)源:ITPUB博客 閱讀:164 作者:lsfzly 欄目:MySQL數(shù)據(jù)庫(kù)


http://www.cnblogs.com/zhao1949/p/5947938.html
linux環(huán)境Mysql 5.7.13安裝教程分享給大家,供大家參考,具體內(nèi)容如下

1系統(tǒng)約定
安裝文件下載目錄:/data/software
Mysql目錄安裝位置:/usr/local/mysql
數(shù)據(jù)庫(kù)保存位置:/data/mysql
日志保存位置:/data/log/mysql

2下載mysql
在官網(wǎng):http://dev.mysql.com/downloads/mysql/ 中,選擇以下版本的mysql下載:

執(zhí)行如下命名:
#mkdir /data/software
#cd /data/software
#wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz

3解壓壓縮包到目標(biāo)位置
# mkdir /usr/local/mysql
#cd /dat/software
#pwd
執(zhí)行后如下:

#ls

#cd /usr/local
#pwd

# tar -xzvf /data/software/mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz

#ls

--修改文件名
# mv mysql-5.7.13-linux-glibc2.5-x86_64 mysql         
#ls

4創(chuàng)建數(shù)據(jù)倉(cāng)庫(kù)目錄
--/data/mysql 數(shù)據(jù)倉(cāng)庫(kù)目錄
# mkdir /data/mysql         
#ls /data/

5新建mysql用戶、組及目錄
#      ---新建一個(gè)msyql組
# useradd -r -s /sbin/nologin -g mysql mysql -d /usr/local/mysql     ---新建msyql用戶禁止登錄shell

6改變目錄屬有者
#cd /usr/local/mysql
#pwd
#chown –R mysql .
#chgrp –R mysql .

#chown -R mysql /data/mysql

7配置參數(shù)
# bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql

 此處需要注意記錄生成的臨時(shí)密碼,如上文:YLi>7ecpe;YP
#bin/mysql_ssl_rsa_setup  --datadir=/data/mysql

8修改系統(tǒng)配置文件

# cp my-default.cnf /etc/my.cnf
# cp mysql.server /etc/init.d/mysql

# vim /etc/init.d/mysql
修改以下內(nèi)容:

[client]
port=3306
# socket=/usr/local/mysql/mysql.sock
socket=/data/mysql/mysql.sock
[mysqld]
basedir=/usr/local/mysql
datadir=/data/mysql
# socket=/usr/local/mysql/mysql.sock
socket=/data/mysql/mysql.sock
pid-file=/data/mysql/mysqld.pid

 

# vim /etc/my.cnf
修改以下內(nèi)容:

9啟動(dòng)mysql

#bin/mysqld_safe --user=mysql &

bin/mysql --user=root –p
--輸入第6步生成的臨時(shí)密碼

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

mysql>grant all privileges on *.* to 'root'@'%' identified by 'A123456';
mysql> flush privileges;

mysql> use mysql;
mysql> select host,user from user;

10添加系統(tǒng)路徑
# vim /etc/profile
添加:
export PATH=/usr/local/mysql/bin:$PATH
如下:

# source /etc/profile

11配置mysql自動(dòng)啟動(dòng)
# chmod 755 /etc/init.d/mysql
# chkconfig --add mysql
# chkconfig --level 345 mysql on

以上就是linux環(huán)境Mysql 5.7.13安裝教程,希望對(duì)大家的學(xué)習(xí)有所幫助。

附my.cn

/etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
innodb_buffer_pool_size = 10G

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
log_bin
character-set-server=utf8
collation-server=utf8_bin
init-connect='SET NAMES utf8'
# These are commonly set, remove the # and set as required.
basedir = /usr/local/mysql
datadir = /export/mysql/var
port = 3306
server_id = 22206
socket = /export/mysql/mysql.sock
binlog_format = statement
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
join_buffer_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 2M
log_bin_trust_function_creators = on
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

lower_case_table_names=1

 


向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI