本文主要给大家介绍mysql5.7编译安装流程简析,希望可以给大家补充和更新些知识,如有其它问题需要了解的可以持续在Vecloud行业资讯里面关注我的更新文章的。
mysql5.7编译安装过程
mkdir -p /data/{mysql,conf}
下载mysql5.7源码包cd /usr/local/src
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.22.tar.gz
tar xf mysql-5.7.22.tar.gz
下载boostwget -zxvf boost_1_59_0.tar.gz -C /usr/local
mv /usr/local/boost_1_59_0 /usr/local/boost
#安装
yum -y groupinstall "Development tools"
yum -y install wget iproute iotop mtr perf telnet dstat iftop vim cmake gcc gcc-c++ bison ncurses ncurses-devel
yum -y install libxml2 libxml2-devel openssl-devel bzip2 bzip2-devel libcurl-devel libjpeg libjpeg-devel libpng-devel libicu-devel libmcrypt-devel freetype-devel libtidy libtidy-devel ImageMagick-devel mhash mhash-devel pcre-devel libzip postgresql-devel
groupadd -g 306 mysql
useradd -g mysql -u 306 -s /sbin/nologin -M mysql
mkdir /data/mysql -pv
chown -R mysql.mysql /data/mysql
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DWITH_BOOST=/usr/local/boost -DSYSCONFDIR=/etc -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=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EMBEDDED_SERVER=1
make && make install
#设置权限
chown -R mysql:mysql /data/mysql
添加配置文件vim /etc/my.cnf
[mysqld]
port=3306
basedir=/usr/local/mysql
datadir=/data/mysql
character-set-server=utf8
default-storage-engine=InnoDB
max_connections=5120
query_cache_size=0
tmp_table_size=18M
log-error = /data/mysql/mysql-error.log
thread_cache_size=8
myisam_max_sort_file_size=64G
myisam_sort_buffer_size=35M
key_buffer_size=25M
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=256K
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M
innodb_buffer_pool_size=47M
innodb_log_file_size=24M
innodb_thread_concurrency=8
初始化mysql/usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
添加MySQL环境变量echo "export PATH=/usr/local/mysql/bin:$PATH" >> /etc/profile
source /etc/profile
导出头文件ln -sv /usr/local/mysql/include /usr/include/mysqld
导出库文件echo "/usr/local/mysql/lib" > /etc/ld.so.conf.d/mysql.conf
ldconfig
添加启动脚本cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
启动服务,启动服务之后可以直接无码密码登录,如果无法登录继续下面两步/etc/init.d/mysqld start
找到mysql5.7的初始密码grep "temporary password" /data/mysql/mysql-error.log
2018-09-25T06:30:28.930040Z 1 [Note] A temporary password is generated for root@localhost: Ui4/OupkjroO
修改密码mysql -uroot -pUi4/OupkjroO
mysql>alter user root@localhost identified by 'yourpassword';
看了以上关于mysql5.7编译安装流程简析,希望能给大家在实际运用中带来一定的帮助。本文由于篇幅有限,难免会有不足和需要补充的地方,如有需要更加专业的解答,可在官网联系我们的24小时售前售后,随时帮您解答问题的。
mysql5.7编译安装流程简析
于 2022-07-20 13:56:48 首次发布