mysql-8.0.15-linux-glibc2.12-x86_64.tar下载及其配置

本文档详细介绍了如何在Linux环境下快速下载、转换、解压MySQL 8.0.15版本,并提供了详细的配置步骤,包括创建系统账号、编辑my.cnf配置文件、解决依赖问题、初始化数据库、设置启动脚本以及修改默认密码。此外,还提供了在安装过程中可能遇到的问题及其解决方案。
摘要由CSDN通过智能技术生成

https://blog.csdn.net/qq_45400755/article/details/97686608

由于直接在网上下载mysql的文件太慢了,本人就直接把自己下载好的东西,分享给大家。提供给大家下载。
链接:https://pan.baidu.com/s/1FsYucZBvBho17Ml2eBETxw
提取码:v7js

接下来,本人将介绍该怎么配置和部署mysql
因为首先下载下来的文件是xz格式,所以需要用此命令将文件改为tar格式

xz -d  mysql-8.0.15-linux-glibc2.12-x86_64.xz
1

接下来,就可以正常解压tar文件,正常情况下,需要将mysql解压并移动到/usr/local/mysql文件夹

tar xf mysql-8.0.15-linux-glibc2.12-x86_64.tar /usr/local/mysql
1

接下来需要建立一个mysql系统账号

adduser mysql      //mysqls是账号名字,可自行取
1
之后需要在 /etc/my.cnf中进行配置

[client]
port            = 3306
socket          = /usr/local/mysql/data/mysql.sock
[mysqld]
# Skip #
skip_name_resolve              = 1
skip_external_locking          = 1 
skip_symbolic_links     = 1
# GENERAL #
user = mysql
default_storage_engine = InnoDB
character-set-server = utf8
socket  = /usr/local/mysql/data/mysql.sock
pid_file = /usr/local/mysql/data/mysqld.pid
basedir = /usr/local/mysql
port = 3306
bind-address = 0.0.0.0
explicit_defaults_for_timestamp = off
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#read_only=on
# MyISAM #
key_buffer_size                = 32M
#myisam_recover                 = FORCE,BACKUP

# undo log #
innodb_undo_directory = /usr/local/mysql/undo
innodb_undo_tablespaces = 8

# SAFETY #
max_allowed_packet             = 100M
max_connect_errors             = 1000000
sysdate_is_now                 = 1
#innodb = FORCE
#innodb_strict_mode = 1
secure-file-priv='/tmp'
default_authentication_plugin='mysql_native_password'
# Replice #
 server-id = 1001
 relay_log = mysqld-relay-bin
 gtid_mode = on
 enforce-gtid-consistency
 log-slave-updates = on
 master_info_repository =TABLE
 relay_log_info_repository =TABLE


# DATA STORAGE #
 datadir = /usr/local/mysql/data/
 tmpdir = /tmp
 
# BINARY LOGGING #
 log_bin = /usr/local/mysql/sql_log/mysql-bin
 max_binlog_size = 1000M
 binlog_format = row
 binlog_expire_logs_seconds=86400
# sync_binlog = 1

 # CACHES AND LIMITS #
 tmp_table_size                 = 32M
 max_heap_table_size            = 32M
 max_connections                = 4000
 thread_cache_size              = 2048
 open_files_limit               = 65535
 table_definition_cache         = 4096
 table_open_cache               = 4096
 sort_buffer_size               = 2M
 read_buffer_size               = 2M
 read_rnd_buffer_size           = 2M
# thread_concurrency             = 24
 join_buffer_size = 1M
# table_cache = 32768
 thread_stack = 512k
 max_length_for_sort_data = 16k


 # INNODB #
 innodb_flush_method            = O_DIRECT
 innodb_log_buffer_size = 16M
 innodb_flush_log_at_trx_commit = 2
 innodb_file_per_table          = 1
 innodb_buffer_pool_size        = 256M
 #innodb_buffer_pool_instances = 8
 innodb_stats_on_metadata = off
 innodb_open_files = 8192
 innodb_read_io_threads = 16
 innodb_write_io_threads = 16
 innodb_io_capacity = 20000
 innodb_thread_concurrency = 0
 innodb_lock_wait_timeout = 60
 innodb_old_blocks_time=1000
 innodb_use_native_aio = 1
 innodb_purge_threads=1
 innodb_change_buffering=all
 innodb_log_file_size = 64M
 innodb_log_files_in_group = 2
 innodb_data_file_path  = ibdata1:256M:autoextend
 
 innodb_rollback_on_timeout=on
 # LOGGING #
 log_error                      = /usr/local/mysql/sql_log/mysql-error.log
 # log_queries_not_using_indexes  = 1
 # slow_query_log                 = 1
  slow_query_log_file            = /usr/local/mysql/sql_log/slowlog.log

 # TimeOut #
 #interactive_timeout = 30
 #wait_timeout        = 30
 #net_read_timeout = 60

[mysqldump]
quick
max_allowed_packet = 100M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126

之后需要建立各种文件夹存储文件


最后需要在/etc/profile文件末尾添加配置mysql变量方便启动

接着初始化

mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
1
在运行此命令时,本人遇到了这个问题
mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
读者可以执行这种命令

yum install -y libaio
1
就可以解决了
最后把/mysql/support-files/mysql.sever文件移动到/etc/init.d/mysqld

cp  mysql.server /etc/init.d/mysqld
1
初始化

/etc/init.d/mysqld start
1

运用ps命令查看mysql进程状态

ps -ef | grep mysql
1

之后进行密码修改

cd sql_log
grep password mysql-error.log
1
2


之后修改密码

alter user user() identified by '123456'
1

之后再次mysql -uroot -p输入123456就可以进入了
————————————————
版权声明:本文为CSDN博主「慢熟的孩子」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_45400755/article/details/97686608

引用\[1\]:在安装MySQL8时,可能会遇到mariadb-libs被mysql-community-libs-8.0.xx-1.el7.x86_64所取代的报错。\[1\]引用\[2\]:在CentOS7安装MySQL时,常见的错误依赖问题是warning: mysql-community-libs-8.0.28-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY error: Failed dependencies: mariadb-libs is obsoleted by mysql-community-libs-8.0.28-1.el7.x86_64。\[2\]引用\[3\]:解决这个问题的方法是先卸载mysql-libs,然后再执行安装命令。具体步骤是先执行yum remove mysql-libs命令卸载mysql-libs,然后再执行rpm -ivh mysql-community-libs-8.0.28-1.el7.x86_64.rpm命令进行安装。\[3\] 所以,如果你在安装MySQL8时遇到mariadb-libs被mysql-community-libs-8.0.xx-1.el7.x86_64所取代的报错,你可以先卸载mysql-libs,然后再执行安装命令来解决这个问题。 #### 引用[.reference_title] - *1* [CentOS7安装MySQL8报错mariadb-libs is obsoleted by mysql-community-libs-8.0.xx-1.el7.x86_64](https://blog.csdn.net/u012069313/article/details/123185605)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [Linux_Centos7在安装Mysql常见错误依赖时失败——error: Failed dependencies:mariadb-libs is obsoleted](https://blog.csdn.net/qq_51929833/article/details/122966804)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值