【MySQL】數(shù)據(jù)庫(kù)部署--MySQL5.7(YumRepository)

[root@wallet01?~]#?lsb_release?-a
LSB?Version:????:base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch
Distributor?ID:?CentOS
Description:????CentOS?release?6.5?(Final)
Release:????????6.5
Codename:???????Final

[root@wallet01?~]#?cat?>>?/etc/hosts?<<EOF
192.168.40.34???wallet01
EOF

[root@wallet01?~]#?useradd?MySQL
[root@wallet01?~]#?id?mysql
uid=500(mysql)?gid=500(mysql)?groups=500(mysql)

[root@wallet01?~]#?cat?>>?/etc/security/limits.conf?<<EOF
mysql????????????soft????nproc??????????4096
mysql????????????hard????nproc??????????65535
mysql????????????soft????nofile?????????4096
mysql????????????hard????nofile?????????65535
EOF

使用官方Y(jié)um?Repository安裝MySQL?5.7
[root@wallet01?~]#?yum?install?-y?libaio

[root@wallet01?~]#?rpm?-ivh?mysql80-community-release-el6-3.noarch.rpm

[root@wallet01?~]#?yum-config-manager?--disable?mysql80-community

[root@wallet01?~]#?yum-config-manager?--enable?mysql57-community

[root@wallet01?~]#?yum?repolist?all?|?grep?mysql?

[root@wallet01?~]#?yum?install?-y?mysql-community-server

[root@wallet01?~]#?vim?/etc/my.cnf
[mysqld]
user?=?mysql??
port?=?3306?
datadir?=?/var/lib/mysql
socket?=?/var/lib/mysql/mysql.sock
character-set-server?=?utf8
open-files-limit?=?65535

validate_password=off

sql_mode?=?STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION
secure_file_priv?=?/var/lib/mysql

transaction_isolation?=?READ-COMMITTED

innodb_buffer_pool_size?=?4G
innodb_buffer_pool_instances?=?4

innodb_log_file_size?=?256M
innodb_log_files_in_group?=?3
innodb_log_buffer_size?=?16M

innodb_undo_logs=?128
innodb_undo_tablespaces?=?3
innodb_data_file_path?=?ibdata1:2048M:autoextend

tmp_table_size?=?256M
max_heap_table_size?=?256M

key_buffer_size?=?32M
max_allowed_packet?=?32M

lower_case_table_names=1

slow_query_log?=?1
long_query_time?=?2

log-error?=?/var/lib/mysql/error.log
log_timestamps?=?SYSTEM

wait_timeout=43200??
interactive_timeout=43200

max_connections?=?500
max_connect_errors?=?10000

server_id?=?3030

log_bin?=?mysql-bin
binlog_format?=?row
binlog_cache_size?=?8M
max_binlog_cache_size?=?4G
max_binlog_size?=?64M
expire_logs_days?=?7

relay_log?=?relay-bin
relay_log_recovery?=?1
master_info_repository?=?table
relay_log_info_repository?=?table

[mysql]
socket?=?/var/lib/mysql/mysql.sock

[root@wallet01?~]#?mysqld?--initialize?--user=mysql
......

2019-08-19T02:42:34.290832Z?1?[Note]?A?temporary?password?is?generated?for?root@localhost:?I9ro5DtK:5sN

[root@wallet01?~]#?service?mysqld?start
Logging?to?'/var/lib/mysql/wallet01.err'.
Starting?mysqld:???????????????????????????????????????????[??OK??]

[root@wallet01?~]#?service?mysqld?status
mysqld?(pid??12093)?is?running...

[root@wallet01?~]#?netstat?-tunlp?|?grep?mysqld
tcp????????0??????0?:::3306????????:::*????????LISTEN??????12093/mysqld?

[root@wallet01?~]#?mysql_secure_installation

##修改root密碼

Enter?password?for?user?root:?

The?existing?password?for?the?user?account?root?has?expired.?Please?set?a?new?password.

New?password:?

Re-enter?new?password:?

Estimated?strength?of?the?password:?100?
Do?you?wish?to?continue?with?the?password?provided?(Press?y|Y?for?Yes,?any?other?key?for?No)?:?y
By?default,?a?MySQL?installation?has?an?anonymous?user,
allowing?anyone?to?log?into?MySQL?without?having?to?have
a?user?account?created?for?them.?This?is?intended?only?for
testing,?and?to?make?the?installation?go?a?bit?smoother.
You?should?remove?them?before?moving?into?a?production
environment.

##刪除匿名用戶
Remove?anonymous?users??(Press?y|Y?for?Yes,?any?other?key?for?No)?:?y
Success.

Normally,?root?should?only?be?allowed?to?connect?from
'localhost'.?This?ensures?that?someone?cannot?guess?at
the?root?password?from?the?network.

##禁止root遠(yuǎn)程登錄
Disallow?root?login?remotely??(Press?y|Y?for?Yes,?any?other?key?for?No)?:?y
Success.

By?default,?MySQL?comes?with?a?database?named?'test'?that
anyone?can?access.?This?is?also?intended?only?for?testing,
and?should?be?removed?before?moving?into?a?production
environment.

##刪除測(cè)試庫(kù)
Remove?test?database?and?access?to?it??(Press?y|Y?for?Yes,?any?other?key?for?No)?:?y
?-?Dropping?test?database...
Success.

?-?Removing?privileges?on?test?database...
Success.

Reloading?the?privilege?tables?will?ensure?that?all?changes
made?so?far?will?take?effect?immediately.

##刷新權(quán)限
Reload?privilege?tables?now??(Press?y|Y?for?Yes,?any?other?key?for?No)?:?y
Success.

[root@wallet01?~]#?mysql?-uroot?-p
Enter?password:?
Welcome?to?the?MySQL?monitor.??Commands?end?with?;?or?\g.
Your?MySQL?connection?id?is?6
Server?version:?5.7.27?MySQL?Community?Server?(GPL)

Copyright?(c)?2000,?2019,?Oracle?and/or?its?affiliates.?All?rights?reserved.

Oracle?is?a?registered?trademark?of?Oracle?Corporation?and/or?its
affiliates.?Other?names?may?be?trademarks?of?their?respective
owners.

Type?'help;'?or?'\h'?for?help.?Type?'\c'?to?clear?the?current?input?statement.

mysql>?select?version();
+-----------+
|?version()?|
+-----------+
|?5.7.27????|
+-----------+
1?row?in?set?(0.00?sec)

標(biāo)題名稱:【MySQL】數(shù)據(jù)庫(kù)部署--MySQL5.7(YumRepository)
鏈接分享:http://muchs.cn/article46/ghhjeg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)網(wǎng)站建設(shè)、響應(yīng)式網(wǎng)站、App設(shè)計(jì)、網(wǎng)站收錄品牌網(wǎng)站制作、關(guān)鍵詞優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

手機(jī)網(wǎng)站建設(shè)