中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

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

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

使用二進制演示MySQL安裝步驟

發布時間:2020-06-08 11:36:24 來源:網絡 閱讀:249 作者:三月 欄目:MySQL數據庫

不知道大家之前對類似使用二進制演示MySQL安裝步驟的文章有無了解,今天我在這里給大家再簡單的講講。感興趣的話就一起來看看正文部分吧,相信看完使用二進制演示MySQL安裝步驟你一定會有所收獲的。

安裝環境準備:

系統版本:
[root@node2 ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
selinux關閉:
[root@node2 ~]# getenforce
Disabled
防火墻關閉:
[root@node2 ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)

1、安裝依賴包
yum install libaio -y

2、下載MySQL二進制安裝包

https://dev.mysql.com (社區網站)
https://dev.mysql.com/downloads/file/?id=474755 (下載頁面)

下載地址:
wget -p /opt/  https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz

參數說明:-p             下載所有為了html頁面顯示正常的文件。
-p . /local     保存所有文件和目錄到本地指定目錄。

3、創建用戶

useradd -s /sbin/nologin -M mysql

4、解壓、創建目錄、并創建軟連接

mkdir /opt/mysql/
tar zxf /opt/mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz -C /opt/mysql/
cd /usr/local/
ln -s /opt/mysql/mysql-5.7.21-linux-glibc2.12-x86_64

5、創建數據庫相關目錄(備份用)

mkdir -pv /data/mysql/mysql3306/{data,logs,tmp}

6、更改相關目錄的屬性

chown -R mysql.mysql /usr/local/mysql
chown -R mysql.mysql /data

7、創建配置相關文件

配置文件為:/etc/my.cnf

cat > /etc/my.cnf << EOF

#my.cnf
[client]
port = 3306
socket = /tmp/mysql3306.sock

[mysql]
prompt="\u@\h [\d]>"
no-auto-rehash

[mysqld]
#misc
user = mysql
basedir = /usr/local/mysql
datadir = /data/mysql/mysql3306/data
tmpdir = /data/mysql/mysql3306/tmp
port = 3306
socket = /tmp/mysql3306.sock
event_scheduler = 0

#timeout
interactive_timeout = 300
wait_timeout = 300

#character set
character-set-server = utf8

open_files_limit = 65535
max_connections = 100
max_connect_errors = 100000
lower_case_table_names =1

gtid-mode = on
enforce-gtid-consistency=1

#rpl_semi_sync_master_enabled=1
#rpl_semi_sync_master_timeout=1000 # 1 second
#rpl_semi_sync_slave_enabled=1

####### slow log ######
log-output=file
slow_query_log = 1
slow_query_log_file = slow.log
log-error = error.log
log_warnings = 2
pid-file = mysql.pid
long_query_time = 1
#log-slow-admin-statements = 1
#log-queries-not-using-indexes = 1
log-slow-slave-statements = 1

####### binlog ######
binlog_format = row
server-id = 1003306
log-bin = /data/mysql/mysql3306/logs/mysql-bin
max_binlog_size = 256M
sync_binlog = 0
expire_logs_days = 10
#procedure
log_bin_trust_function_creators=1

####### relay log ######
skip_slave_start = 1
max_relay_log_size = 128M
relay_log_purge = 1
relay_log_recovery = 1
relay-log=relay-bin
relay-log-index = relay-bin.index
log_slave_updates = ON
#slave-skip-errors=1032,1053,1062
#skip-grant-tables

####### buffers & cache ######
table_open_cache = 2048
table_definition_cache = 2048
table_open_cache = 2048
max_heap_table_size = 96M
sort_buffer_size = 128K
join_buffer_size = 128K
thread_cache_size = 200
query_cache_size = 0
query_cache_type = 0
query_cache_limit = 256K
query_cache_min_res_unit = 512
thread_stack = 192K
tmp_table_size = 96M
key_buffer_size = 8M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 32M

#myisam
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1

#innodb
innodb_buffer_pool_size = 100M
innodb_buffer_pool_instances = 1
innodb_data_file_path = ibdata1:100M:autoextend
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 8M
innodb_log_file_size = 100M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 50
innodb_file_per_table = 1
innodb_rollback_on_timeout
innodb_io_capacity = 2000
transaction_isolation = READ-COMMITTED
innodb_flush_method = O_DIRECT
EOF

8、初始化數據庫

cd /usr/local/mysql/
./bin/mysqld --defaults-file=/etc/my.cnf   --initialize

9、創建啟動腳本

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

/etc/init.d/mysqld start

Starting MySQL............ SUCCESS!   (啟動成功)

10、創建快速啟動的環境變量

echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profile

11、查看MySQL初始密碼

grep "password" /data/mysql/mysql3306/data/error.log
2018-02-01T05:44:04.334666Z 1 [Note] A temporary password is generated for root@localhost: usXXw5x.zzfw(默認登錄密碼)

12、修改初始密碼

初始密碼為: q=usXXw5x.zzfw 每次初始化密碼都不會相同;
登錄數據庫修改密碼為:123456

mysql -uroot -p初始密碼
mysql> alter user user() identified by '123456';
或者:
mysql> SET PASSWORD=PASSWORD('123456');
mysql> flush privileges;

說明:此處的密碼更改為123456,建議密碼復雜化。

或者使用下面的命令:
PASSWD=$(grep 'password is' /data/mysql/mysql3306/data/error.log  | awk '{print $NF}')

mysql -uroot -p"$PASSWD" --connect-expired-password -e "alter user user() identified by '123456';"

至此,MySQL數據庫的二進制安裝完成,您將進入一個暫新的數據世界。

看完使用二進制演示MySQL安裝步驟這篇文章,大家覺得怎么樣?如果想要了解更多相關,可以繼續關注我們的行業資訊板塊。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

徐水县| 吉隆县| 册亨县| 绥阳县| 邵阳县| 阿拉善盟| 阿瓦提县| 永春县| 惠水县| 上虞市| 增城市| 兴隆县| 方城县| 延安市| 翼城县| 周宁县| 无棣县| 增城市| 天门市| 乐安县| 紫金县| 宜州市| 芒康县| 新津县| 廉江市| 普陀区| 伽师县| 博乐市| 永善县| 灵山县| 鄂托克旗| 民丰县| 加查县| 潢川县| 呼伦贝尔市| 囊谦县| 获嘉县| 凤庆县| 呼和浩特市| 礼泉县| 伊宁市|