首页 / MYSQL / 二进制安装MySQL-5.5.33
二进制安装MySQL-5.5.33
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了二进制安装MySQL-5.5.33,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含11565字,纯文字阅读大概需要17分钟。
内容图文
二进制安装MySQL很方便,相比较编译安装,美中不足的就是安装包太大了。哈哈
开始安装,首先养成好习惯,创建一个专门存放安装包的目录
mkdir -p /home/yuci/tools
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8C/F1/wKiom1h-4SPRtIT4AAAJcjP8qV0090.png" "353" height="28" />
安装 lrzsz 可以在xshell下直接将安装包拖拽到指定目录下
yum -y install lrzsz
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M01/8C/F1/wKiom1h-4SSyUUIEAAAH1F5-G-4869.png" "322" height="26" />
将 mysql 安装包拖拽到 /home/yuci/tools 目录下,解压就OK了
cd /home/yuci/tools/
tar zxf mysql-5.5.33-linux2.6-x86_64.tar.gz
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8C/F1/wKiom1h-4SWCYKTYAAAnZ0tNwDs199.png" "541" height="104" />
创建 mysql 用户,并检查
useradd -s /sbin/nologin/ -M mysql
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8C/EE/wKioL1h-4SXRwodLAAAcK_GjHvc204.png" "453" height="88" />
再次创建一个 mysql 真正的安装目录,之前那个是存放安装包的目录
mkdir /application
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M00/8C/EE/wKioL1h-4SWgdI_KAAAIYUY-BOc091.png" "330" height="24" />
将刚才解压出来的 mysql 移动到 /application 目录下,保留版本号
mv mysql-5.5.33-linux2.6-x86_64 /application/mysql-5.5.33
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M00/8C/F1/wKiom1h-4SrBH27IAAAU_rXUwFI152.png" "637" height="56" />
在给 mysql 创建一个没有版本号的软连接
ln -s /application/mysql-5.5.33/ /application/mysql
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8C/F1/wKiom1h-4Srhnm2YAAAjZbq3-IA972.png" "630" height="87" />
初始化 mysql ,看到两个 OK 说明到目前为止 mysql 的安装配置一切正常
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8C/EE/wKioL1h-4SvCIkmRAABOfw45SXY864.png" "656" height="214" />
授权 mysql 用户
chown -R mysql:mysql /application/mysql
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M01/8C/F1/wKiom1h-4SyTN3y9AAALIIDWm2Y484.png" "495" height="26" />
拷贝 mysql 的配置文件,my.cnf
cp /application/mysql/support-files/my-small.cnf /etc/my.cnf
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8C/F1/wKiom1h-4SzCQOdtAAASZj6t_i4279.png" "661" height="41" />
mysqld_safe 是 mysql 的启动脚本,默认的 mysql 安装位置是 /usr/local/mysql ,但是我们的安装路径是 /application/mysql,所以需要通过 sed 更改一下
sed -i ‘s#/usr/local/mysql#/application/mysql#g‘ /application/mysql/bin/mysqld_safe
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M01/8C/F1/wKiom1h-4S2Aq9vtAAAQ-0RSr8A201.png" "734" height="40" />
尝试启动 mysql 并放入后台执行
/application/mysql/bin/mysqld_safe &
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8C/EE/wKioL1h-4S2AZgcEAAALOPEggog704.png" "487" height="29" />
检查 mysql 的 3306 端口,确认 mysql 是否启动
lsof -i :3306
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M00/8C/F1/wKiom1h-4S7jtiI2AAAWe-FmYDw065.png" "566" height="58" />
现在 mysql 启动了,但是还需要配置环境变量,才能登陆 mysql
vim /etc/profile
PATH="/application/mysql/bin:$PATH"
source /etc/profile
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8C/EE/wKioL1h-4S6heSd4AAAIGo1AtCg385.png" "306" height="25" />
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M00/8C/F1/wKiom1h-4S-zcK7zAAALEo2AQJ8085.png" "340" height="53" />
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M01/8C/EE/wKioL1h-4S_BKfBaAAAIXfe9qKQ735.png" "349" height="24" />
尝试登陆 mysql 成功
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M01/8C/F1/wKiom1h-4TCh4Dy_AABDt_3V4zE551.png" "648" height="235" />
拷贝 mysql 的启动脚本,修改里面的安装路径,添加执行权限,方便 mysql 的重启
cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld
sed -i ‘s#/usr/local/mysql#/application/mysql#g‘ /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M00/8C/F1/wKiom1h-4THzwOJLAAAeyTmJfpw379.png" "719" height="57" />
通过 killall 命令,将 mysql 进程杀死,直到出现 no process killed
killall mysqld
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M01/8C/F1/wKiom1h-4THyNuHlAAAqvWYpClU683.png" "733" height="120" />
通过 lsof 命令检查 3306 端口还是否开启
lsof -i :3306
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8C/F1/wKiom1h-4TLAoqW_AAALZMWh0Uw067.png" "311" height="59" />
通过刚才的拷贝的脚本启动 mysql
/etc/init.d/mysqld start
lsof -i :3306
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M00/8C/F1/wKiom1h-4TKQmVO5AAAipZghd4w106.png" "567" height="90" />
给 mysql 添加开机自启动,并检查
chkconfig mysqld on
chkconfig --list mysqld
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8C/F1/wKiom1h-4TPBlD4sAAAU5exHiJ0427.png" "575" height="57" />
最后给 mysql 管理员设定一个密码
mysqladmin -uroot password "123456"
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M02/8C/EE/wKioL1h-4TOzfAaLAAAKUoml2HU444.png" "461" height="24" />
登陆成功,mysql 二进制安装完成
<img alt="技术分享" onload="if(this.width>650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://s3.51cto.com/wyfs02/M01/8C/F1/wKiom1h-4TSyZeLJAABK4MBJqLI847.png" "649" height="244" />
二进制安装MySQL-5.5.33
标签:blank target border 二进制 color
本文系统来源:http://aby028.blog.51cto.com/5371905/1892818
内容总结
以上是互联网集市为您收集整理的二进制安装MySQL-5.5.33全部内容,希望文章能够帮你解决二进制安装MySQL-5.5.33所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。