一文详解CentOS如何安装MYSQL
来源:SegmentFault
时间:2023-01-27 14:07:38 385浏览 收藏
在IT行业这个发展更新速度很快的行业,只有不停止的学习,才不会被行业所淘汰。如果你是数据库学习者,那么本文《一文详解CentOS如何安装MYSQL》就很适合你!本篇内容主要包括一文详解CentOS如何安装MYSQL,希望对大家的知识积累有所帮助,助力实战开发!
CentOS版本
cat /etc/redhat-release >> CentOS release 5.4 (Final)
系统内核
uname -a >> Linux test33x.ops.xxx.net 2.6.18-164.el5xen #1 SMP Thu Sep 3 04:03:03 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
MYSQL下载
下载页面 Select Platform >> Red Hat Enterprise Linux / Oracle Linux 选择x86_64版本 MySQL-client-5.5.38-1.rhel5.x86_64.rpm MySQL-server-5.5.38-1.rhel5.x86_64.rpm MySQL-shared-5.5.38-1.rhel5.x86_64.rpm
卸载旧版本
yum remove mysql mysql-server mysql-libs rm -rf /var/lib/mysql rm /etc/my.cnf rpm -qa|grep mysql //查看是否安装了mysql数据库 >> rpm -e mysql --nodeps
MYSQL安装
rpm -ivh MySQL-client-5.5.38-1.rhel5.x86_64.rpm rpm -ivh MySQL-server-5.5.38-1.rhel5.x86_64.rpm rpm -ivh MySQL-shared-5.5.38-1.rhel5.x86_64.rpm
配置
【执行命令】 /usr/bin/mysql_secure_installation 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): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. You already have a root password set, so you can safely answer 'n'. Change the root password? [Y/n] Y New password: Re-enter new password: Password updated successfully! 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 ... Success! 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 ... 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 ... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL!
启动MYSQL
service mysql start >> Starting MySQL. [确定] service mysql status >> MySQL running (32239) [确定] service mysql stop >> Shutting down MySQL. [确定]
查看服务
chkconfig --list | grep mysql >> mysql 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭 chkconfig mysql on //设置开机自启动
查看版本
mysql -V >> mysql Ver 14.14 Distrib 5.5.38, for Linux (x86_64) using readline 5.1
连接MYSQL
mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 1 Server version: 5.5.38 MySQL Community Server (GPL) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql>
安装配置完成!
好了,本文到此结束,带大家了解了《一文详解CentOS如何安装MYSQL》,希望本文对你有所帮助!关注golang学习网公众号,给大家分享更多数据库知识!
声明:本文转载于:SegmentFault 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
-
499 收藏
-
244 收藏
-
235 收藏
-
157 收藏
-
101 收藏
最新阅读
更多>
-
475 收藏
-
266 收藏
-
273 收藏
-
283 收藏
-
210 收藏
-
371 收藏
课程推荐
更多>
-
- 前端进阶之JavaScript设计模式
- 设计模式是开发人员在软件开发过程中面临一般问题时的解决方案,代表了最佳的实践。本课程的主打内容包括JS常见设计模式以及具体应用场景,打造一站式知识长龙服务,适合有JS基础的同学学习。
- 立即学习 542次学习
-
- GO语言核心编程课程
- 本课程采用真实案例,全面具体可落地,从理论到实践,一步一步将GO核心编程技术、编程思想、底层实现融会贯通,使学习者贴近时代脉搏,做IT互联网时代的弄潮儿。
- 立即学习 507次学习
-
- 简单聊聊mysql8与网络通信
- 如有问题加微信:Le-studyg;在课程中,我们将首先介绍MySQL8的新特性,包括性能优化、安全增强、新数据类型等,帮助学生快速熟悉MySQL8的最新功能。接着,我们将深入解析MySQL的网络通信机制,包括协议、连接管理、数据传输等,让
- 立即学习 497次学习
-
- JavaScript正则表达式基础与实战
- 在任何一门编程语言中,正则表达式,都是一项重要的知识,它提供了高效的字符串匹配与捕获机制,可以极大的简化程序设计。
- 立即学习 487次学习
-
- 从零制作响应式网站—Grid布局
- 本系列教程将展示从零制作一个假想的网络科技公司官网,分为导航,轮播,关于我们,成功案例,服务流程,团队介绍,数据部分,公司动态,底部信息等内容区块。网站整体采用CSSGrid布局,支持响应式,有流畅过渡和展现动画。
- 立即学习 484次学习
评论列表
-
- 风中的画笔
- 很好,一直没懂这个问题,但其实工作中常常有遇到...不过今天到这,帮助很大,总算是懂了,感谢老哥分享博文!
- 2023-04-08 13:34:30
-
- 贤惠的故事
- 这篇技术文章出现的刚刚好,太详细了,受益颇多,收藏了,关注作者了!希望作者能多写数据库相关的文章。
- 2023-04-02 17:00:00
-
- 义气的爆米花
- 很详细,mark,感谢师傅的这篇博文,我会继续支持!
- 2023-04-01 23:07:03
-
- 落寞的大象
- 这篇博文真是及时雨啊,楼主加油!
- 2023-03-15 18:37:40
-
- 贪玩的糖豆
- 这篇文章太及时了,好细啊,很有用,已收藏,关注up主了!希望up主能多写数据库相关的文章。
- 2023-02-23 15:26:29
-
- 土豪的小鸽子
- 好细啊,码住,感谢师傅的这篇文章,我会继续支持!
- 2023-02-13 06:00:14
-
- 搞怪的老鼠
- 这篇技术文章真及时,up主加油!
- 2023-02-10 20:14:36
-
- 无限的宝贝
- 太给力了,一直没懂这个问题,但其实工作中常常有遇到...不过今天到这,帮助很大,总算是懂了,感谢up主分享技术文章!
- 2023-02-10 13:36:38