溫馨提示×

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

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

mysql 二進(jìn)制文件安裝

發(fā)布時(shí)間:2020-06-01 05:14:32 來源:網(wǎng)絡(luò) 閱讀:462 作者:春秋小記 欄目:MySQL數(shù)據(jù)庫

1.下載二進(jìn)制文件并解壓文件:

下載地址:https://dev.mysql.com/downloads/mysql/5.7.html#downloads

tar xvzf mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz

mv mysql-5.7.23-linux-glibc2.12-x86_64 /usr/local/

cd /usr/local/

ln -s mysql-5.7.23-linux-glibc2.12-x86_64 mysql

chown -R mysql:mysql /usr/local/mysql/

vim /etc/my.cnf

######################mysql5.7.23###############

[client]
port=3306
socket=/app/data/run/mysql.sock

[mysql]
#pid_file=/app/data/run/mysqld.pid

[mysqld]
gtid_mode=on
enforce_gtid_consistency=on
log_slave_updates=on
autocommit=1
general_log=off
explicit_defaults_for_timestamp=true

###character
default-storage-engine=INNODB
innodb_file_per_table=1
character-set-server=utf8
collation-server=utf8_general_ci
interactive_timeout = 559200
wait_timeout = 559200

# system
basedir=/usr/local/mysql
datadir=/app/data/data
max_allowed_packet=1g
max_connections=3000
max_user_connections=2800
open_files_limit=65535
pid_file=/app/data/run/mysqld.pid
port=3306
server_id=52160
#skip_name_resolve=ON
socket=/app/data/run/mysql.sock
tmpdir=/app/data/tmp

#innodb
innodb_data_home_dir=/app/data/log/iblog
innodb_log_group_home_dir=/app/data/log/iblog
innodb_buffer_pool_size = 1000M

#binlog
log_bin=/app/data/log/binlog/binlog
binlog_format=row
expire_logs_days=7
innodb_log_file_size = 200M
innodb_log_files_in_group = 4
max_binlog_size=200M

#logging
log_error=/app/data/log/error.log
slow_query_log_file=/app/data/log/slow.log
log_queries_not_using_indexes=0
slow_query_log=1
log_slave_updates=ON
log_slow_admin_statements=1
long_query_time=1

#relay
relay_log=/app/data/log/relaylog
relay_log_index=/app/data/log/relay.index
relay_log_info_file=/app/data/log/relay-log.info


[mysqld_safe]
datadir=/app/data/data


################mysql5.7.23##############

--添加用戶:
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
---

或者直接:

useradd mysql


cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

--創(chuàng)建數(shù)據(jù)目錄:
mkdir -p /app/data/log
mkdir -p /app/data/log/binlog
mkdir -p /app/data/run
mkdir -p /app/data/tmp
mkdir -p /app/data/log/iblog
chown? -R mysql:mysql /app/data/


--初始化數(shù)據(jù)庫:
[root@test1 ~]# su - mysql
[mysql@test1 ~]$?? /usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf --initialize --user=mysql


2.1 通腳本啟動(dòng):
啟動(dòng)數(shù)據(jù)庫:
[mysql@test1 log]$ /etc/init.d/mysqld start
Starting MySQL..?????????????????????????????????????????? [? OK? ]

關(guān)閉數(shù)據(jù)庫:
[mysql@test1 log]$ /etc/init.d/mysqld stop
Shutting down MySQL..????????????????????????????????????? [? OK? ]
登錄數(shù)據(jù)庫:
[mysql@test1 log]$ /usr/local/mysql/bin/mysql -uroot -p

修改密碼:
mysql> alter user root@'localhost' identified by 'MYsql#123';
Query OK, 0 rows affected (0.00 sec)

2.2 自定義配置文件啟動(dòng):
啟動(dòng)數(shù)據(jù)庫:
[mysql@test1 log]$ /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql &

關(guān)閉數(shù)據(jù)庫:
[mysql@test1 log]$ /usr/local/mysql/bin/mysqladmin? --port=3306 shutdown -p
Enter password:


3.開機(jī)自動(dòng)啟動(dòng):
[root@test1 ~]# chkconfig mysqld on

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

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

AI