0

0

CentOS 6.5下安装MySQL 5.6.21

php中文网

php中文网

发布时间:2016-06-07 16:40:52

|

1095人浏览过

|

来源于php中文网

原创

linux中使用最广泛的数据库就是mysql,使用在线yum的方式安装的版本落后mysql网站好几个小版本,本节亲自测试安装新版的mysql。

MySQL安装

linux中使用最广泛的数据库就是mysql,使用在线yum的方式安装的版本落后mysql网站好几个小版本,本节亲自测试安装新版的mysql。

测试机器环境:

VMware Workstation 10 虚拟机

内存:1G

Linux版本:CentOS MinimalCD 6.5

JAVA:JAVA_HOME=/opt/jdk

安装mysql前需要查询系统中含有的有关mysql的软件。

rpm -qa | grep -i mysql //grep -i是不分大小写字符查询,只要含有mysql就显示

屏幕显示:

mysql-libs-5.1.71-1.el6.i686 //它是好几个软件的依赖,其中在mini版本中postfix软件依赖mysql-libs,网络上很多建议都是直接删除, yum remove mysql-libs 或者 rpm -e --nodeps mysql-libs-5.1.71-1.el6.i686,总觉得这样做不好。 查找mysql官方资料,得到安装方法是用MySQL-shared-compat将mysql-libs-5.1.71-1.el6.i686替换为同版本后在安装mysql。

下载mysql地址:

ba9ed174-94cc-49ca-94e8-ca8770febaa9

CentOS是RedHatLinux系列的,因此选择RedHatLinux(见红线地方),网页会自动变成RedHatLinux有关的mysql下载:

d6a270d5-5738-4e37-9f7f-f7466c168503

需要下载2个内容,一个是MySQL-5.6.21-1.el6.i686.rpm-bundle.tar,这个是几个程序的合集包,另一个是MySQL-shared-compat-5.6.21-1.el6.i686.rpm,这个是软件包包括MySQL 3.23和MySQL 4.0的共享库。如果你安装了应用程序动态连接MySQL 3.23,但是你想要升级到ySQL 4.0而不想打破库的从属关系,则安装该软件包而不要安装MySQL-shared。从MySQL 4.0.13起包含该安装软件包。

将2个文件上传到CentOS中,解压MySQL-5.6.21-1.el6.i686.rpm-bundle.tar。

ERMEB域名PHP离线网络授权系统
ERMEB域名PHP离线网络授权系统

感谢您选择使用ERMEB域名授权离线网络验证系统(简称:ERMEB域名授权系统)是ERMEB团队开发,ERMEB域名授权系统是国内最稳定,最强大,最先进的域名授权管理平台解决方案之一,ERMEB域名授权系统采用PHP +Mysql的技术,ERMEB域名授权系统框架使用Thinkphp6/mysql数据库基于Markdown开发者文档开发而成,项目安装请参考ThinkPHP官方文档及下面的服务环境说

下载

 

#tar xvf MySQL-5.6.21-1.el6.i686.rpm-bundle.tar MySQL-client-5.6.21-1.el6.i686.rpm MySQL-devel-5.6.21-1.el6.i686.rpm MySQL-shared-5.6.21-1.el6.i686.rpm MySQL-test-5.6.21-1.el6.i686.rpm MySQL-server-5.6.21-1.el6.i686.rpm MySQL-embedded-5.6.21-1.el6.i686.rpm #ls -l total 415068 -rw-r--r--. 1 root root 210442240 Nov 11 11:12 MySQL-5.6.21-1.el6.i686.rpm-bundle.tar -rw-r--r--. 1 7155 wheel 17813608 Sep 12 16:25 MySQL-client-5.6.21-1.el6.i686.rpm -rw-r--r--. 1 7155 wheel 3131328 Sep 12 16:25 MySQL-devel-5.6.21-1.el6.i686.rpm -rw-r--r--. 1 7155 wheel 83106000 Sep 12 16:25 MySQL-embedded-5.6.21-1.el6.i686.rpm -rw-r--r--. 1 7155 wheel 54611632 Sep 12 16:26 MySQL-server-5.6.21-1.el6.i686.rpm -rw-r--r--. 1 7155 wheel 1878756 Sep 12 16:27 MySQL-shared-5.6.21-1.el6.i686.rpm -rw-r--r--. 1 root root 4141488 Nov 18 14:42 MySQL-shared-compat-5.6.21-1.el6.i686.rpm -rw-r--r--. 1 7155 wheel 49887932 Sep 12 16:27 MySQL-test-5.6.21-1.el6.i686.rpm

 

安装MySQL-shared-compat替换mysql-libs,如果不替换,在删除mysql-libs,会提示postfix依赖于mysql-libs:

