CentOs7 64位 mysql 5.6.40源码安装过程
linux  /  管理员 发布于 7年前   132
1.首先安装依赖包,避免在安装过程中出现问题
[root@chufeng yusen]# yum -y install wget vim bash-completion[root@chufeng yusen]# yum -y install gcc gcc-c++ cmake ncurses-devel autoconf perl perl-devel
2.下载mysql-5.6.40.tar.gz
MySQLxxx下载地址: https://dev.mysql.com/downloads/mysql/5.6.html#downloads
源码包地址: https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.40.tar.gz
[root@chufeng yusen]# wget https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.40.tar.gz[root@chufeng yusen]# ls mysql-5.6.40.tar.gz
3.创建mysql安装目录以及数据存放目录
[root@chufeng yusen]# mkdir -p /usr/local/mysql/data
4.创建用户、用户组
[root@chufeng yusen]# groupadd mysql[root@chufeng yusen]# useradd -r -g mysql mysql
5.解压缩文件到当前文件夹及安装
[root@chufeng yusen]# tar -zxvf mysql-5.6.40.tar.gz[root@chufeng yusen]# cd mysql-5.6.40[root@chufeng mysql-5.6.40]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \-DINSTALL_DATADIR=/usr/local/mysql/data \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci \-DEXTRA_CHARSETS=all \-DENABLED_LOCAL_INFILE=1[root@chufeng mysql-5.6.40]# make && make install
CMAKE参数说明:
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql //默认安装目录
-DINSTALL_DATADIR=/usr/local/mysql/data //数据库存放目录
-DDEFAULT_CHARSET=utf8 //使用utf8字符
-DDEFAULT_COLLATION=utf8_general_ci //校验字符
-DEXTRA_CHARSETS=all //安装所有扩展字符集
-DENABLED_LOCAL_INFILE=1 //允许从本地导入数据
-DMYSQL_USER=mysql
-DMYSQL_TCP_PORT=3306
CMAKE详细配置请参照mysql官网
注意事项:
如安装失败重新编译时,需要清除旧的对象文件和缓存信息。
[root@chufeng mysql-5.6.40]# make clean[root@chufeng mysql-5.6.40]# rm -f CMakeCache.txt[root@chufeng mysql-5.6.40]# rm -rf /etc/my.cnf
6.设置目录权限
[root@chufeng yusen]# cd /usr/local/mysql[root@chufeng mysql]# chown -R mysql:mysql .[root@chufeng mysql]# chown -R mysql:mysql data
7.将mysql的启动服务添加到系统服务中
[root@chufeng yusen]# cd /usr/local/mysql[root@chufeng mysql]# cp support-files/my-default.cnf /etc/my.cnf
8.创建基础表
[root@chufeng yusen]# cd /usr/local/mysql[root@chufeng mysql]# ./scripts/mysql_install_db --user=mysql
9.配置环境变量(添加下面两条)
[root@chufeng yusen]# vim /etc/profileexport MYSQL_HOME="/usr/local/mysql"export PATH="$PATH:$MYSQL_HOME/bin"**#加载环境变量**[root@chufeng yusen]# source /etc/profile
10.将mysql启动文件添加到系统启动文件中
[root@chufeng yusen]# cd /usr/local/mysql/[root@chufeng mysql]# cp support-files/mysql.server /etc/init.d/mysql
11.mysql的 启动 停止 及 重启命令
启动mysql服务
[root@chufeng yusen]# systemctl start mysql
重启mysql服务
[root@chufeng yusen]# systemctl restart mysql
停止mysql服务
[root@chufeng yusen]# systemctl stop mysql
开机自启
[root@chufeng yusen]# systemctl enable mysql
或者:
启动mysql服务
[root@chufeng yusen]# service mysql start
重启mysql服务
[root@chufeng yusen]# service mysql restart
停止mysql服务
[root@chufeng yusen]# service mysql stop
将服务添加到开机启动指令管理的服务列表中
chkconfig --add mysql
开机自启
chkconfig mysql on
12.修改mysql密码
[root@chufeng yusen]# mysqladmin -u root passwordNew password: Confirm new password:[root@chufeng yusen]#
13.连接 Mysql
[root@chufeng yusen]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.6.40 Source distributionCopyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
在此mysql-5.6.40源码安装就完成了
总结
以上所述是小编给大家介绍的CentOs7 64位 mysql 5.6.40源码安装过程,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!
122 在
学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..123 在
Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..原梓番博客 在
在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..博主 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..1111 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号