mysql5.7编译安装流程简析
本文主要给大家介绍MySQL5.7编译安装流程简析,希望可以给大家补充和更新些知识,如有其它问题需要了解的可以持续在创新互联行业资讯里面关注我的更新文章的。
成都创新互联公司坚持“要么做到,要么别承诺”的工作理念,服务领域包括:做网站、成都网站制作、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的榆中网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!
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
下载boost
wget http://www.sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
tar -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编译安装流程简析
本文地址:http://azwzsj.com/article/peodse.html