# rpm -i MySQL-shared-compat-5.6.21-1.el6.i686.rpm # rpm -qa | grep -i mysql mysql-libs-5.1.71-1.el6.i686 MySQL-shared-compat-5.6.21-1.el6.i686 # yum remove mysql-libs

测试MySQL-server安装,提示需要安装perl:

# rpm -ivh --test MySQL-server-5.6.21-1.el6.i686.rpm # yum install perl

安装MySQL-server,MySQL-client:

 

# rpm -ivh MySQL-server-5.6.21-1.el6.i686.rpm Preparing... ########################################### [100%] 1:MySQL-server ########################################### [100%] ……………… ……………… A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER ! You will find that password in '/root/.mysql_secret'. You must change that password on your first connect, no other statement but 'SET PASSWORD' will be accepted. See the manual for the semantics of the 'password expired' flag. Also, the account for the anonymous user has been removed. In addition, you can run: /usr/bin/mysql_secure_installation ……………… ……………… # rpm -ivh MySQL-client-5.6.21-1.el6.i686.rpm Preparing... ########################################### [100%] 1:MySQL-client ########################################### [100%]

 

在安装MySQL-server,见上面的一段话,大意是全新安装设置的root密码在/root/.mysql_secret中,,这是一个随机密码,你需要运行/usr/bin/mysql_secure_installation,删除anonymous用户。当然不建议用root用户来运行,rpm包已经建了一个mysql用户,可以使用这个用户:

 

#more .mysql_secret # The random password set for the root user at Tue Nov 18 22:57:46 2014 (local t ime): NljqL63OYlGo5cqy # service mysql start Starting MySQL... SUCCESS! # /usr/bin/mysql_secure_installation --user=mysql NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): ? [Y/n] y -enter new password: ! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y n并回车,建议禁止 ... Success! By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y 是否重新加载权限表,输入y并回车 ... Success! All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL! Cleaning up...

 

至此,MySQL已经安装完成,最后看一下是否已将MySQL加到开机服务里:

相关专题

更多
javascript void运算符
javascript void运算符

void是一元运算符,执行右侧表达式但始终返回undefined;用于丢弃返回值、阻止a标签跳转、IIFE忽略结果、动态导入不取Promise、安全获取undefined。本专题为大家提供相关的文章、下载、课程内容,供大家免费下载体验。

1

2025.12.29

vscode的界面字体大小调整
vscode的界面字体大小调整

调整VSCode界面字体大小可通过设置编辑器或整体UI缩放实现;2.修改"Editor:FontSize"改变代码字体;3.设置"Window:ZoomLevel"调整整体界面字体;4.使用Ctrl+滚轮快捷键临时缩放。本专题为大家提供相关的文章、下载、课程内容,供大家免费下载体验。

1

2025.12.29

VSCode的注释快捷键
VSCode的注释快捷键

单行注释快捷键为Ctrl+/(Windows/Linux)或Cmd+/(macOS),块注释使用Shift+Alt+A(Windows/Linux)或Shift+Option+A(macOS),VSCode会根据语言类型自动匹配语法,如JavaScript用//,Python用#,C++用//,若快捷键无效需检查语言扩展或插件冲突。本专题为大家提供相关的文章、下载、课程内容,供大家免费下载体验。

1

2025.12.29

Golang 命令行工具(CLI)开发实战
Golang 命令行工具(CLI)开发实战

本专题系统讲解 Golang 在命令行工具(CLI)开发中的实战应用,内容涵盖参数解析、子命令设计、配置文件读取、日志输出、错误处理、跨平台编译以及常用CLI库(如 Cobra、Viper)的使用方法。通过完整案例,帮助学习者掌握 使用 Go 构建专业级命令行工具与开发辅助程序的能力。

4

2025.12.29

ip地址修改教程大全
ip地址修改教程大全

本专题整合了ip地址修改教程大全,阅读下面的文章自行寻找合适的解决教程。

165

2025.12.26

压缩文件加密教程汇总
压缩文件加密教程汇总

本专题整合了压缩文件加密教程,阅读专题下面的文章了解更多详细教程。

56

2025.12.26

wifi无ip分配
wifi无ip分配

本专题整合了wifi无ip分配相关教程,阅读专题下面的文章了解更多详细教程。

108

2025.12.26

漫蛙漫画入口网址
漫蛙漫画入口网址

本专题整合了漫蛙入口网址大全,阅读下面的文章领取更多入口。

356

2025.12.26

b站看视频入口合集
b站看视频入口合集

本专题整合了b站哔哩哔哩相关入口合集,阅读下面的文章查看更多入口。

703

2025.12.26

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
MySQL 初学入门(mosh老师)
MySQL 初学入门(mosh老师)

共3课时 | 0.3万人学习

nginx浅谈
nginx浅谈

共15课时 | 0.8万人学习

PHP基础入门课程
PHP基础入门课程

共33课时 | 1.9万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号