我是靠谱客的博主 贤惠薯片,最近开发中收集的这篇文章主要介绍mysql 8.0.29 源码安装#1 源码编译#2 配置参数#3 初始化#4 启动#使用了gcc高版本编译, 可能涉及升级,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

参考 5.7.26 源码linux安装_huguangshanse00的博客-CSDN博客

#1 源码编译

[wln@localhost source]$ cat auto.sh
cmake ../mysql-8.0.29 -DCMAKE_INSTALL_PREFIX=/home/wln/install/mysql8029 
-DMYSQL_DATADIR=/home/wln/app/mysql/data 
-DWITH_BOOST=/home/wln/source/mysql-8.0.29/boost/boost_1_77_0 
-DSYSCONFDIR=/home/wln/source/mysqlconf 
-DWITH_INNOBASE_STORAGE_ENGINE=1 
-DWITH_PARTITION_STORAGE_ENGINE=1 
-DWITH_FEDERATED_STORAGE_ENGINE=1 
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 
-DWITH_MYISAM_STORAGE_ENGINE=1 
-DENABLED_LOCAL_INFILE=1 
-DENABLE_DTRACE=0 
-DDEFAULT_CHARSET=utf8mb4 
-DDEFAULT_COLLATION=utf8mb4_general_ci 
-DWITH_EMBEDDED_SERVER=off 
-DWITH_DEBUG=1

-DCMAKE_C_COMPILER=/usr/bin/gcc 
-DCMAKE_CXX_COMPILER=/usr/bin/g++
make -j6
make install

#2 配置参数

路径位置 /home/wln/source/mysqlconf/my.conf

内容

[client]
port = 3306
socket = /tmp/wln/mysql.sock
default-character-set = utf8mb4
[mysqld]
port = 3306
socket = /tmp/wln/mysql.sock
basedir = /home/wln/install/mysql8029
datadir = /home/wln/app/mysql/data
pid-file = /home/wln/app/mysql/mysql.pid
innodb_undo_directory=/home/wln/app/mysql//undo
innodb_undo_tablespaces=4
innodb_undo_log_truncate=1
#innodb_undo_logs=128
innodb_log_group_home_dir=/home/wln/app/mysql/redo
innodb_log_files_in_group = 3
log-bin=/home/wln/app/mysql/binlog
binlog-do-db = db1
binlog-do-db = db2
binlog-do-db = db3
binlog-ignore-db = mysql
user = wln
bind-address = 0.0.0.0
server-id = 1
init-connect = 'SET NAMES utf8mb4'
character-set-server = utf8mb4
#skip-grant-tables
#skip-name-resolve
#skip-networking
back_log = 300
max_connections = 1000
max_connect_errors = 6000
open_files_limit = 65535
table_open_cache = 128
max_allowed_packet = 4M
binlog_cache_size = 1M
max_heap_table_size = 8M
tmp_table_size = 16M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
join_buffer_size = 8M
key_buffer_size = 4M
thread_cache_size = 8
ft_min_word_len = 4
log_bin = mysql-bin
binlog_format = mixed
expire_logs_days = 30
log_error = /home/wln/app/mysql/log/mysql-error.log
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /home/wln/app/mysql/slowlog/mysql-slow.log
performance_schema = 0
explicit_defaults_for_timestamp
#lower_case_table_names = 1
skip-external-locking
default_storage_engine = InnoDB
#default-storage-engine = MyISAM
innodb_file_per_table = 1
innodb_open_files = 500
innodb_buffer_pool_size = 64M
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_thread_concurrency = 0
innodb_purge_threads = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 2M
innodb_log_file_size = 32M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
bulk_insert_buffer_size = 8M
myisam_sort_buffer_size = 8M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
interactive_timeout = 28800
wait_timeout = 28800
#core-file
[mysqldump]
quick
max_allowed_packet = 16M
[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
read_buffer = 4M
write_buffer = 4M

#3 初始化

清理目录

[wln@localhost source]$ cat cleanmysql.sh
mkdir -p ~/app/mysql
mkdir -p /tmp/wln
rm -rf ~/app/mysql/*
rm -rf /tmp/wln/mysql.sock
rm -rf /tmp/wln/mysql.sock.lock
mkdir -p ~/app/mysql/boost1770
mkdir -p ~/app/mysql/data
mkdir -p ~/app/mysql/log
mkdir -p ~/app/mysql/slowlog
mkdir /home/wln/app/mysql/redo
mkdir /home/wln/app/mysql/undo
mkdir /home/wln/app/mysql/binlog

初始化

[wln@localhost source]$ cat initmysql.sh
mysqld --defaults-file=/home/wln/source/mysqlconf/my.cnf
--initialize
--user=wln --basedir=/home/wln/install/mysql8029
--datadir=/home/wln/app/mysql/data
--pid-file=/home/wln/app/mysql/mysql.pid
--socket=/tmp/wln/mysql.sock
--log-bin=/home/wln/app/mysql/binlog/binlog

#4 启动

 mysqld --defaults-file=/home/wln/source/mysqlconf/my.cnf &

登陆

mysql -u root -p

输入密码 

更新密码

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'admin';

若忘记root密码

首先设置my.cnf 中skip-grant-tables ,然后重启,然后执行

use mysql;  update user set authentication_string = '' where user = 'root';  --设置root密码为空

然后注释掉skip-grant-tables 然后重启登陆重新用上面alter use 命令设置密码。
 

#使用了gcc高版本编译, 可能涉及升级

Centos7.9 gcc4.8.5升级到gcc11

最后

以上就是贤惠薯片为你收集整理的mysql 8.0.29 源码安装#1 源码编译#2 配置参数#3 初始化#4 启动#使用了gcc高版本编译, 可能涉及升级的全部内容,希望文章能够帮你解决mysql 8.0.29 源码安装#1 源码编译#2 配置参数#3 初始化#4 启动#使用了gcc高版本编译, 可能涉及升级所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(38)

评论列表共有 0 条评论

立即
投稿
返回
顶部