mysql8 源码官方下载mysql8编译mysql8安装

ubuntu22下的mysql8 源码带boost官方下载,mysql8 源码编译debug安装

##mysql8源码下载地址

mkdir -p /home/yym/mysql8/

cd /home/yym/mysql8/

##mysql8.1.0

wget https://cdn.mysql.com//Downloads/MySQL-8.1/mysql-boost-8.1.0.tar.gz
 

##mysql8.2.0

wget https://cdn.mysql.com//Downloads/MySQL-8.2/mysql-boost-8.2.0.tar.gz

##解压mysql8.1.0源码

tar -zxvf mysql-boost-8.1.0.tar.gz

##安装依赖包

sudo apt install openssl

sudo apt install libssl-dev

sudo apt install libncurses-dev

##cmake

sudo apt install cmake

cd /home/yym/mysql8/mysql-8.1.0

mkdir -p build

##进入build目录cmake,cmake产生文件放到build目录下

cd /home/yym/mysql8/mysql-8.1.0/build

sudo cmake .. -DCMAKE_INSTALL_PREFIX=/home/yym/mysql8-install/mysql -DMYSQL_DATADIR=/home/yym/mysql8-install/data -DSYSCONFDIR=/home/yym/mysql8-install/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/home/yym/mysql8/mysql-8.1.0/boost -DWITH_DEBUG=1

##12核cpu编译

cd /home/yym/mysql8/mysql-8.1.0/build

sudo make -j12

##安装

sudo make install

##my.cnf文件配置

[client]
default-character-set=utf8mb4
socket=/home/yym/mysql8-install/data/mysql.sock

[mysqld]
datadir=/home/yym/mysql8-install/data/
basedir=/home/yym/mysql8-install/mysql/
socket=/home/yym/mysql8-install/data/mysql.sock
log-bin=/home/yym/mysql8-install/logs/mysql-bin
binlog-format=Row
character-set-server=utf8mb4
default-storage-engine=INNODB
#Disabling symbolic-links is recommended to prevent assorted security risks
log-error=/home/yym/mysql8-install/data/mysqld.log
pid-file=/home/yym/mysql8-install/data/mysqld.pid
server-id=156

##初始化mysql

cd /home/yym/mysql8-install/mysql/bin

./mysqld --defaults-file=/home/yym/mysql8-install/etc/my.cnf --initialize --user=mysql --port=3306

##查看密码

yym@ubantu22:~/mysql8-install/data$ cat mysqld.log | grep password
2024-01-11T01:51:14.316729Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: lyC+Px*gX6tF

##启动mysql进程

cd /home/yym/mysql8-install/mysql/bin

mysqld_safe --defaults-file=/home/yym/mysql8-install/etc/my.cnf --user=mysql --port=3306 &

##连接mysql

mysql -h127.0.0.1 -uroot -p -P3306

##修改密码

ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

你可能感兴趣的:(mysql,数据库)