CentOs7.x安装Mysql的详细教程
作者:qq_23980427 时间:2024-01-27 11:11:45
CentOS7的yum源中默认好像是没有MySQL的。为了解决这个问题,我们要先下载mysql的repo源。
1. 下载mysql的repo源
$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2. 安装mysql-community-release-el7-5.noarch.rpm包
$ sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
安装这个包后,会获得两个mysql的yum repo源:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo。
3. 安装mysql
$ sudo yum install mysql-server
根据步骤安装就可以了,不过安装完成后,没有密码,需要重置密码。
4. 重置密码
重置密码前,首先要登录
mysql−uroot登录时有可能报这样的错:ERROR2002(HY000):Can‘tconnecttolocalMySQLserverthroughsocket‘/var/lib/mysql/mysql.sock‘(2),原因是/var/lib/mysql的访问权限问题。下面的命令把/var/lib/mysql的拥有者改为当前 sudo chown -R openscanner:openscanner /var/lib/mysql重启服务:
$ service mysqld restart
接下来登录重置密码:
$ mysql -u root
mysql > use mysql;
mysql > update user set password=password(‘123456‘) where user=‘root‘;
mysql > exit;
5. 开放3306端口
$ sudo vim /etc/sysconfig/iptables
添加以下内容:
-A INPUT -p tcp -m state –state NEW -m tcp –dport 3306 -j ACCEPT
保存后重启防火墙:
$ sudo service iptables restart
这样从其它客户机也可以连接上mysql服务了。
以上所述是小编给大家介绍的CentOs7.x安装Mysql的详细教程网站的支持!
来源:http://blog.csdn.net/qq_23980427/article/details/53863486
标签:centos7,安装,mysql
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python爬取网易云音乐评论
2021-02-23 11:23:02
python中dict()的高级用法实现
2022-06-16 23:24:29
![](https://img.aspxhome.com/file/2023/2/84122_0s.png)
python爬虫_实现校园网自动重连脚本的教程
2021-10-12 22:56:37
![](https://img.aspxhome.com/file/2023/5/123695_0s.jpg)
Python实现将wav转amr,并转换成hex数组
2023-06-29 08:18:59
![](https://img.aspxhome.com/file/2023/0/59650_0s.png)
浅谈MySQL数据库崩溃(crash)的常见原因和解决办法
2024-01-17 12:52:58
![](https://img.aspxhome.com/file/2023/1/124861_0s.png)
Django模型修改及数据迁移实现解析
2022-05-20 10:20:40
Python无损音乐搜索引擎实现代码
2021-01-28 19:19:02
![](https://img.aspxhome.com/file/2023/5/67325_0s.jpg)
详解如何使用vue-cli脚手架搭建Vue.js项目
2023-07-02 17:05:19
![](https://img.aspxhome.com/file/2023/1/139921_0s.png)
ASP中一个字符串处理类加强版
2008-11-25 18:07:00
mysql 批量更新与批量更新多条记录的不同值实现方法
2024-01-18 22:56:18
python 利用PyAutoGUI快速构建自动化操作脚本
2021-08-04 15:42:14
![](https://img.aspxhome.com/file/2023/5/107505_0s.png)
基于PyQT5制作一个桌面摸鱼工具
2021-02-06 17:57:21
MySQL中使用or、in与union all在查询命令下的效率对比
2024-01-16 02:28:45
![](https://img.aspxhome.com/file/2023/3/128373_0s.jpg)
细化解析:SQL Server 2005 数据库镜像
2009-01-23 13:41:00
ASP.NET MVC4入门教程(六):验证编辑方法和编辑视图
2024-05-13 09:15:36
![](https://img.aspxhome.com/file/2023/9/126199_0s.png)
JS 实现计算器详解及实例代码(一)
2024-04-17 10:08:57
![](https://img.aspxhome.com/file/2023/5/136355_0s.png)
python 爬虫如何实现百度翻译
2023-02-20 18:33:51
![](https://img.aspxhome.com/file/2023/5/65415_0s.png)
利用Django-environ如何区分不同环境
2022-01-10 10:52:24
Python获取女友聊天记录详细流程
2022-06-29 21:38:19
![](https://img.aspxhome.com/file/2023/9/134929_0s.png)
python之Socket网络编程详解
2021-05-29 14:43:22
![](https://img.aspxhome.com/file/2023/5/66365_0s.jpg)