YUM安装 创建5.7-MYSQL

本文档详细介绍了在Linux系统中安装MySQL的过程,包括使用wget下载安装包,通过Yum安装服务器,查看版本,设置初始密码,修改数据存储路径以及解决启动问题。在遇到错误时,提供了排查和解决的方法。
摘要由CSDN通过智能技术生成

1:

wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

rpm -ivh  mysql57-community-release-el7-10.noarch.rpm

yum -y install mysql-community-server

2: 查看mysql版本

### 查看MySQL版本
```
yum list installed | grep "mysql"
```
### 卸载Yum Repository
```
yum -y remove mysql57-community-release-el7-10.noarch.rpm

3:

### 启动MySQL
```
service mysqld start
```
### 查看MySQL安装后临时密码
```
grep "temporary password" /var/log/mysqld.log
```
### 通过上述临时密码登录MySQL
```
mysql -u root -p
```
### 登录后更改root登录密码
```
mysql>
mysql> alter user 'root'@'localhost' identified by '密码';
Query OK, 0 rows affected (0.00 sec)

mysql>
```

## 修改MySQL数据存储路径到其他文件夹
```
[root@business-mysql-master ~]# cat /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

4: 把修改好的my.cnf放到etc下:

service mysqld stop
mv /var/lib/mysql /data/

5:

[ERROR] Can't find error-message file '/opt/mysql/share/mysql/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive

find / -name errmsg.sys

[ERROR] --initialize specified but the data directory has files in it. Aborting.

应该是配置文件的错误导致数据文件错误,找到原因是mysqld在

自动启动,当删除data下的文件后,启动之后又有了

 To force a start use "systemctl reset-failed mysqld.service" followed by "systemctl start mysqld.service" again.

 1:  安装包

2: 直接替换/etc/my.cnf

3: service mysqld start

一直报错:  

 是因为配置文件有错误

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

learnalwaystodie

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值