下面讲讲关于CentOS7.5中mysql 5.7.22编译安装的详细步骤,文字的奥妙在于贴近主题相关。所以,闲话就不谈了,我们直接看下文吧,相信看完CentOS7.5中mysql 5.7.22编译安装的详细步骤这篇文章你一定会有所受益。
"热情、务实、专业、创新”我们不忘初心,砥砺前行,实在做人,认真做事,始终如一的专注企业互联网品牌建设与网络营销推广服务。成都品牌网站建设本着让客户满意的目标,帮助企业通过互联网创造价值.创新互联全体员工将通过不懈努力,力争成为客户在信息化领域中值得长期信赖的合作伙伴。1 mysql安装配置
在db01上操作
1.1 卸载自带的mariadb相关软件包
# rpm -qa|grep mariadb
mariadb-libs-5.5.56-2.el7.x86_64
# rpm -e mariadb-libs-5.5.56-2.el7.x86_64 --nodeps
# yum install libaio-devel ncurses-devel cmake gcc gcc-c++ bison -y
1.2 创建相关目录
mkdir -p /usr/local/mysql/tmp -p
mkdir -p /usr/local/mysql/log -p
mkdir /usr/local/mysql/mysql_log-bin/ -p #指定binlog日志存放路径
useradd -s /sbin/nologin -M mysql
cd /server/tools/
解压mysql-boost-5.7.22.tar.gz包,该包里包含了boost包和mysql包,从MySQL 5.7.5开始Boost库是必需的
# tar xf mysql-boost-5.7.22.tar.gz
1.3 编译安装
# cd mysql-5.7.22/
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=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 \
-DWITH_EMBEDDED_SERVER=1
# make
# make install
# echo "export PATH=$PATH:/usr/local/mysql/bin/" >>/etc/profile
# source /etc/profile
1.4 拷贝启动脚本,设为开机自启动
# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
# chmod +x /etc/init.d/mysqld
# chkconfig --add mysqld
# chkconfig mysqld on
1.5 创建mysql配置文件
cat >/etc/my.cnf < [mysqld] basedir = /usr/local/mysql/ datadir = /usr/local/mysql/data/ tmpdir = /usr/local/mysql/tmp/ pid-file = /usr/local/mysql/data/my.pid port = 3306 default_storage_engine = InnoDB innodb_autoinc_lock_mode = 2 explicit_defaults_for_timestamp = true character-set-client-handshake = FALSE character_set_server = utf8 skip-name-resolve max_connections=1000 max_connect_errors = 1000000 max_allowed_packet = 1G connect_timeout = 3600 wait_timeout = 3600 interactive_timeout = 3600 innodb_lock_wait_timeout = 10 slave-skip-errors = 1032,1062 log-error = /usr/local/mysql/log/error.log slow_query_log = on slow_query_log_file = /usr/local/mysql/log/slow-query-log.log long_query_time = 1 log-queries-not-using-indexes log-slow-admin-statements log-slow-slave-statements server-id = 100 log-bin = /usr/local/mysql/mysql_log-bin/log-bin #指定binlog日志存放路径 binlog-format = ROW EOF 1.6 初始化数据库 之前版本mysql_install_db是在mysql_basedir/script下,5.7放在了mysql_install_db/bin目录下,且已被废弃 "--initialize"会生成一个随机密码(~/.mysql_secret),而"--initialize-insecure"不会生成密码 --datadir目标目录下不能有数据文件 # chown -R mysql.mysql /usr/local/mysql/ # mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data # mysqld_safe --defaults-file=/etc/my.cnf & #启动mysql服务 # /etc/init.d/mysqld start #启动mysql服务,同上条命令一样 # mysql #登录mysql,没有密码 # mysqladmin -uroot password sjk2018zpkj #设置root密码为sjk2018 # mysql -uroot -psjk2018zpkj -e "grant all on *.* to root@'172.17.53.%' identified by 'sjk2018zpkj';" mysql> create user test@'172.17.53.%' identified by 'pt2017'; mysql> flush privileges; 对于以上CentOS7.5中mysql 5.7.22编译安装的详细步骤相关内容,大家还有什么不明白的地方吗?或者想要了解更多相关,可以继续关注我们的行业资讯板块。 另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
文章名称:CentOS7.5中mysql5.7.22编译安装的详细步骤-创新互联
本文链接:http://njwzjz.com/article/epise.html